From 7eab386122bbf6ad2c7a04b1618322842dd7b82f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Szab=C3=B3?= Date: Fri, 26 Aug 2016 01:40:56 +0200 Subject: [PATCH] Make sure opacity is a float and rounded --- src/js/model/Layer.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/model/Layer.js b/src/js/model/Layer.js index c41ca987..0dba5340 100644 --- a/src/js/model/Layer.js +++ b/src/js/model/Layer.js @@ -37,10 +37,13 @@ }; ns.Layer.prototype.setOpacity = function (opacity) { + if (typeof opacity == 'string') { + opacity = parseFloat(opacity); + } if (opacity === null || isNaN(opacity) || opacity < 0 || opacity > 1) { return; } - this.opacity = opacity; + this.opacity = +opacity.toFixed(3); }; ns.Layer.prototype.isTransparent = function () {