Skip to content

Commit

Permalink
fix: Highligh the local bounds of grafting target node
Browse files Browse the repository at this point in the history
  • Loading branch information
miyanokomiya committed May 2, 2024
1 parent 53ef56e commit c9acf9b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/composables/states/appCanvas/tree/treeRootMovingState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { newMovingShapeState } from "../movingShapeState";
import { findBetterShapeAt, getNextShapeComposite } from "../../../shapeComposite";
import { TreeShapeBase } from "../../../../shapes/tree/core";
import { applyFillStyle } from "../../../../utils/fillStyle";
import { scaleGlobalAlpha } from "../../../../utils/renderer";
import { applyPath, scaleGlobalAlpha } from "../../../../utils/renderer";
import {
canBeGraftTarget,
getNextTreeLayout,
Expand Down Expand Up @@ -63,10 +63,11 @@ export function newTreeRootMovingState(option: Option): AppCanvasState {
const shapeComposite = ctx.getShapeComposite();
const style = ctx.getStyleScheme();
applyFillStyle(renderCtx, { color: style.selectionPrimary });
const rect = shapeComposite.getWrapperRect(graftTargetShape);
const polygon = shapeComposite.getLocalRectPolygon(graftTargetShape);
scaleGlobalAlpha(renderCtx, 0.5, () => {
renderCtx.beginPath();
renderCtx.fillRect(rect.x, rect.y, rect.width, rect.height);
applyPath(renderCtx, polygon, true);
renderCtx.fill();
});
} else {
movingState.render?.(ctx, renderCtx);
Expand Down

0 comments on commit c9acf9b

Please sign in to comment.