##// END OF EJS Templates
Fixed image popup margin in rare cases
neko259 -
r1357:3a3fc639 default
parent child Browse files
Show More
@@ -23,6 +23,8 b''
23 23 for the JavaScript code in this page.
24 24 */
25 25
26 var IMAGE_POPUP_MARGIN = 10;
27
26 28
27 29 var IMAGE_VIEWERS = [
28 30 ['simple', new SimpleImageViewer()],
@@ -69,8 +71,6 b' SimpleImageViewer.prototype.view = funct'
69 71
70 72 function PopupImageViewer() {}
71 73 PopupImageViewer.prototype.view = function (post) {
72 var margin = 20; //..change
73
74 74 var el = post;
75 75 var thumb_id = 'full' + el.find('img').attr('alt');
76 76
@@ -89,11 +89,15 b' PopupImageViewer.prototype.view = functi'
89 89 // New image size
90 90 var w_scale = 1;
91 91 var h_scale = 1;
92 if (full_img_w > win_w) {
93 w_scale = full_img_w / (win_w - margin);
92
93 var freeWidth = win_w - 2 * IMAGE_POPUP_MARGIN;
94 var freeHeight = win_h - 2 * IMAGE_POPUP_MARGIN;
95
96 if (full_img_w > freeWidth) {
97 w_scale = full_img_w / freeWidth;
94 98 }
95 if (full_img_h > win_h) {
96 h_scale = full_img_h / (win_h - margin);
99 if (full_img_h > freeHeight) {
100 h_scale = full_img_h / freeHeight;
97 101 }
98 102
99 103 var scale = Math.max(w_scale, h_scale)
General Comments 0
You need to be logged in to leave comments. Login now