Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 0678397

Browse files
committed
Fix thumb positioning for Imagick preview
1 parent 4dc943c commit 0678397

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

core/src/plugins/editor.imagick/class.IMagickPreviewer.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,17 @@ Class.create("IMagickPreviewer", Diaporama, {
9999
align:'absmiddle',
100100
src:IMagickPreviewer.prototype.getThumbnailSource(ajxpNode)
101101
});
102-
img.resizePreviewElement = function(dimensionObject){
102+
var div = new Element('div');
103+
div.insert(img);
104+
div.resizePreviewElement = function(dimensionObject){
103105
var ratio = img.ratio;
104106
if(!ratio) {
105107
var fakeIm = new Image();
106108
fakeIm.onload = function(){
107109
img.ratio = fakeIm.width/fakeIm.height;
108-
img.resizePreviewElement(dimensionObject);
110+
div.resizePreviewElement(dimensionObject);
109111
};
110112
fakeIm.src = img.src;
111-
//img.onload = function(){img.resizePreviewElement(dimensionObject);};
112113
ratio = 1.0;
113114
}
114115
var imgDim = {
@@ -117,6 +118,13 @@ Class.create("IMagickPreviewer", Diaporama, {
117118
};
118119
var styleObj = fitRectangleToDimension(imgDim, dimensionObject);
119120
img.setStyle(styleObj);
121+
div.setStyle({
122+
height:styleObj.height,
123+
width:styleObj.width,
124+
/*position:'relative',*/
125+
display:'inline'
126+
});
127+
if($(div.parentNode)) $(div.parentNode).setStyle({position:"relative"});
120128
};
121129
img.observe("mouseover", function(event){
122130
var theImage = event.target;
@@ -159,7 +167,7 @@ Class.create("IMagickPreviewer", Diaporama, {
159167
if(theImage.up('.thumbnail_selectable_cell')) return;
160168
theImage.previewOpener.setStyle({display:'none'});
161169
});
162-
return img;
170+
return div;
163171
},
164172

165173
getRESTPreviewLinks:function(node){

0 commit comments

Comments
 (0)