Update copypaste.js

Fixed cloners forgetting their clone thing after copy
This commit is contained in:
Agni Rammohan 2025-07-29 09:38:46 -07:00 committed by GitHub
parent 2b455a531f
commit 0e6a9e4419
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 4 deletions

View File

@ -10,7 +10,7 @@ function pluckMatrix(x, y, w, h) {
for (var i = 0; i < w; i++) { for (var i = 0; i < w; i++) {
var px = pixelMap[x + i]?.[y + j]; var px = pixelMap[x + i]?.[y + j];
if (px) { if (px) {
row.push({ element: px.element, temp: px.temp, color: px.color }); row.push({ element: px.element, temp: px.temp, color: px.color, clone: px?.clone });
} else { } else {
row.push("#"); row.push("#");
} }
@ -72,9 +72,11 @@ document.addEventListener("mousedown", (event) => {
if (cell !== "#" && cell.element) { if (cell !== "#" && cell.element) {
var px = createPixel(cell.element, x + i - (size-1)/2, y + j - (size-1)/2); var px = createPixel(cell.element, x + i - (size-1)/2, y + j - (size-1)/2);
if (px) { var px2 = pixelMap[x + i - (size-1)/2][y + j - (size-1)/2];
if (typeof cell.temp === "number") px.temp = cell.temp; if (px2) {
if (typeof cell.color === "string") px.color = cell.color; px2.temp = cell.temp;
px2.clone = cell.clone;
px2.color = cell.color;
} }
} }
} }