Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the cursor move while moving #44

Merged
merged 4 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/Glyph.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@
fill: #cc0000;
stroke: none;
}

.movable-stroke {
cursor: move;
}
10 changes: 8 additions & 2 deletions src/components/Glyph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ const GlyphComponent = (props: GlyphComponentProps) => {
<g className="strokes-deselected">
{nonSelection.map((index) => (
<g key={index} onMouseDown={(evt) => props.handleMouseDownDeselectedStroke?.(evt, index)}>
<Stroke polygons={polygonsSep[index]} />
<Stroke
polygons={polygonsSep[index]}
className={props.handleMouseDownDeselectedStroke ? "movable-stroke" : ""}
/>
</g>
))}
</g>
Expand All @@ -51,7 +54,10 @@ const GlyphComponent = (props: GlyphComponentProps) => {
<g className="strokes-selected">
{selection.map((index) => (
<g key={index} onMouseDown={(evt) => props.handleMouseDownSelectedStroke?.(evt, index)}>
<Stroke polygons={polygonsSep[index]} />
<Stroke
polygons={polygonsSep[index]}
className={props.handleMouseDownSelectedStroke ? "movable-stroke" : ""}
/>
</g>
))}
</g>
Expand Down
7 changes: 6 additions & 1 deletion src/components/Stroke.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ import { Polygons } from '@kurgm/kage-engine';

export interface StrokeComponentProps {
polygons: Polygons;
className?: string;
}

const StrokeComponent = (props: StrokeComponentProps) => (
<>
{props.polygons.array.map((polygon, i) => (
<polygon key={i} points={polygon.array.map(({ x, y }) => `${x},${y} `).join("")} />
<polygon
key={i}
className={props.className}
points={polygon.array.map(({ x, y }) => `${x},${y} `).join("")}
/>
))}
</>
);
Expand Down
1 change: 1 addition & 0 deletions src/components/StrokeCenterLine.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
fill: none;
stroke: #ffffff;
stroke-width: 1px;
pointer-events: none;
}