Convert alpha value to an icon. Icon cycles a layer's opacity value from 1α, 0.5α, to 0α representing visibility.

This commit is contained in:
Zakar Handricken 2018-09-03 00:09:35 -04:00
parent 230a38bf07
commit 175f178f38

View File

@ -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);
}
};
})();