-
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: rendering circle in webgpu (#1596) * fix: rendering circle in webgpu * chore: commit changeset * chore: update lockfile (#1597) * chore(release): bump version (#1598) 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
8d854c7
commit 97d9d73
Showing
74 changed files
with
19,999 additions
and
1,109 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
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,19 @@ | ||
import { Image } from '../../../packages/g'; | ||
|
||
export async function imageNonTransparentPixel(context) { | ||
const { canvas } = context; | ||
await canvas.ready; | ||
|
||
const image1 = new Image({ | ||
style: { | ||
x: 200, | ||
y: 100, | ||
width: 200, | ||
height: 200, | ||
img: 'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*N4ZMS7gHsUIAAAAAAAAAAABkARQnAQ', | ||
pointerEvents: 'non-transparent-pixel', | ||
cursor: 'pointer', | ||
}, | ||
}); | ||
canvas.appendChild(image1); | ||
} |
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,17 @@ | ||
import { Image } from '../../../packages/g'; | ||
|
||
export async function image(context) { | ||
const { canvas } = context; | ||
await canvas.ready; | ||
|
||
const image1 = new Image({ | ||
style: { | ||
x: 200, | ||
y: 100, | ||
width: 200, | ||
height: 200, | ||
img: 'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*N4ZMS7gHsUIAAAAAAAAAAABkARQnAQ', | ||
}, | ||
}); | ||
canvas.appendChild(image1); | ||
} |
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 |
---|---|---|
@@ -1,2 +1,7 @@ | ||
export { circle } from './circle'; | ||
export { ellipse } from './ellipse'; | ||
export { rect } from './rect'; | ||
export { image } from './image'; | ||
export { imageNonTransparentPixel } from './image-non-transparent-pixel'; | ||
export { line } from './line'; | ||
export { polyline } from './polyline'; |
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,18 @@ | ||
import { Line } from '../../../packages/g'; | ||
|
||
export async function line(context) { | ||
const { canvas } = context; | ||
await canvas.ready; | ||
|
||
const line = new Line({ | ||
style: { | ||
x1: 10, | ||
y1: 10, | ||
x2: 10, | ||
y2: 30, | ||
stroke: 'red', | ||
lineWidth: 6, | ||
}, | ||
}); | ||
canvas.appendChild(line); | ||
} |
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,19 @@ | ||
import { Polyline } from '../../../packages/g'; | ||
|
||
export async function polyline(context) { | ||
const { canvas } = context; | ||
await canvas.ready; | ||
|
||
const polyline = new Polyline({ | ||
style: { | ||
points: [ | ||
[10, 10], | ||
[10, 30], | ||
[30, 30], | ||
], | ||
stroke: 'red', | ||
lineWidth: 6, | ||
}, | ||
}); | ||
canvas.appendChild(polyline); | ||
} |
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,81 @@ | ||
import { Rect } from '../../../packages/g'; | ||
|
||
export async function rect(context) { | ||
const { canvas } = context; | ||
await canvas.ready; | ||
|
||
const rect1 = new Rect({ | ||
style: { | ||
x: 10, | ||
y: 10, | ||
width: 20, | ||
height: 20, | ||
fill: 'red', | ||
}, | ||
}); | ||
canvas.appendChild(rect1); | ||
|
||
const rect2 = rect1.cloneNode(); | ||
rect2.style.stroke = 'green'; | ||
rect2.style.lineWidth = '2px'; | ||
rect2.translate(30, 0); | ||
canvas.appendChild(rect2); | ||
|
||
const rect3 = rect2.cloneNode(); | ||
rect3.style.fill = 'transparent'; | ||
rect3.translate(30, 0); | ||
canvas.appendChild(rect3); | ||
|
||
// // none fill | ||
// const rect4 = rect2.cloneNode(); | ||
// rect4.style.fill = 'none'; | ||
// rect4.translate(60, 0); | ||
// canvas.appendChild(rect4); | ||
|
||
// // dashed | ||
// const rect5 = rect2.cloneNode(); | ||
// rect5.style.lineDash = [2, 2]; | ||
// rect5.translate(90, 0); | ||
// canvas.appendChild(rect5); | ||
|
||
// const rect6 = rect2.cloneNode(); | ||
// rect6.style.opacity = 0.5; | ||
// rect6.translate(120, 0); | ||
// canvas.appendChild(rect6); | ||
|
||
// // with shadow | ||
// const rect7 = rect2.cloneNode(); | ||
// rect7.style.shadowBlur = 10; | ||
// rect7.style.shadowColor = 'blue'; | ||
// rect7.setPosition(10, 60); | ||
// canvas.appendChild(rect7); | ||
|
||
// // with gradient | ||
// const rect8 = rect2.cloneNode(); | ||
// rect8.style.fill = 'l(0) 0:#ffffff 0.5:#7ec2f3 1:#1890ff'; | ||
// rect8.setPosition(40, 60); | ||
// canvas.appendChild(rect8); | ||
// const rect9 = rect2.cloneNode(); | ||
// rect9.style.fill = 'r(0.5, 0.5, 1) 0:#ffffff 1:#1890ff'; | ||
// rect9.setPosition(70, 60); | ||
// canvas.appendChild(rect9); | ||
|
||
// // rounded rect | ||
// const rect10 = rect2.cloneNode(); | ||
// rect10.style.radius = 5; | ||
// rect10.setPosition(100, 60); | ||
// canvas.appendChild(rect10); | ||
|
||
// // rotated rect | ||
// const rect11 = rect2.cloneNode(); | ||
// rect11.setPosition(150, 60); | ||
// rect11.rotateLocal(45); | ||
// canvas.appendChild(rect11); | ||
|
||
// // with transform-origin | ||
// const rect12 = rect2.cloneNode(); | ||
// rect12.style.transformOrigin = 'center'; | ||
// rect12.setPosition(150, 60); | ||
// rect12.rotateLocal(45); | ||
// canvas.appendChild(rect12); | ||
} |
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.