-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: remove defXY and cx/cy should not affect transform #1624 (#1627) * fix: remove defXY and cx/cy should not affect transform #1624 * fix: patterns * fix: remove anchor * fix: annotation plugin * chore: commit changeset * fix: x/y in rect can be omitted * chore: commit changeset * chore: version * chore: version * chore: bump version * fix: insert event will trigger by default * chore: commit changeset * fix: lazy update geometry * fix: lazy calculate geometry * chore: bump version * fix: refactor parse transform * fix: transform origin * chore: bump * chore: stash * chore: bump test version * chore: fix testcases * chore: update snapshots * chore: commit changeset * chore: commit changeset (#1646) * chore(release): bump version (#1645) 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
acd120e
commit 86d200b
Showing
399 changed files
with
20,928 additions
and
3,264 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 |
---|---|---|
@@ -1,9 +1,14 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"], | ||
"eslint.validate": [ | ||
"javascript", | ||
"javascriptreact", | ||
"typescript", | ||
"typescriptreact" | ||
], | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
"source.fixAll.eslint": "explicit" | ||
}, | ||
"svg.preview.background": "dark-transparent" | ||
} |
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 was deleted.
Oops, something went wrong.
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,136 @@ | ||
import { Circle, Rect, Path, Group } from '../../../packages/g'; | ||
import { Sector } from '../../../packages/g-components'; | ||
|
||
export async function clipPath(context) { | ||
const { canvas } = context; | ||
await canvas.ready; | ||
|
||
// in user space | ||
const clipPathCircle = new Circle({ | ||
style: { | ||
cx: 150, | ||
cy: 150, | ||
r: 35, | ||
fill: 'blue', | ||
transformOrigin: 'center', | ||
}, | ||
}); | ||
|
||
const rect1 = new Rect({ | ||
style: { | ||
x: 0, | ||
y: 0, | ||
width: 45, | ||
height: 45, | ||
stroke: 'white', | ||
lineWidth: 2, | ||
fill: 'red', | ||
clipPath: clipPathCircle, | ||
cursor: 'pointer', | ||
// transform: 'translate(200px, 200px)', | ||
}, | ||
}); | ||
const rect2 = rect1.cloneNode(); | ||
rect2.style.y = 55; | ||
const rect3 = rect1.cloneNode(); | ||
rect3.style.x = 55; | ||
rect3.style.y = 55; | ||
const rect4 = rect1.cloneNode(); | ||
rect4.style.x = 55; | ||
rect4.style.y = 0; | ||
|
||
const clipPathRect = new Rect({ | ||
style: { | ||
x: 125, | ||
y: 125, | ||
width: 50, | ||
height: 50, | ||
}, | ||
}); | ||
const clipPath = new Path({ | ||
style: { | ||
stroke: 'black', | ||
lineWidth: 2, | ||
d: 'M 10,10 L -10,0 L 10,-10 Z', | ||
}, | ||
}); | ||
|
||
const g = new Group(); | ||
const group = new Group({ | ||
style: { | ||
transform: 'translate(100, 100)', | ||
}, | ||
}); | ||
g.appendChild(clipPathCircle); | ||
group.appendChild(rect1); | ||
group.appendChild(rect2); | ||
group.appendChild(rect3); | ||
group.appendChild(rect4); | ||
g.appendChild(group); | ||
|
||
canvas.appendChild(g); | ||
|
||
// clipPathCircle.animate( | ||
// [{ transform: 'scale(1)' }, { transform: 'scale(2)' }], | ||
// { | ||
// duration: 1500, | ||
// iterations: Infinity, | ||
// }, | ||
// ); | ||
|
||
{ | ||
const sector = new Sector({ | ||
style: { | ||
x: 350, | ||
y: 100, | ||
lineWidth: 1, | ||
sr: 100, | ||
startAngle: -90, | ||
fill: 'yellow', | ||
opacity: 0.5, | ||
endAngle: -270, | ||
}, | ||
}); | ||
const group = new Group({ | ||
style: { | ||
clipPath: sector, | ||
}, | ||
}); | ||
const circle1 = new Circle({ | ||
style: { | ||
fill: 'red', | ||
cx: 300, | ||
cy: 100, | ||
r: 20, | ||
}, | ||
}); | ||
const circle2 = new Circle({ | ||
style: { | ||
fill: 'red', | ||
cx: 350, | ||
cy: 100, | ||
r: 20, | ||
}, | ||
}); | ||
canvas.appendChild(group); | ||
group.appendChild(circle1); | ||
group.appendChild(circle2); | ||
canvas.appendChild(sector); | ||
|
||
// sector.animate( | ||
// [ | ||
// { | ||
// endAngle: -90, | ||
// }, | ||
// { | ||
// endAngle: 270, | ||
// }, | ||
// ], | ||
// { | ||
// duration: 1000, | ||
// iterations: Infinity, | ||
// fill: 'both', | ||
// }, | ||
// ); | ||
} | ||
} |
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,71 @@ | ||
import { Path, Polyline, Line } from '../../../packages/g'; | ||
import { Arrow } from '../../../packages/g-components'; | ||
|
||
export async function customElement(context) { | ||
const { canvas } = context; | ||
await canvas.ready; | ||
|
||
// create an arrow | ||
const lineArrow = new Arrow({ | ||
id: 'lineArrow', | ||
style: { | ||
body: new Line({ | ||
style: { | ||
x1: 200, | ||
y1: 100, | ||
x2: 0, | ||
y2: 0, | ||
}, | ||
}), | ||
startHead: true, | ||
stroke: '#1890FF', | ||
lineWidth: 10, | ||
cursor: 'pointer', | ||
increasedLineWidthForHitTesting: 40, | ||
}, | ||
}); | ||
lineArrow.translate(200, 100); | ||
|
||
const polylineArrow = new Arrow({ | ||
id: 'polylineArrow', | ||
style: { | ||
body: new Polyline({ | ||
style: { | ||
points: [ | ||
[0, 0], | ||
[50, 0], | ||
[50, 50], | ||
[100, 50], | ||
[100, 100], | ||
[150, 100], | ||
], | ||
}, | ||
}), | ||
startHead: true, | ||
stroke: '#1890FF', | ||
lineWidth: 10, | ||
cursor: 'pointer', | ||
}, | ||
}); | ||
polylineArrow.translate(200, 200); | ||
|
||
const pathArrow = new Arrow({ | ||
id: 'pathArrow', | ||
style: { | ||
body: new Path({ | ||
style: { | ||
d: 'M 100,300' + 'l 50,-25' + 'a25,25 -30 0,1 50,-80', | ||
}, | ||
}), | ||
startHead: true, | ||
stroke: '#1890FF', | ||
lineWidth: 10, | ||
cursor: 'pointer', | ||
}, | ||
}); | ||
pathArrow.translate(100, 150); | ||
|
||
canvas.appendChild(lineArrow); | ||
canvas.appendChild(polylineArrow); | ||
canvas.appendChild(pathArrow); | ||
} |
Oops, something went wrong.