Show More
@@ -275,37 +275,8 b' var IPython = (function (IPython) {' | |||
|
275 | 275 | |
|
276 | 276 | OutputArea.prototype.append_svg = function (svg, element) { |
|
277 | 277 | var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_svg"); |
|
278 | // The <svg> tag cannot be made resizable so we wrap it in a resizable <div>. | |
|
279 | // The problem with this is that we need to 1) set the initial size of the | |
|
280 | // <div> based on the size of the <svg> and 2) we need to tie the size of the | |
|
281 | // <div> and the <svg>. | |
|
282 | var img = $('<div/>'); | |
|
283 | img.html(svg); | |
|
284 | toinsert.append(img); | |
|
285 | element.append(toinsert); | |
|
286 | svg = img.find('svg'); | |
|
287 | // The width and height returned here will be a string with units. Any units | |
|
288 | // could be used and there is no way to reliably compute the equivalent pixels. | |
|
289 | // Because of this the calls to width and height below simply pass on the unit | |
|
290 | // information. | |
|
291 | var w = svg.attr('width'); | |
|
292 | var h = svg.attr('height'); | |
|
293 | // Here we remove the attr versions of the width/height and set the css verions | |
|
294 | // that we will be using later in the resize callback. | |
|
295 | svg.removeAttr('height').removeAttr('width'); | |
|
296 | img.width(w).height(h); | |
|
297 | svg.width(w).height(h); | |
|
298 | img.resizable({ | |
|
299 | // We can't pass the minHeight/maxHeight options as they are required to | |
|
300 | // be in pixels and we have no way to determining those numbers. | |
|
301 | 'autoHide': true, | |
|
302 | 'aspectRatio': true, | |
|
303 | 'resize': function () { | |
|
304 | $(this).find('svg').height($(this).height()); | |
|
305 | $(this).find('svg').width($(this).width()); | |
|
306 | } | |
|
307 | }); | |
|
308 | ||
|
278 | toinsert.append(svg); | |
|
279 | element.append(toinsert); | |
|
309 | 280 | }; |
|
310 | 281 | |
|
311 | 282 |
General Comments 0
You need to be logged in to leave comments.
Login now