From afae633779ff91e8f42fd020759f113e83956184 Mon Sep 17 00:00:00 2001 From: zoemcl Date: Wed, 26 Jul 2017 11:10:39 -0400 Subject: [PATCH] Fixed #252: Opacity now works the opacity sliders for glyph opacity and background image are now functional. They stopped working after zoom was implemented but they now work. --- src/views/gui.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/views/gui.js b/src/views/gui.js index 97a111d..11b3b92 100644 --- a/src/views/gui.js +++ b/src/views/gui.js @@ -125,6 +125,7 @@ Toe.View.GUI.prototype.setupNavBar = function() { Toe.View.GUI.prototype.setupSideBar = function(parentDivId, toggles) { // cache instance variable var gui = this; + var elements = gui.rendEng.canvas.getObjects(); // create container for appearance sliders if ($("#sidebar-app").length == 0) { @@ -137,7 +138,9 @@ Toe.View.GUI.prototype.setupSideBar = function(parentDivId, toggles) { 'min="0.0" max="1.0" step="0.05" value="' + toggles.initBgImgOpacity + '" />\n'); $("#sldr_bgImgOpacity").bind("change", function() { - gui.rendEng.canvas.backgroundImageOpacity = $(this).val(); + if(elements[0]._element){ + elements[0].opacity = $(this).val(); + } gui.rendEng.repaint(); }); } @@ -151,7 +154,9 @@ Toe.View.GUI.prototype.setupSideBar = function(parentDivId, toggles) { $("#sldr_glyphOpacity").bind("change", function() { var opacity = $(this).val(); gui.rendEng.canvas.forEachObject(function(obj) { - obj.setOpacity(opacity); + if(obj.eleRef){ + obj.setOpacity(opacity); + } }); gui.rendEng.repaint();