From 5faa985dea7aadca2a8d151d7407276f362b7d1a Mon Sep 17 00:00:00 2001 From: Pascal Seitz Date: Sun, 4 Dec 2016 11:40:18 +0100 Subject: [PATCH 1/2] Copy between piskels #272 --- src/js/selection/SelectionManager.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/js/selection/SelectionManager.js b/src/js/selection/SelectionManager.js index 63696e12..2202c8ce 100644 --- a/src/js/selection/SelectionManager.js +++ b/src/js/selection/SelectionManager.js @@ -93,7 +93,11 @@ ns.SelectionManager.prototype.paste = function() { if (!this.currentSelection || !this.currentSelection.hasPastedContent) { - return; + if (window.localStorage.getItem('piskel.clipboard')) { + this.currentSelection = JSON.parse(window.localStorage.getItem('piskel.clipboard')); + }else{ + return; + } } var pixels = this.currentSelection.pixels; @@ -146,6 +150,7 @@ ns.SelectionManager.prototype.copy = function() { if (this.currentSelection && this.piskelController.getCurrentFrame()) { this.currentSelection.fillSelectionFromFrame(this.piskelController.getCurrentFrame()); + window.localStorage.setItem('piskel.clipboard', JSON.stringify(this.currentSelection)); } }; From 9608995d9c32737590039d4cb444295f1322ad4f Mon Sep 17 00:00:00 2001 From: Pascal Seitz Date: Sun, 4 Dec 2016 11:59:07 +0100 Subject: [PATCH 2/2] Fix spaces --- src/js/selection/SelectionManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/selection/SelectionManager.js b/src/js/selection/SelectionManager.js index 2202c8ce..d04d3046 100644 --- a/src/js/selection/SelectionManager.js +++ b/src/js/selection/SelectionManager.js @@ -95,7 +95,7 @@ if (!this.currentSelection || !this.currentSelection.hasPastedContent) { if (window.localStorage.getItem('piskel.clipboard')) { this.currentSelection = JSON.parse(window.localStorage.getItem('piskel.clipboard')); - }else{ + } else { return; } }