From 80d97a455289422c931a60f69a2ddfde1a378ded Mon Sep 17 00:00:00 2001 From: unsettledgames <47360416+unsettledgames@users.noreply.github.com> Date: Wed, 16 Sep 2020 16:10:55 +0200 Subject: [PATCH] Started duplicating layers --- js/_layer.js | 48 ++++++++++++++++++++++++++++++++++++++++++ views/pixel-editor.hbs | 7 ++++-- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/js/_layer.js b/js/_layer.js index 0e6ffcc..a8f0ad0 100644 --- a/js/_layer.js +++ b/js/_layer.js @@ -460,6 +460,54 @@ function deleteLayer(saveHistory = true) { currentLayer.closeOptionsMenu(); } +function duplicateLayer(event) { + let layerIndex = layers.indexOf(currentLayer); + let toDuplicate = currentLayer; + + // Increasing z-indexes of the layers above + for (let i=layerIndex + 1; i
  • - +
  • - + +
  • +
  • +