Skip to content

Commit

Permalink
update offset before repeated paste
Browse files Browse the repository at this point in the history
  • Loading branch information
walterbender committed Jan 21, 2020
1 parent 0e678d8 commit 7fe7bca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
8 changes: 8 additions & 0 deletions js/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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';
};

Expand Down
16 changes: 8 additions & 8 deletions js/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
};

/*
Expand Down Expand Up @@ -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);
}
};
Expand Down

0 comments on commit 7fe7bca

Please sign in to comment.