Commit a93fa4d3 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Use position = fixed instead of height = 1 when getBoundingClientRect - #1005 #1026

parent 265650b8
...@@ -3248,8 +3248,8 @@ ...@@ -3248,8 +3248,8 @@
}; };
c3_chart_internal_fn.getTextRect = function (text, cls) { c3_chart_internal_fn.getTextRect = function (text, cls) {
var body = this.d3.select('body').classed('c3', true), var body = this.d3.select('body').classed('c3', true),
// height = 1 is needed to get rect on Firefox - #1026 svg = body.append("svg").style('visibility', 'hidden').style('position', 'fixed').style('top', 0).style('left', 0),
svg = body.append("svg").style('visibility', 'hidden').style('height', 1), rect; rect;
svg.selectAll('.dummy') svg.selectAll('.dummy')
.data([text]) .data([text])
.enter().append('text') .enter().append('text')
...@@ -4370,8 +4370,7 @@ ...@@ -4370,8 +4370,7 @@
$$.updateXAxisTickValues(targetsToShow, axis); $$.updateXAxisTickValues(targetsToShow, axis);
} }
body = this.d3.select('body').classed('c3', true); body = this.d3.select('body').classed('c3', true);
// height = 1 is needed to get rect on Firefox - #1026 svg = body.append("svg").style('visibility', 'hidden').style('position', 'fixed').style('top', 0).style('left', 0),
svg = body.append('svg').style('visibility', 'hidden').style('height', 1);
svg.append('g').call(axis).each(function () { svg.append('g').call(axis).each(function () {
$$.d3.select(this).selectAll('text tspan').each(function () { $$.d3.select(this).selectAll('text tspan').each(function () {
var box = this.getBoundingClientRect(); var box = this.getBoundingClientRect();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -290,8 +290,7 @@ c3_chart_internal_fn.getMaxTickWidth = function (id, withoutRecompute) { ...@@ -290,8 +290,7 @@ c3_chart_internal_fn.getMaxTickWidth = function (id, withoutRecompute) {
$$.updateXAxisTickValues(targetsToShow, axis); $$.updateXAxisTickValues(targetsToShow, axis);
} }
body = this.d3.select('body').classed('c3', true); body = this.d3.select('body').classed('c3', true);
// height = 1 is needed to get rect on Firefox - #1026 svg = body.append("svg").style('visibility', 'hidden').style('position', 'fixed').style('top', 0).style('left', 0),
svg = body.append('svg').style('visibility', 'hidden').style('height', 1);
svg.append('g').call(axis).each(function () { svg.append('g').call(axis).each(function () {
$$.d3.select(this).selectAll('text tspan').each(function () { $$.d3.select(this).selectAll('text tspan').each(function () {
var box = this.getBoundingClientRect(); var box = this.getBoundingClientRect();
......
...@@ -49,8 +49,8 @@ c3_chart_internal_fn.redrawText = function (xForText, yForText, forFlow, withTra ...@@ -49,8 +49,8 @@ c3_chart_internal_fn.redrawText = function (xForText, yForText, forFlow, withTra
}; };
c3_chart_internal_fn.getTextRect = function (text, cls) { c3_chart_internal_fn.getTextRect = function (text, cls) {
var body = this.d3.select('body').classed('c3', true), var body = this.d3.select('body').classed('c3', true),
// height = 1 is needed to get rect on Firefox - #1026 svg = body.append("svg").style('visibility', 'hidden').style('position', 'fixed').style('top', 0).style('left', 0),
svg = body.append("svg").style('visibility', 'hidden').style('height', 1), rect; rect;
svg.selectAll('.dummy') svg.selectAll('.dummy')
.data([text]) .data([text])
.enter().append('text') .enter().append('text')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment