-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(g-base): should consider precision of angle calculation for Path, c…
…lose antvis#436
- Loading branch information
1 parent
076bc14
commit 6fda5bf
Showing
2 changed files
with
43 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const expect = require('chai').expect; | ||
import Canvas from '../../src/canvas'; | ||
|
||
const dom = document.createElement('div'); | ||
document.body.appendChild(dom); | ||
dom.id = 'c1'; | ||
|
||
describe('#436', () => { | ||
const canvas = new Canvas({ | ||
container: dom, | ||
width: 1000, | ||
height: 400, | ||
}); | ||
|
||
it('should consider precision of angle calculation for Path', () => { | ||
const path = canvas.addShape('path', { | ||
attrs: { | ||
stroke: 'red', | ||
lineWidth: 2, | ||
path: [ | ||
['M', 54.88829007174579, 78.53153216848064], | ||
['L', 729.5, 78.53153216848064], | ||
['L', 729.5, 121.46846783151936], | ||
['L', 869.5, 121.46846783151936], | ||
['L', 175.11170992825421, 121.46846783151936], | ||
], | ||
endArrow: true, | ||
}, | ||
}); | ||
|
||
const bbox = path.getBBox(); | ||
expect(bbox.minX).eqls(53.88829007174579); | ||
expect(bbox.minY).eqls(77.53153216848064); | ||
expect(bbox.maxX).eqls(870.5); | ||
expect(bbox.maxY).eqls(122.46846783151936); | ||
}); | ||
}); |