|
|
|
|
@ -661,12 +661,6 @@ define([
|
|
|
|
|
.width(width)
|
|
|
|
|
.height(height);
|
|
|
|
|
|
|
|
|
|
// The jQuery resize handlers don't seem to work on the svg element.
|
|
|
|
|
// When the svg renders completely, measure it's size and set the parent
|
|
|
|
|
// div to that size. Then set the svg to 100% the size of the parent
|
|
|
|
|
// div and make the parent div resizable.
|
|
|
|
|
this._dblclick_to_reset_size(svg_area, true, false);
|
|
|
|
|
|
|
|
|
|
svg_area.append(svg);
|
|
|
|
|
toinsert.append(svg_area);
|
|
|
|
|
element.append(toinsert);
|
|
|
|
|
@ -674,46 +668,6 @@ define([
|
|
|
|
|
return toinsert;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
OutputArea.prototype._dblclick_to_reset_size = function (img, immediately, resize_parent) {
|
|
|
|
|
/**
|
|
|
|
|
* Add a resize handler to an element
|
|
|
|
|
*
|
|
|
|
|
* img: jQuery element
|
|
|
|
|
* immediately: bool=False
|
|
|
|
|
* Wait for the element to load before creating the handle.
|
|
|
|
|
* resize_parent: bool=True
|
|
|
|
|
* Should the parent of the element be resized when the element is
|
|
|
|
|
* reset (by double click).
|
|
|
|
|
*/
|
|
|
|
|
var callback = function (){
|
|
|
|
|
var h0 = img.height();
|
|
|
|
|
var w0 = img.width();
|
|
|
|
|
if (!(h0 && w0)) {
|
|
|
|
|
// zero size, don't make it resizable
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
img.resizable({
|
|
|
|
|
aspectRatio: true,
|
|
|
|
|
autoHide: true
|
|
|
|
|
});
|
|
|
|
|
img.dblclick(function () {
|
|
|
|
|
// resize wrapper & image together for some reason:
|
|
|
|
|
img.height(h0);
|
|
|
|
|
img.width(w0);
|
|
|
|
|
if (resize_parent === undefined || resize_parent) {
|
|
|
|
|
img.parent().height(h0);
|
|
|
|
|
img.parent().width(w0);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (immediately) {
|
|
|
|
|
callback();
|
|
|
|
|
} else {
|
|
|
|
|
img.on("load", callback);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var set_width_height = function (img, md, mime) {
|
|
|
|
|
/**
|
|
|
|
|
* set width and height of an img element from metadata
|
|
|
|
|
@ -735,7 +689,6 @@ define([
|
|
|
|
|
}
|
|
|
|
|
img[0].src = 'data:image/png;base64,'+ png;
|
|
|
|
|
set_width_height(img, md, 'image/png');
|
|
|
|
|
this._dblclick_to_reset_size(img);
|
|
|
|
|
toinsert.append(img);
|
|
|
|
|
element.append(toinsert);
|
|
|
|
|
return toinsert;
|
|
|
|
|
@ -753,7 +706,6 @@ define([
|
|
|
|
|
}
|
|
|
|
|
img[0].src = 'data:image/jpeg;base64,'+ jpeg;
|
|
|
|
|
set_width_height(img, md, 'image/jpeg');
|
|
|
|
|
this._dblclick_to_reset_size(img);
|
|
|
|
|
toinsert.append(img);
|
|
|
|
|
element.append(toinsert);
|
|
|
|
|
return toinsert;
|
|
|
|
|
|