Skip to content

Commit 80ed08e

Browse files
committed
Backport PR #8098: Remove image resizer
This PR removes the image resizer for images. Removing the resizer helps a lot to solve the image overflow issue in #7701. Related PR: #8062. Before: ![screenshot from 2015-03-20 10 48 02](https://cloud.githubusercontent.com/assets/599274/6756414/624077fa-ceef-11e4-8df2-53d0bdf7338e.png) ...
1 parent 780dbad commit 80ed08e

1 file changed

Lines changed: 0 additions & 48 deletions

File tree

‎IPython/html/static/notebook/js/outputarea.js‎

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -661,59 +661,13 @@ define([
661661
.width(width)
662662
.height(height);
663663

664-
// The jQuery resize handlers don't seem to work on the svg element.
665-
// When the svg renders completely, measure it's size and set the parent
666-
// div to that size. Then set the svg to 100% the size of the parent
667-
// div and make the parent div resizable.
668-
this._dblclick_to_reset_size(svg_area, true, false);
669-
670664
svg_area.append(svg);
671665
toinsert.append(svg_area);
672666
element.append(toinsert);
673667

674668
return toinsert;
675669
};
676670

677-
OutputArea.prototype._dblclick_to_reset_size = function (img, immediately, resize_parent) {
678-
/**
679-
* Add a resize handler to an element
680-
*
681-
* img: jQuery element
682-
* immediately: bool=False
683-
* Wait for the element to load before creating the handle.
684-
* resize_parent: bool=True
685-
* Should the parent of the element be resized when the element is
686-
* reset (by double click).
687-
*/
688-
var callback = function (){
689-
var h0 = img.height();
690-
var w0 = img.width();
691-
if (!(h0 && w0)) {
692-
// zero size, don't make it resizable
693-
return;
694-
}
695-
img.resizable({
696-
aspectRatio: true,
697-
autoHide: true
698-
});
699-
img.dblclick(function () {
700-
// resize wrapper & image together for some reason:
701-
img.height(h0);
702-
img.width(w0);
703-
if (resize_parent === undefined || resize_parent) {
704-
img.parent().height(h0);
705-
img.parent().width(w0);
706-
}
707-
});
708-
};
709-
710-
if (immediately) {
711-
callback();
712-
} else {
713-
img.on("load", callback);
714-
}
715-
};
716-
717671
var set_width_height = function (img, md, mime) {
718672
/**
719673
* set width and height of an img element from metadata
@@ -735,7 +689,6 @@ define([
735689
}
736690
img[0].src = 'data:image/png;base64,'+ png;
737691
set_width_height(img, md, 'image/png');
738-
this._dblclick_to_reset_size(img);
739692
toinsert.append(img);
740693
element.append(toinsert);
741694
return toinsert;
@@ -753,7 +706,6 @@ define([
753706
}
754707
img[0].src = 'data:image/jpeg;base64,'+ jpeg;
755708
set_width_height(img, md, 'image/jpeg');
756-
this._dblclick_to_reset_size(img);
757709
toinsert.append(img);
758710
element.append(toinsert);
759711
return toinsert;

0 commit comments

Comments
 (0)