diff --git a/src/helper/layer.js b/src/helper/layer.js index 3569796a..8691aee3 100644 --- a/src/helper/layer.js +++ b/src/helper/layer.js @@ -82,10 +82,10 @@ const setGuideItem = function (item) { item.guide = true; if (isGroupItem(item)) { for (let i = 0; i < item.children.length; i++) { - setGuideItem(item.children[i]) + setGuideItem(item.children[i]); } } -} +}; /** * Removes the guide layers, e.g. for purposes of exporting the image. Must call showGuideLayers to re-add them. diff --git a/src/helper/selection-tools/move-tool.js b/src/helper/selection-tools/move-tool.js index 7ea8eca7..d1413d68 100644 --- a/src/helper/selection-tools/move-tool.js +++ b/src/helper/selection-tools/move-tool.js @@ -75,11 +75,11 @@ class MoveTool { this.selectedItems = this.mode === Modes.RESHAPE ? getSelectedLeafItems() : getSelectedRootItems(); let selectionBounds; - for (const item of this.selectedItems) { - if (!selectionBounds) { - selectionBounds = item.bounds; + for (const selectedItem of this.selectedItems) { + if (selectionBounds) { + selectionBounds = selectionBounds.unite(selectedItem.bounds); } else { - selectionBounds = selectionBounds.unite(item.bounds); + selectionBounds = selectedItem.bounds; } } this.selectionCenter = selectionBounds.center; @@ -128,7 +128,11 @@ class MoveTool { // crosshair to line up. const center = new paper.Point(ART_BOARD_WIDTH / 2, ART_BOARD_HEIGHT / 2); if (!event.modifiers.shift && this.mode === Modes.SELECT) { - if (checkPointsClose(this.selectionCenter.add(dragVector), center, SNAPPING_THRESHOLD / paper.view.zoom /* threshold */)) { + if (checkPointsClose( + this.selectionCenter.add(dragVector), + center, + SNAPPING_THRESHOLD / paper.view.zoom /* threshold */)) { + snapVector = center.subtract(this.selectionCenter); } } diff --git a/src/helper/view.js b/src/helper/view.js index 990a4308..b2bbd112 100644 --- a/src/helper/view.js +++ b/src/helper/view.js @@ -39,7 +39,7 @@ const _resizeCrosshair = () => { getBackgroundGuideLayer().dragCrosshair.scale( CROSSHAIR_SIZE / getBackgroundGuideLayer().dragCrosshair.bounds.width / paper.view.zoom); } -} +}; // Zoom keeping a project-space point fixed. // This article was helpful http://matthiasberth.com/tech/stable-zoom-and-pan-in-paperjs