From 80ed08e405e9d14e9b272b6002804ef66711c90b 2015-03-30 20:36:41 From: Min RK Date: 2015-03-30 20:36:41 Subject: [PATCH] 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) ... --- diff --git a/IPython/html/static/notebook/js/outputarea.js b/IPython/html/static/notebook/js/outputarea.js index 197e3b0..1a1bd9e 100644 --- a/IPython/html/static/notebook/js/outputarea.js +++ b/IPython/html/static/notebook/js/outputarea.js @@ -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;