-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: PathString GPI * fix: add rotation support back in * chore: add comment details
- Loading branch information
1 parent
f90ee5c
commit 2e9069d
Showing
16 changed files
with
255 additions
and
25 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 |
---|---|---|
|
@@ -16,4 +16,6 @@ type Image | |
|
||
-- -- | ||
type Arrow | ||
type Square | ||
type Square | ||
|
||
type PathString |
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
58 changes: 58 additions & 0 deletions
58
packages/browser-ui/src/inspector/views/mod/shapedefs/pathStr.json
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,58 @@ | ||
{ | ||
"shapeType": "PathString", | ||
"properties": { | ||
"center": { | ||
"inputType": "ptrange", | ||
"minX": "CANVASL", | ||
"maxX": "CANVASR", | ||
"minY": "CANVASB", | ||
"maxY": "CANVAST", | ||
"showValue": "true" | ||
}, | ||
"color": { | ||
"inputType": "color", | ||
"showValue": "true" | ||
}, | ||
"w": { | ||
"inputType": "range", | ||
"min": "0", | ||
"max": "350", | ||
"showValue": "true" | ||
}, | ||
"rotation": { | ||
"inputType": "range", | ||
"min": "0", | ||
"max": "360", | ||
"showValue": "true" | ||
}, | ||
"h": { | ||
"inputType": "range", | ||
"min": "0", | ||
"max": "350", | ||
"showValue": "true" | ||
}, | ||
"strokeWidth": { | ||
"inputType": "range", | ||
"min": "0", | ||
"max": "20", | ||
"showValue": "true" | ||
}, | ||
"strokeColor": { | ||
"inputType": "color", | ||
"showValue": "true" | ||
}, | ||
"strokeStyle": { | ||
"inputType": "select", | ||
"options": ["solid", "dashed"], | ||
"showValue": "false" | ||
}, | ||
"data": { | ||
"inputType": "text", | ||
"showValue": "true" | ||
}, | ||
"viewBox": { | ||
"inputType": "text", | ||
"showValue": "true" | ||
} | ||
} | ||
} |
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,42 @@ | ||
import { IStrV } from "types/value"; | ||
import { | ||
attrStroke, | ||
attrTitle, | ||
attrFill, | ||
attrPathData, | ||
attrWH, | ||
attrXY, | ||
attrRotation, | ||
} from "./AttrHelper"; | ||
import { ShapeProps } from "./Renderer"; | ||
|
||
const PathString = ({ shape, canvasSize }: ShapeProps): SVGGElement => { | ||
const g = document.createElementNS("http://www.w3.org/2000/svg", "g"); | ||
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); | ||
const elem = document.createElementNS("http://www.w3.org/2000/svg", "path"); | ||
|
||
attrRotation( | ||
shape, | ||
shape.properties.center, | ||
shape.properties.w, | ||
shape.properties.h, | ||
canvasSize, | ||
g | ||
); | ||
|
||
attrFill(shape, elem); | ||
attrStroke(shape, elem); | ||
attrTitle(shape, elem); | ||
attrPathData(shape, elem); | ||
|
||
attrWH(shape, svg); | ||
attrXY(shape, canvasSize, svg); | ||
|
||
const viewBox = shape.properties.viewBox as IStrV<string>; | ||
svg.setAttribute("viewBox", viewBox.contents); | ||
|
||
svg.appendChild(elem); | ||
g.appendChild(svg); | ||
return g; | ||
}; | ||
export default PathString; |
Oops, something went wrong.