diff options
| author | Simon <vesspa0330@gmail.com> | 2025-07-28 22:32:18 -0400 |
|---|---|---|
| committer | Simon <vesspa0330@gmail.com> | 2025-07-28 22:32:18 -0400 |
| commit | 209e2e4b3a0213011ddf0983114fb0ac9179b096 (patch) | |
| tree | 320844a5224f1c067b2c4c8207cdddeaafda7923 | |
| parent | 76a1faf8b069aef95a88c0c1a9e0b356a2982a09 (diff) | |
clone function werks
| -rw-r--r-- | startpage.html | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/startpage.html b/startpage.html index 4da7714..54d2579 100644 --- a/startpage.html +++ b/startpage.html @@ -2289,6 +2289,40 @@ "[" + container.containerSettings.zIndex + "]: " + newName; } + function cloneContainer(buttonPressed) { + let containerId = buttonPressed.id.split("--")[0]; + let container = containerDataMap.get(containerId); + + let newSettings = JSON.parse(JSON.stringify(container.containerSettings)); + newSettings.zIndex = numberTotalContainers + 1; + + let newX = parseInt(container.x.slice(0, -2)) + 10; + let newY = parseInt(container.y.slice(0, -2)) + 10; + + let clone = new Container( + findLowestAvailableId(), + container.name + " clone", + String(newX + "px"), + String(newY + "px"), + container.height, + container.width, + container.imageUrl, + newSettings, + container.sections + ); + zIndexMap.set(numberTotalContainers + 1, clone.id); + + if (clone.imageUrl == undefined) { + clone.createTextContainerMenuListing(); + } + else { + clone.createImageContainerMenuListing(); + } + clone.addSettingsMenuEventListeners(); + + numberTotalContainers++; + updateContainerListingOrder(); + } function deleteContainer(buttonPressed) { let containerId = buttonPressed.id.split("--")[0]; let container = containerDataMap.get(containerId); |
