Skip to content

Commit

Permalink
SVGをkonvaに移植した
Browse files Browse the repository at this point in the history
  • Loading branch information
hutinoatari committed Jul 2, 2023
1 parent 86d54ba commit 35963c2
Show file tree
Hide file tree
Showing 10 changed files with 1,284 additions and 211 deletions.
41 changes: 41 additions & 0 deletions frontend/components/MapParts.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { FC } from "react";
import { Stage, Group, Rect, Text } from "react-konva";
import { Point } from "../types/svgPartsTypes";

export interface PlatformProps {
name: string;
position: Point;
isHorizontal?: boolean;
size?: number;
}
const Platform: FC<PlatformProps> = ({
name,
position,
isHorizontal = true,
size = 40,
}) => {
const width = isHorizontal ? size : 20;
const height = isHorizontal ? 20 : size;
return (
<Group draggable>
<Rect
x={position.x - width / 2}
y={position.y - height / 2}
width={width}
height={height}
fill="white"
stroke="black"
/>
<Text
text={name}
x={position.x}
y={position.y}
align="center"
verticalAlign="middle"
fontSize={20}
/>
</Group>
);
};

export { Platform };
2 changes: 1 addition & 1 deletion frontend/components/forms/PlatformComponentForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, useEffect, useState } from "react";
import { PlatformProps } from "../svgParts/Platform";
import { PlatformProps } from "../MapParts";

interface Props {
onChange: (p: PlatformProps) => void;
Expand Down
47 changes: 0 additions & 47 deletions frontend/components/svgParts/Platform.tsx

This file was deleted.

26 changes: 0 additions & 26 deletions frontend/components/svgParts/Rail.tsx

This file was deleted.

41 changes: 0 additions & 41 deletions frontend/components/svgParts/StopPoint.tsx

This file was deleted.

62 changes: 0 additions & 62 deletions frontend/components/svgParts/SwitchPoint.tsx

This file was deleted.

Loading

0 comments on commit 35963c2

Please sign in to comment.