Show More
@@ -283,9 +283,30 b' var IPython = (function (IPython) {' | |||||
283 | OutputArea.prototype.append_png = function (png, element) { |
|
283 | OutputArea.prototype.append_png = function (png, element) { | |
284 | var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_png"); |
|
284 | var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_png"); | |
285 | var img = $("<img/>").attr('src','data:image/png;base64,'+png); |
|
285 | var img = $("<img/>").attr('src','data:image/png;base64,'+png); | |
286 |
|
|
286 | setTimeout(function () { | |
287 | $(this).resizable({'aspectRatio': true, 'autoHide': true}) |
|
287 | img.resizable({ | |
288 | }); |
|
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 | toinsert.append(img); |
|
310 | toinsert.append(img); | |
290 | element.append(toinsert); |
|
311 | element.append(toinsert); | |
291 | }; |
|
312 | }; | |
@@ -294,9 +315,30 b' var IPython = (function (IPython) {' | |||||
294 | OutputArea.prototype.append_jpeg = function (jpeg, element) { |
|
315 | OutputArea.prototype.append_jpeg = function (jpeg, element) { | |
295 | var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_jpeg"); |
|
316 | var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_jpeg"); | |
296 | var img = $("<img/>").attr('src','data:image/jpeg;base64,'+jpeg); |
|
317 | var img = $("<img/>").attr('src','data:image/jpeg;base64,'+jpeg); | |
297 |
|
|
318 | setTimeout(function () { | |
298 | $(this).resizable({'aspectRatio': true, 'autoHide': true}) |
|
319 | img.resizable({ | |
299 | }); |
|
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 | toinsert.append(img); |
|
342 | toinsert.append(img); | |
301 | element.append(toinsert); |
|
343 | element.append(toinsert); | |
302 | }; |
|
344 | }; |
General Comments 0
You need to be logged in to leave comments.
Login now