Skip to content

Commit 4998f96

Browse files
committed
More layer fixes
1 parent 16faf63 commit 4998f96

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/js/controller/LayersListController.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,9 @@
164164
};
165165

166166
ns.LayersListController.prototype.onClick_ = function (evt) {
167-
var originElement = evt.target || evt.srcElement
168-
var el = originElement.closest(".button");
167+
var el = evt.target || evt.srcElement
169168
var index;
170-
if (el.classList.contains('button')) {
171-
this.onButtonClick_(el, evt);
172-
} else if (el.classList.contains('layer-name')) {
169+
if (el.classList.contains('layer-name')) {
173170
var currentIndex = this.piskelController.getCurrentLayerIndex();
174171
index = pskl.utils.Dom.getData(el, 'layerIndex');
175172
if (index != currentIndex) {
@@ -182,6 +179,11 @@
182179
var layer = this.piskelController.getLayerAt(parseInt(index, 10));
183180
var opacity = window.prompt('Set layer opacity (value between 0 and 1)', layer.getOpacity());
184181
this.piskelController.setLayerOpacityAt(index, opacity);
182+
} else {
183+
var containingButton = el.closest(".button");
184+
if (containingButton && containingButton.classList.contains('button')) {
185+
this.onButtonClick_(containingButton, evt);
186+
}
185187
}
186188
};
187189

0 commit comments

Comments
 (0)