|
1347 | 1347 |
|
1348 | 1348 | elem = this.svg_pad().select(".special_layer").select("." + size.clname); |
1349 | 1349 | if (elem.empty()) |
1350 | | - elem = this.svg_pad().select(".special_layer").append("foreignObject"); |
| 1350 | + elem = this.svg_pad().select(".special_layer") |
| 1351 | + .append("foreignObject").attr("class", size.clname); |
1351 | 1352 |
|
1352 | | - elem.attr('width', size.width) |
| 1353 | + elem.attr('x', size.x) |
| 1354 | + .attr('y', size.y) |
| 1355 | + .attr('width', size.width) |
1353 | 1356 | .attr('height', size.height) |
1354 | 1357 | .attr('viewBox', "0 0 " + size.width + " " + size.height) |
1355 | 1358 | .attr('preserveAspectRatio','xMidYMid'); |
1356 | 1359 |
|
1357 | | - this.SetForeignObjectPosition(elem, size); |
1358 | | - |
1359 | 1360 | } else { |
1360 | 1361 | // force redraw by resize |
1361 | 1362 | this.svg_canvas().property('redraw_by_resize', true); |
1362 | 1363 |
|
1363 | 1364 | elem = d3.select(this.svg_canvas().node().parentNode).select("." + size.clname); |
1364 | | - if (elem.empty()) |
1365 | | - elem = d3.select(this.svg_canvas().node().parentNode).append('div'); |
| 1365 | + if (elem.empty()) { |
| 1366 | + elem = d3.select(this.svg_canvas().node().parentNode) |
| 1367 | + .append('div').attr("class", size.clname); |
| 1368 | + } |
1366 | 1369 |
|
1367 | 1370 | elem.style('position','absolute') |
1368 | 1371 | .style('left', size.x + 'px') |
|
1461 | 1464 | return pos; |
1462 | 1465 | } |
1463 | 1466 |
|
1464 | | - JSROOT.TObjectPainter.prototype.SetForeignObjectPosition = function(fo, pos) { |
1465 | | - // method used to set absolute coordinates for foreignObject |
1466 | | - // it is known problem of WebKit http://bit.ly/1wjqCQ9 |
1467 | | - |
1468 | | - if (!pos) pos = { x: 0, y: 0 }; |
1469 | | - |
1470 | | - if (JSROOT.browser.isWebKit) { |
1471 | | - // force canvas redraw when foreign object used - it is not correctly scaled |
1472 | | - this.svg_canvas().property('redraw_by_resize', true); |
1473 | | - pos = this.CalcAbsolutePosition(fo, pos); |
1474 | | - } |
1475 | | - |
1476 | | - fo.attr("x",pos.x).attr("y",pos.y); |
1477 | | - } |
1478 | | - |
1479 | 1467 |
|
1480 | 1468 | JSROOT.TObjectPainter.prototype.createAttFill = function(attfill, pattern, color) { |
1481 | 1469 |
|
|
2302 | 2290 | // simple way to access painter via frame container |
2303 | 2291 | this.draw_g.property('frame_painter', this); |
2304 | 2292 |
|
| 2293 | + console.log('frame ' + lm + "," + tm + " " + w + "," + h); |
| 2294 | + |
2305 | 2295 | this.draw_g.attr("x", lm) |
2306 | 2296 | .attr("y", tm) |
2307 | 2297 | .attr("width", w) |
|
3090 | 3080 | .property('pad_painter', this) // this is custom property |
3091 | 3081 | .property('mainpainter', null) // this is custom property |
3092 | 3082 | .property('current_pad', "") // this is custom property |
| 3083 | + .property('redraw_by_resize', false); // could be enabled to force redraw by each resize |
3093 | 3084 |
|
3094 | 3085 | svg.append("svg:title").text("ROOT canvas"); |
3095 | 3086 | svg.append("svg:g").attr("class","root_frame"); |
|
3115 | 3106 | .property('draw_x', 0) |
3116 | 3107 | .property('draw_y', 0) |
3117 | 3108 | .property('draw_width', w) |
3118 | | - .property('draw_height', h) |
3119 | | - .property('redraw_by_resize', false); |
| 3109 | + .property('draw_height', h); |
3120 | 3110 |
|
3121 | 3111 | return true; |
3122 | 3112 | } |
|
0 commit comments