mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Make sure opacity is a float and rounded
This commit is contained in:
parent
0c0aa5f2c9
commit
7eab386122
@ -37,10 +37,13 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.Layer.prototype.setOpacity = function (opacity) {
|
ns.Layer.prototype.setOpacity = function (opacity) {
|
||||||
|
if (typeof opacity == 'string') {
|
||||||
|
opacity = parseFloat(opacity);
|
||||||
|
}
|
||||||
if (opacity === null || isNaN(opacity) || opacity < 0 || opacity > 1) {
|
if (opacity === null || isNaN(opacity) || opacity < 0 || opacity > 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.opacity = opacity;
|
this.opacity = +opacity.toFixed(3);
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.Layer.prototype.isTransparent = function () {
|
ns.Layer.prototype.isTransparent = function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user