From 4b7fda14ba76fc4244204f8d2b95753f4b46ea22 Mon Sep 17 00:00:00 2001
From: Asaad Mahmood <Unknowngi@live.com>
Date: Tue, 21 Jul 2015 16:47:08 +0500
Subject: mm-1631 - Fixing image previewer bug

---
 web/react/components/view_image.jsx | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'web/react/components/view_image.jsx')

diff --git a/web/react/components/view_image.jsx b/web/react/components/view_image.jsx
index 38f439946..2274f3f2e 100644
--- a/web/react/components/view_image.jsx
+++ b/web/react/components/view_image.jsx
@@ -25,7 +25,11 @@ module.exports = React.createClass({
         this.setState({ imgId: nextProps.startId });
     },
     loadImage: function(id) {
-        if (this.state.loaded[id] || this.state.images[id]) return;
+        var imgHeight = $(window).height()-100;
+        if (this.state.loaded[id] || this.state.images[id]){
+            $('.modal .modal-image .image-wrapper img').css("max-height",imgHeight);
+            return;
+        };
 
         var src = "";
         if (this.props.imgCount > 0) {
@@ -48,6 +52,7 @@ module.exports = React.createClass({
                 var loaded = self.state.loaded;
                 loaded[imgid] = true;
                 self.setState({ loaded: loaded });
+                $(self.refs.image.getDOMNode()).css("max-height",imgHeight);
             };
         }(id);
         var images = this.state.images;
@@ -56,10 +61,8 @@ module.exports = React.createClass({
     },
     componentDidUpdate: function() {
         if (this.refs.image) {
-            var height = $(window).height()-100;
             if (this.state.loaded[this.state.imgId]) {
                 $(this.refs.imageWrap.getDOMNode()).removeClass("default");
-                $(this.refs.image.getDOMNode()).css("max-height",height);
             }
         }
     },
-- 
cgit v1.2.3-1-g7c22

