-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: setup native html map per canvas instead of global singleton #1610 * chore: commit changeset
- Loading branch information
Showing
8 changed files
with
102 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@antv/g-plugin-html-renderer': patch | ||
'@antv/g-lite': patch | ||
--- | ||
|
||
Setup native html map per canvas instead of global singleton. |
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,53 @@ | ||
import { Canvas, Circle, HTML } from '../../../packages/g'; | ||
import { Renderer as CanvasRenderer } from '../../../packages/g-canvas'; | ||
|
||
export async function html(context) { | ||
const { canvas, container } = context; | ||
await canvas.ready; | ||
canvas.resize(320, 320); | ||
|
||
const $div2 = document.createElement('div'); | ||
$div2.id = 'div2'; | ||
container.appendChild($div2); | ||
const canvasRenderer2 = new CanvasRenderer(); | ||
const canvas2 = new Canvas({ | ||
container: $div2, | ||
width: 320, | ||
height: 320, | ||
renderer: canvasRenderer2, | ||
}); | ||
|
||
const circle1 = new Circle({ | ||
style: { | ||
cx: 100, | ||
cy: 100, | ||
r: 50, | ||
fill: 'red', | ||
cursor: 'pointer', | ||
}, | ||
}); | ||
canvas.appendChild(circle1); | ||
const circle2 = new Circle({ | ||
style: { | ||
cx: 100, | ||
cy: 100, | ||
r: 50, | ||
fill: 'green', | ||
cursor: 'pointer', | ||
}, | ||
}); | ||
canvas2.appendChild(circle2); | ||
|
||
const html = new HTML({ | ||
id: 'html1', | ||
style: { | ||
x: 200, | ||
y: 100, | ||
width: 100, | ||
height: 100, | ||
innerHTML: 'canvas1', | ||
// pointerEvents: 'none', | ||
}, | ||
}); | ||
canvas.appendChild(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 @@ | ||
export { html } from './1610'; |
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