From 175f178f38089424077910f17229dfc5260a5f4c Mon Sep 17 00:00:00 2001 From: Zakar Handricken Date: Mon, 3 Sep 2018 00:09:35 -0400 Subject: [PATCH] =?UTF-8?q?Convert=20alpha=20value=20to=20an=20icon.=20Ico?= =?UTF-8?q?n=20cycles=20a=20layer's=20opacity=20value=20from=201=CE=B1,=20?= =?UTF-8?q?0.5=CE=B1,=20to=200=CE=B1=20representing=20visibility.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/controller/LayersListController.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/js/controller/LayersListController.js b/src/js/controller/LayersListController.js index 9ad1dc3a..227de4fe 100644 --- a/src/js/controller/LayersListController.js +++ b/src/js/controller/LayersListController.js @@ -143,7 +143,14 @@ } else if (el.classList.contains('layer-item-opacity')) { index = pskl.utils.Dom.getData(el, 'layerIndex'); var layer = this.piskelController.getLayerAt(parseInt(index, 10)); - var opacity = window.prompt('Set layer opacity (value between 0 and 1)', layer.getOpacity()); + var opacity = layer.getOpacity(); + if (opacity == 1) { + opacity = 0.5; + } else if (opacity == 0.5) { + opacity = 0; + } else if (opacity == 0) { + opacity = 1; + } this.piskelController.setLayerOpacityAt(index, opacity); } }; @@ -182,6 +189,8 @@ this.mergeDownCurrentLayer_(); } else if (action == 'edit') { this.renameCurrentLayer_(); + } else if (action == 'alpha') { + this.changeAlphaOfLayer_(); } }; @@ -196,4 +205,6 @@ pskl.UserSettings.set(pskl.UserSettings.LAYER_OPACITY, Constants.DEFAULT.LAYER_OPACITY); } }; + + })();