Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #5261, break at the end of a label caused wrong bounding box.
- Loading branch information
1 parent
647c4ae
commit fa85db5
Showing
7 changed files
with
78 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
samples/issues/highcharts-4.2.4/5261-label-trim-lines/demo.details
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
resources: | ||
- https://code.jquery.com/qunit/qunit-1.19.0.js | ||
- https://code.jquery.com/qunit/qunit-1.19.0.css | ||
... |
9 changes: 9 additions & 0 deletions
9
samples/issues/highcharts-4.2.4/5261-label-trim-lines/demo.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<script src="https://code.highcharts.com/highcharts.js"></script> | ||
<script src="https://code.highcharts.com/modules/heatmap.js"></script> | ||
|
||
<div id="qunit"></div> | ||
<div id="qunit-fixture"></div> | ||
|
||
|
||
<div id="container" style="width: 1000px; margin: 0 auto;"></div> | ||
<div id="exported"></div> |
48 changes: 48 additions & 0 deletions
48
samples/issues/highcharts-4.2.4/5261-label-trim-lines/demo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
jQuery(function () { | ||
|
||
QUnit.test('Left trim', function (assert) { | ||
|
||
var ren = new Highcharts.Renderer( | ||
document.getElementById('container'), | ||
500, | ||
300 | ||
); | ||
|
||
var correctLabel = ren.label('Hello World', 100, 25) | ||
.attr({ | ||
'stroke-width': 1, | ||
stroke: 'blue' | ||
}) | ||
.add(); | ||
|
||
|
||
var label = ren.label('<br>Hello World', 100, 50) | ||
.attr({ | ||
'stroke-width': 1, | ||
stroke: 'blue' | ||
}) | ||
.add(); | ||
|
||
// tspan.dy should be the same as the reference | ||
assert.strictEqual( | ||
label.element.querySelector('tspan').getAttribute('dy'), | ||
correctLabel.element.querySelector('tspan').getAttribute('dy'), | ||
'Tspan dy offset' | ||
); | ||
|
||
|
||
label = ren.label('Hello World<br>', 100, 50) | ||
.attr({ | ||
'stroke-width': 1, | ||
stroke: 'blue' | ||
}) | ||
.add(); | ||
|
||
// tspan.dy should be the same as the reference | ||
assert.strictEqual( | ||
label.element.querySelector('tspan').getAttribute('dy'), | ||
correctLabel.element.querySelector('tspan').getAttribute('dy'), | ||
'Tspan dy offset' | ||
); | ||
}); | ||
}); |