From 7fe7bca6d8cc3900a48c6cb0539fd6a1b0ecda20 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Tue, 21 Jan 2020 17:56:42 -0500 Subject: [PATCH] update offset before repeated paste --- js/block.js | 8 ++++++++ js/blocks.js | 16 ++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/js/block.js b/js/block.js index 12596b433c..d81ec7bb6d 100644 --- a/js/block.js +++ b/js/block.js @@ -5843,6 +5843,10 @@ function Block(protoblock, blocks, overrideName) { * Sets up context menu for each block */ this.piemenuBlockContext = function () { + var pasteDx = 0; + var pasteDy = 0; + + var that = this; var thisBlock = this.blocks.blockList.indexOf(this); @@ -5909,7 +5913,11 @@ function Block(protoblock, blocks, overrideName) { wheel.navItems[0].navigateFunction = function () { that.blocks.activeBlock = thisBlock; that.blocks.prepareStackForCopy(); + that.blocks.pasteDx = pasteDx; + that.blocks.pasteDy = pasteDy; that.blocks.pasteStack(); + pasteDx += 21; + pasteDy += 21; // docById('contextWheelDiv').style.display = 'none'; }; diff --git a/js/blocks.js b/js/blocks.js index daa0e82da6..31d2504966 100644 --- a/js/blocks.js +++ b/js/blocks.js @@ -63,8 +63,8 @@ function Blocks (activity) { this.longPressTimeout = null; // Paste offset is used to ensure pasted blocks don't overlap. - this._pasteDX = 0; - this._pasteDY = 0; + this.pasteDx = 0; + this.pasteDy = 0; // What did we select? this.selectedStack = null; @@ -4319,8 +4319,8 @@ function Blocks (activity) { // console.debug(this.selectedBlocksObj); // Reset paste offset. - this._pasteDX = 0; - this._pasteDY = 0; + this.pasteDx = 0; + this.pasteDy = 0; }; /* @@ -4356,10 +4356,10 @@ function Blocks (activity) { // Reposition the paste location relative to the stage position. console.debug(this.selectedBlocksObj); if (this.selectedBlocksObj != null) { - this.selectedBlocksObj[0][2] = 175 - this.stage.x + this._pasteDX; - this.selectedBlocksObj[0][3] = 75 - this.stage.y + this._pasteDY; - this._pasteDX += 21; - this._pasteDY += 21; + this.selectedBlocksObj[0][2] = 175 - this.stage.x + this.pasteDx; + this.selectedBlocksObj[0][3] = 75 - this.stage.y + this.pasteDy; + this.pasteDx += 21; + this.pasteDy += 21; this.loadNewBlocks(this.selectedBlocksObj); } };