-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: `sourcemap.sources` path wrong (#1766) * fix: webgl renderer has logical exception when updating attributes (#1768) (#1769) * feat: added support for picking rotated text (#1749) (#1772) * chore: updated benchmark screenshots (#1773) * chore: updated benchmark screenshots * fix: sourcemap generation exception * chore: update test ci node version * chore: update screenshots and ci config * chore: delete redundant benchmark images * Version Packages (#1770) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
910c58e
commit 1443fed
Showing
60 changed files
with
6,148 additions
and
4,577 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2 Bytes
(100%)
__tests__/integration/snapshots/2d/canvas/customElement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,105 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width,user-scalable=no,initial-scale=1,shrink-to-fit=no" | ||
/> | ||
<title>issue-1749</title> | ||
<style> | ||
* { | ||
box-sizing: border-box; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
body { | ||
height: 100vh; | ||
padding: 100px; | ||
} | ||
|
||
#container { | ||
/* border: 1px solid #ddd; */ | ||
background-color: #ddd; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div id="container"></div> | ||
<script | ||
src="../../packages/g/dist/index.umd.min.js" | ||
type="application/javascript" | ||
></script> | ||
<script | ||
src="../../packages/g-canvas/dist/index.umd.min.js" | ||
type="application/javascript" | ||
></script> | ||
<script> | ||
const { Canvas, CanvasEvent, Rect, Text, Path, Canvas2D } = window.G; | ||
|
||
const canvasRenderer = new Canvas2D.Renderer(); | ||
|
||
const canvas = new Canvas({ | ||
container: 'container', | ||
width: 600, | ||
height: 500, | ||
renderer: canvasRenderer, | ||
}); | ||
|
||
const test = (shape, property) => { | ||
shape.addEventListener('pointerenter', () => { | ||
shape.style[property] = 'red'; | ||
}); | ||
shape.addEventListener('pointerleave', () => { | ||
shape.style[property] = 'black'; | ||
}); | ||
}; | ||
|
||
const text = new Text({ | ||
style: { | ||
text: 'test123213', | ||
fontSize: 20, | ||
x: 300, | ||
y: 100, | ||
anchor: '0.5 0.5', | ||
transform: 'rotate(45)', | ||
}, | ||
}); | ||
|
||
const path = new Path({ | ||
style: { | ||
d: 'M 100,100 L 150,100 L 150,150 Z', | ||
fill: 'black', | ||
transform: 'rotate(45)', | ||
}, | ||
}); | ||
|
||
test(text, 'fill'); | ||
test(path, 'fill'); | ||
|
||
canvas.addEventListener(CanvasEvent.READY, () => { | ||
canvas.appendChild(text); | ||
canvas.appendChild(path); | ||
|
||
const { x, y, width, height } = text.getBBox(); | ||
const rect = new Rect({ | ||
style: { | ||
x, | ||
y, | ||
width, | ||
height, | ||
stroke: 'black', | ||
// transform: 'rotate(45)', | ||
}, | ||
}); | ||
test(rect, 'stroke'); | ||
|
||
canvas.appendChild(rect); | ||
}); | ||
</script> | ||
</body> | ||
</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
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
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
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
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,21 @@ | ||
import type { DisplayObject, Point, TextStyleProps } from '@antv/g-lite'; | ||
|
||
export function isPointInPath( | ||
displayObject: DisplayObject<TextStyleProps>, | ||
position: Point, | ||
isClipPath: boolean, | ||
isPointInPath: ( | ||
displayObject: DisplayObject<TextStyleProps>, | ||
position: Point, | ||
) => boolean, | ||
): boolean { | ||
const bounds = displayObject.getGeometryBounds(); | ||
|
||
// @see https://stackoverflow.com/questions/28706989/how-do-i-check-if-a-mouse-click-is-inside-a-rotated-text-on-the-html5-canvas-in | ||
return ( | ||
position.x >= bounds.min[0] && | ||
position.y >= bounds.min[1] && | ||
position.x <= bounds.max[0] && | ||
position.y <= bounds.max[1] | ||
); | ||
} |
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
Oops, something went wrong.