From dfed3f2db9526d4017314c243c55cedf0ba8aef4 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Mon, 11 Jan 2021 01:30:16 -0700 Subject: [PATCH] Fix copied floated selections being entangled --- js/main-editor.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/main-editor.js b/js/main-editor.js index bdcbe2f..943124a 100644 --- a/js/main-editor.js +++ b/js/main-editor.js @@ -521,7 +521,7 @@ class SelectOperation extends MouseOperation { if (this.make_copy) { if (this.editor.selection.is_floating) { // Stamp the floating selection but keep it floating - this.editor.selection.stamp_float(); + this.editor.selection.stamp_float(true); } else { this.editor.selection.enfloat(true); @@ -2363,7 +2363,7 @@ class Selection { this.svg_group.append(this.floated_element); } - stamp_float() { + stamp_float(copy = false) { if (! this.floated_element) return; @@ -2373,6 +2373,9 @@ class Selection { for (let [x, y] of this.iter_cells()) { let n = stored_level.coords_to_scalar(x, y); let cell = this.floated_cells[i]; + if (copy) { + cell = cell.map(tile => tile ? {...tile} : null); + } cell.x = x; cell.y = y; stored_level.linear_cells[n] = cell;