##// END OF EJS Templates
use on-load event to trigger resizable images...
MinRK -
Show More
@@ -564,15 +564,13 b' var IPython = (function (IPython) {'
564
564
565
565
566 OutputArea.prototype._dblclick_to_reset_size = function (img) {
566 OutputArea.prototype._dblclick_to_reset_size = function (img) {
567 // schedule wrapping image in resizable after a delay,
567 // wrap image after it's loaded on the page,
568 // so we don't end up calling resize on a zero-size object
568 // otherwise the measured initial size will be incorrect
569 var that = this;
569 img.on("load", function (){
570 setTimeout(function () {
571 var h0 = img.height();
570 var h0 = img.height();
572 var w0 = img.width();
571 var w0 = img.width();
573 if (!(h0 && w0)) {
572 if (!(h0 && w0)) {
574 // zero size, schedule another timeout
573 // zero size, don't make it resizable
575 that._dblclick_to_reset_size(img);
576 return;
574 return;
577 }
575 }
578 img.resizable({
576 img.resizable({
@@ -586,7 +584,7 b' var IPython = (function (IPython) {'
586 img.parent().width(w0);
584 img.parent().width(w0);
587 img.width(w0);
585 img.width(w0);
588 });
586 });
589 }, 250);
587 });
590 };
588 };
591
589
592 var set_width_height = function (img, md, mime) {
590 var set_width_height = function (img, md, mime) {
General Comments 0
You need to be logged in to leave comments. Login now