##// END OF EJS Templates
dblclick to restore size of images
MinRK -
Show More
@@ -283,9 +283,30 b' var IPython = (function (IPython) {'
283 283 OutputArea.prototype.append_png = function (png, element) {
284 284 var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_png");
285 285 var img = $("<img/>").attr('src','data:image/png;base64,'+png);
286 img.load(function () {
287 $(this).resizable({'aspectRatio': true, 'autoHide': true})
288 });
286 setTimeout(function () {
287 img.resizable({
288 aspectRatio: true,
289 autoHide: true,
290 start: function(evt, ui) {
291 var wrapper = $(evt.target);
292 var original_height = ui.originalSize.height;
293 var original_width = ui.originalSize.width;
294 if (original_height == 0 || original_width == 0) {
295 // protect against weird case of zero size;
296 return;
297 }
298 // only do this once:
299 wrapper.unbind("resizestart");
300 wrapper.dblclick(function () {
301 // resize wrapper & image together for some reason:
302 wrapper.height(original_height);
303 img.height(original_height);
304 wrapper.width(original_width);
305 img.width(original_width);
306 });
307 }
308 });
309 }, 250);
289 310 toinsert.append(img);
290 311 element.append(toinsert);
291 312 };
@@ -294,9 +315,30 b' var IPython = (function (IPython) {'
294 315 OutputArea.prototype.append_jpeg = function (jpeg, element) {
295 316 var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_jpeg");
296 317 var img = $("<img/>").attr('src','data:image/jpeg;base64,'+jpeg);
297 img.load(function () {
298 $(this).resizable({'aspectRatio': true, 'autoHide': true})
299 });
318 setTimeout(function () {
319 img.resizable({
320 aspectRatio: true,
321 autoHide: true,
322 start: function(evt, ui) {
323 var wrapper = $(evt.target);
324 var original_height = ui.originalSize.height;
325 var original_width = ui.originalSize.width;
326 if (original_height == 0 || original_width == 0) {
327 // protect against weird case of zero size;
328 return;
329 }
330 // only do this once:
331 wrapper.unbind("resizestart");
332 wrapper.dblclick(function () {
333 // resize wrapper & image together for some reason:
334 wrapper.height(original_height);
335 img.height(original_height);
336 wrapper.width(original_width);
337 img.width(original_width);
338 });
339 }
340 });
341 }, 250);
300 342 toinsert.append(img);
301 343 element.append(toinsert);
302 344 };
General Comments 0
You need to be logged in to leave comments. Login now