Skip to content

Commit

Permalink
feat: Show bezier controls while moving vertices
Browse files Browse the repository at this point in the history
  • Loading branch information
miyanokomiya committed Sep 16, 2024
1 parent 9408d98 commit 5814aa3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ export function newMovingLineVertexState(option: Option): AppCanvasState {
const scale = ctx.getScale();
const style = ctx.getStyleScheme();
const vertexSize = 8 * scale;
applyFillStyle(renderCtx, { color: style.selectionPrimary });

applyFillStyle(renderCtx, { color: style.selectionPrimary });
scaleGlobalAlpha(renderCtx, 0.5, () => {
renderCtx.beginPath();
renderCtx.arc(origin.x, origin.y, vertexSize, 0, TAU);
Expand All @@ -130,6 +130,7 @@ export function newMovingLineVertexState(option: Option): AppCanvasState {
const line = ctx.getShapeComposite().mergedShapeMap[option.lineShape.id] as LineShape;
renderBezierControls(renderCtx, style, scale, line);

applyFillStyle(renderCtx, { color: style.selectionPrimary });
renderCtx.beginPath();
renderCtx.arc(vertex.x, vertex.y, vertexSize, 0, TAU);
renderCtx.fill();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { COMMAND_EXAM_SRC } from "../commandExams";
import { ShapeSnapping, SnappingResult, newShapeSnapping, renderSnappingResult } from "../../../shapeSnapping";
import { TAU } from "../../../../utils/geometry";
import { getPatchAfterLayouts } from "../../../shapeLayoutHandler";
import { renderBezierControls } from "../../../lineBounding";

interface Option {
lineShape: LineShape;
Expand Down Expand Up @@ -103,8 +104,12 @@ export function newMovingNewVertexState(option: Option): AppCanvasState {
render(ctx, renderCtx) {
const scale = ctx.getScale();
const style = ctx.getStyleScheme();
const vertexSize = 8 * scale;

const line = ctx.getShapeComposite().mergedShapeMap[option.lineShape.id] as LineShape;
renderBezierControls(renderCtx, style, scale, line);

applyFillStyle(renderCtx, { color: style.selectionPrimary });
const vertexSize = 8 * scale;
renderCtx.beginPath();
renderCtx.ellipse(vertex.x, vertex.y, vertexSize, vertexSize, 0, 0, TAU);
renderCtx.fill();
Expand Down

0 comments on commit 5814aa3

Please sign in to comment.