diff --git a/editor/src/components/canvas/canvas-strategies/strategies/draw-to-insert-strategy.spec.browser2.tsx b/editor/src/components/canvas/canvas-strategies/strategies/draw-to-insert-strategy.spec.browser2.tsx index e1ed939a233c..da4499c5e81c 100644 --- a/editor/src/components/canvas/canvas-strategies/strategies/draw-to-insert-strategy.spec.browser2.tsx +++ b/editor/src/components/canvas/canvas-strategies/strategies/draw-to-insert-strategy.spec.browser2.tsx @@ -236,9 +236,9 @@ export var storyboard = ( gridColumn: '2', gridRow: '1', height: '100px', - left: '33px', + left: '83px', position: 'absolute', - top: '50px', + top: '100px', width: '100px', }) }) diff --git a/editor/src/components/canvas/canvas-strategies/strategies/grid-draw-to-insert-strategy.tsx b/editor/src/components/canvas/canvas-strategies/strategies/grid-draw-to-insert-strategy.tsx index d2dd23bddb8a..dbc69ce71f08 100644 --- a/editor/src/components/canvas/canvas-strategies/strategies/grid-draw-to-insert-strategy.tsx +++ b/editor/src/components/canvas/canvas-strategies/strategies/grid-draw-to-insert-strategy.tsx @@ -257,17 +257,16 @@ function getFrameForInsertion( offset: CanvasPoint, ): CanvasRectangle { if (interactionData.type === 'DRAG') { - const frame = - interactionData.drag ?? canvasVector({ x: defaultSize.width, y: defaultSize.height }) + const origin = interactionData.drag ?? { x: defaultSize.width / 2, y: defaultSize.height / 2 } - return roundRectangleToNearestWhole( - canvasRectangle({ - x: offset.x - frame.x, - y: offset.y - frame.y, - width: frame.x, - height: frame.y, - }), - ) + const { x, y } = { x: offset.x - origin.x, y: offset.y - origin.y } + + const { width, height } = + interactionData.drag == null + ? defaultSize + : { width: interactionData.drag.x, height: interactionData.drag.y } + + return roundRectangleToNearestWhole(canvasRectangle({ x, y, width, height })) } if (interactionData.type === 'HOVER') {