diff --git a/ui (gen4)/features/ui-single-image.js b/ui (gen4)/features/ui-single-image.js index fb6705ce..06f14ee0 100755 --- a/ui (gen4)/features/ui-single-image.js +++ b/ui (gen4)/features/ui-single-image.js @@ -111,17 +111,20 @@ var SingleImageActions = actions.Actions({ var viewer = this.ribbons.viewer var images = viewer.find('.ribbon .image') - var img = this.ribbons.getImage()[0] || images[0] // no images loaded... - if(!img){ + if(images.length == 0){ return } - //* XXX these do not account for margins.... + /* XXX these do not account for margins.... + var img = this.ribbons.getImage()[0] || images[0] var s = getComputedStyle(img) var w = parseFloat(s.width) var h = parseFloat(s.height) + //*/ + var w = this.ribbons.getVisibleImageSize('width', 1) + var h = this.ribbons.getVisibleImageSize('height', 1) // inner diameter var di = Math.min(h, w) diff --git a/ui (gen4)/imagegrid/ribbons.js b/ui (gen4)/imagegrid/ribbons.js index f4289e2a..e1687c96 100755 --- a/ui (gen4)/imagegrid/ribbons.js +++ b/ui (gen4)/imagegrid/ribbons.js @@ -668,6 +668,14 @@ var RibbonsPrototype = { .appendTo(this.viewer) } + // account for image rotation... + // NOTE: this way we do not need to account for margins... + var o = img.attr('orientation') + o = o == null ? 0 : o + dim = o == 0 || o == 180 ? dim + // swap width/height when image is rotated +/- 90deg... + : dim == 'height' ? 'width' + : 'height' // do the calc... scale = scale || this.scale()