From 286d19237dc970f6e53bd672d0be6ffda9c0e302 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 21 Jun 2016 00:58:53 +0300 Subject: [PATCH] minor bug fixes... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/ui-single-image.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ui (gen4)/features/ui-single-image.js b/ui (gen4)/features/ui-single-image.js index 232c3340..fb6705ce 100755 --- a/ui (gen4)/features/ui-single-image.js +++ b/ui (gen4)/features/ui-single-image.js @@ -110,10 +110,16 @@ var SingleImageActions = actions.Actions({ } var viewer = this.ribbons.viewer - var img = this.ribbons.getImage() + var images = viewer.find('.ribbon .image') + var img = this.ribbons.getImage()[0] || images[0] + + // no images loaded... + if(!img){ + return + } //* XXX these do not account for margins.... - var s = getComputedStyle(img[0]) + var s = getComputedStyle(img) var w = parseFloat(s.width) var h = parseFloat(s.height) @@ -127,8 +133,6 @@ var SingleImageActions = actions.Actions({ // change proportions... if(c < threshold){ - var images = viewer.find('.ribbon .image') - var W = viewer.width() var H = viewer.height() @@ -198,8 +202,6 @@ var SingleImageActions = actions.Actions({ // reset proportions to square... } else if(w != h) { - var images = viewer.find('.ribbon .image') - getAnimationFrame(function(){ that.ribbons.preventTransitions()