feat: renderer tweaks (#6698)

This commit is contained in:
David Luzar 2023-10-20 17:45:37 +02:00 committed by GitHub
parent d2a508104e
commit afea0df141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 1075 additions and 1127 deletions

View File

@ -296,6 +296,12 @@ export const ROUNDNESS = {
* collaboration */ * collaboration */
export const PRECEDING_ELEMENT_KEY = "__precedingElement__"; export const PRECEDING_ELEMENT_KEY = "__precedingElement__";
export const ROUGHNESS = {
architect: 0,
artist: 1,
cartoonist: 2,
} as const;
export const DEFAULT_ELEMENT_PROPS: { export const DEFAULT_ELEMENT_PROPS: {
strokeColor: ExcalidrawElement["strokeColor"]; strokeColor: ExcalidrawElement["strokeColor"];
backgroundColor: ExcalidrawElement["backgroundColor"]; backgroundColor: ExcalidrawElement["backgroundColor"];
@ -308,10 +314,10 @@ export const DEFAULT_ELEMENT_PROPS: {
} = { } = {
strokeColor: COLOR_PALETTE.black, strokeColor: COLOR_PALETTE.black,
backgroundColor: COLOR_PALETTE.transparent, backgroundColor: COLOR_PALETTE.transparent,
fillStyle: "hachure", fillStyle: "solid",
strokeWidth: 1, strokeWidth: 2,
strokeStyle: "solid", strokeStyle: "solid",
roughness: 1, roughness: ROUGHNESS.artist,
opacity: 100, opacity: 100,
locked: false, locked: false,
}; };

View File

@ -14,7 +14,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"type": "arrow", "type": "arrow",
}, },
], ],
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 300, "height": 300,
@ -28,7 +28,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#66a80f", "strokeColor": "#66a80f",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "ellipse", "type": "ellipse",
"updated": 1, "updated": 1,
"version": 3, "version": 3,
@ -49,7 +49,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"type": "arrow", "type": "arrow",
}, },
], ],
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 100, "height": 100,
@ -63,7 +63,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#9c36b5", "strokeColor": "#9c36b5",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "diamond", "type": "diamond",
"updated": 1, "updated": 1,
"version": 2, "version": 2,
@ -85,7 +85,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"focus": -0.008153707962747813, "focus": -0.008153707962747813,
"gap": 1, "gap": 1,
}, },
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 35, "height": 35,
@ -116,7 +116,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
}, },
"strokeColor": "#1864ab", "strokeColor": "#1864ab",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 3, "version": 3,
@ -138,7 +138,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"focus": 0.10666666666666667, "focus": 0.10666666666666667,
"gap": 3.834326468444573, "gap": 3.834326468444573,
}, },
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 0, "height": 0,
@ -169,7 +169,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
}, },
"strokeColor": "#e67700", "strokeColor": "#e67700",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 3, "version": 3,
@ -190,7 +190,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"type": "arrow", "type": "arrow",
}, },
], ],
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 300, "height": 300,
@ -204,7 +204,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 2, "version": 2,
@ -227,7 +227,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
}, },
], ],
"containerId": null, "containerId": null,
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -245,7 +245,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#c2255c", "strokeColor": "#c2255c",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "HEYYYYY", "text": "HEYYYYY",
"textAlign": "left", "textAlign": "left",
"type": "text", "type": "text",
@ -271,7 +271,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
}, },
], ],
"containerId": null, "containerId": null,
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -289,7 +289,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "Whats up ?", "text": "Whats up ?",
"textAlign": "left", "textAlign": "left",
"type": "text", "type": "text",
@ -319,7 +319,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"focus": 0, "focus": 0,
"gap": 5, "gap": 5,
}, },
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 0, "height": 0,
@ -350,7 +350,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
}, },
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 3, "version": 3,
@ -368,7 +368,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": "id43", "containerId": "id43",
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -386,7 +386,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "HELLO WORLD!!", "text": "HELLO WORLD!!",
"textAlign": "center", "textAlign": "center",
"type": "text", "type": "text",
@ -416,7 +416,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to shapes whe
"focus": 0, "focus": 0,
"gap": 1, "gap": 1,
}, },
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 0, "height": 0,
@ -447,7 +447,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to shapes whe
}, },
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 3, "version": 3,
@ -465,7 +465,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to shapes whe
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": "id32", "containerId": "id32",
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -483,7 +483,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to shapes whe
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "HELLO WORLD!!", "text": "HELLO WORLD!!",
"textAlign": "center", "textAlign": "center",
"type": "text", "type": "text",
@ -507,7 +507,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to shapes whe
"type": "arrow", "type": "arrow",
}, },
], ],
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 100, "height": 100,
@ -521,7 +521,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to shapes whe
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 2, "version": 2,
@ -542,7 +542,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to shapes whe
"type": "arrow", "type": "arrow",
}, },
], ],
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 100, "height": 100,
@ -556,7 +556,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to shapes whe
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "ellipse", "type": "ellipse",
"updated": 1, "updated": 1,
"version": 2, "version": 2,
@ -583,7 +583,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to text when
"focus": 0, "focus": 0,
"gap": 1, "gap": 1,
}, },
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 0, "height": 0,
@ -614,7 +614,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to text when
}, },
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 3, "version": 3,
@ -632,7 +632,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to text when
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": "id36", "containerId": "id36",
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -650,7 +650,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to text when
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "HELLO WORLD!!", "text": "HELLO WORLD!!",
"textAlign": "center", "textAlign": "center",
"type": "text", "type": "text",
@ -676,7 +676,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to text when
}, },
], ],
"containerId": null, "containerId": null,
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -694,7 +694,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to text when
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "HEYYYYY", "text": "HEYYYYY",
"textAlign": "left", "textAlign": "left",
"type": "text", "type": "text",
@ -720,7 +720,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to text when
}, },
], ],
"containerId": null, "containerId": null,
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -738,7 +738,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to text when
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "WHATS UP ?", "text": "WHATS UP ?",
"textAlign": "left", "textAlign": "left",
"type": "text", "type": "text",
@ -757,7 +757,7 @@ exports[`Test Transform > should not allow duplicate ids 1`] = `
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": null, "boundElements": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 200, "height": 200,
@ -771,7 +771,7 @@ exports[`Test Transform > should not allow duplicate ids 1`] = `
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 1, "version": 1,
@ -789,7 +789,7 @@ exports[`Test Transform > should transform linear elements 1`] = `
"boundElements": null, "boundElements": null,
"endArrowhead": "arrow", "endArrowhead": "arrow",
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 0, "height": 0,
@ -816,7 +816,7 @@ exports[`Test Transform > should transform linear elements 1`] = `
"startBinding": null, "startBinding": null,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 1, "version": 1,
@ -834,7 +834,7 @@ exports[`Test Transform > should transform linear elements 2`] = `
"boundElements": null, "boundElements": null,
"endArrowhead": "triangle", "endArrowhead": "triangle",
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 0, "height": 0,
@ -879,7 +879,7 @@ exports[`Test Transform > should transform linear elements 3`] = `
"boundElements": null, "boundElements": null,
"endArrowhead": null, "endArrowhead": null,
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 0, "height": 0,
@ -906,7 +906,7 @@ exports[`Test Transform > should transform linear elements 3`] = `
"startBinding": null, "startBinding": null,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "line", "type": "line",
"updated": 1, "updated": 1,
"version": 1, "version": 1,
@ -924,7 +924,7 @@ exports[`Test Transform > should transform linear elements 4`] = `
"boundElements": null, "boundElements": null,
"endArrowhead": null, "endArrowhead": null,
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 0, "height": 0,
@ -967,7 +967,7 @@ exports[`Test Transform > should transform regular shapes 1`] = `
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": null, "boundElements": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 100, "height": 100,
@ -981,7 +981,7 @@ exports[`Test Transform > should transform regular shapes 1`] = `
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 1, "version": 1,
@ -997,7 +997,7 @@ exports[`Test Transform > should transform regular shapes 2`] = `
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": null, "boundElements": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 100, "height": 100,
@ -1011,7 +1011,7 @@ exports[`Test Transform > should transform regular shapes 2`] = `
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "ellipse", "type": "ellipse",
"updated": 1, "updated": 1,
"version": 1, "version": 1,
@ -1027,7 +1027,7 @@ exports[`Test Transform > should transform regular shapes 3`] = `
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": null, "boundElements": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 100, "height": 100,
@ -1041,7 +1041,7 @@ exports[`Test Transform > should transform regular shapes 3`] = `
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "diamond", "type": "diamond",
"updated": 1, "updated": 1,
"version": 1, "version": 1,
@ -1057,7 +1057,7 @@ exports[`Test Transform > should transform regular shapes 4`] = `
"angle": 0, "angle": 0,
"backgroundColor": "#c0eb75", "backgroundColor": "#c0eb75",
"boundElements": null, "boundElements": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 100, "height": 100,
@ -1149,7 +1149,7 @@ exports[`Test Transform > should transform text element 1`] = `
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": null, "containerId": null,
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -1167,7 +1167,7 @@ exports[`Test Transform > should transform text element 1`] = `
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "HELLO WORLD!", "text": "HELLO WORLD!",
"textAlign": "left", "textAlign": "left",
"type": "text", "type": "text",
@ -1188,7 +1188,7 @@ exports[`Test Transform > should transform text element 2`] = `
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": null, "containerId": null,
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -1206,7 +1206,7 @@ exports[`Test Transform > should transform text element 2`] = `
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#5f3dc4", "strokeColor": "#5f3dc4",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "STYLED HELLO WORLD!", "text": "STYLED HELLO WORLD!",
"textAlign": "left", "textAlign": "left",
"type": "text", "type": "text",
@ -1232,7 +1232,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide
], ],
"endArrowhead": "arrow", "endArrowhead": "arrow",
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 0, "height": 0,
@ -1259,7 +1259,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide
"startBinding": null, "startBinding": null,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 1, "version": 1,
@ -1282,7 +1282,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide
], ],
"endArrowhead": "arrow", "endArrowhead": "arrow",
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 0, "height": 0,
@ -1309,7 +1309,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide
"startBinding": null, "startBinding": null,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 1, "version": 1,
@ -1332,7 +1332,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide
], ],
"endArrowhead": "arrow", "endArrowhead": "arrow",
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 130, "height": 130,
@ -1382,7 +1382,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide
], ],
"endArrowhead": "arrow", "endArrowhead": "arrow",
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 130, "height": 130,
@ -1427,7 +1427,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": "id24", "containerId": "id24",
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -1445,7 +1445,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "LABELED ARROW", "text": "LABELED ARROW",
"textAlign": "center", "textAlign": "center",
"type": "text", "type": "text",
@ -1466,7 +1466,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": "id25", "containerId": "id25",
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -1484,7 +1484,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#099268", "strokeColor": "#099268",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "STYLED LABELED ARROW", "text": "STYLED LABELED ARROW",
"textAlign": "center", "textAlign": "center",
"type": "text", "type": "text",
@ -1505,7 +1505,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": "id26", "containerId": "id26",
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -1523,7 +1523,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1098ad", "strokeColor": "#1098ad",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "ANOTHER STYLED "text": "ANOTHER STYLED
LABELLED ARROW", LABELLED ARROW",
"textAlign": "center", "textAlign": "center",
@ -1545,7 +1545,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": "id27", "containerId": "id27",
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -1563,7 +1563,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#099268", "strokeColor": "#099268",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "ANOTHER STYLED "text": "ANOTHER STYLED
LABELLED ARROW", LABELLED ARROW",
"textAlign": "center", "textAlign": "center",
@ -1588,7 +1588,7 @@ exports[`Test Transform > should transform to text containers when label provide
"type": "text", "type": "text",
}, },
], ],
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 35, "height": 35,
@ -1602,7 +1602,7 @@ exports[`Test Transform > should transform to text containers when label provide
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 3, "version": 3,
@ -1623,7 +1623,7 @@ exports[`Test Transform > should transform to text containers when label provide
"type": "text", "type": "text",
}, },
], ],
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 85, "height": 85,
@ -1637,7 +1637,7 @@ exports[`Test Transform > should transform to text containers when label provide
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "ellipse", "type": "ellipse",
"updated": 1, "updated": 1,
"version": 2, "version": 2,
@ -1658,7 +1658,7 @@ exports[`Test Transform > should transform to text containers when label provide
"type": "text", "type": "text",
}, },
], ],
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 170, "height": 170,
@ -1672,7 +1672,7 @@ exports[`Test Transform > should transform to text containers when label provide
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "diamond", "type": "diamond",
"updated": 1, "updated": 1,
"version": 2, "version": 2,
@ -1693,7 +1693,7 @@ exports[`Test Transform > should transform to text containers when label provide
"type": "text", "type": "text",
}, },
], ],
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 120, "height": 120,
@ -1728,7 +1728,7 @@ exports[`Test Transform > should transform to text containers when label provide
"type": "text", "type": "text",
}, },
], ],
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 85, "height": 85,
@ -1742,7 +1742,7 @@ exports[`Test Transform > should transform to text containers when label provide
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#c2255c", "strokeColor": "#c2255c",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 2, "version": 2,
@ -1763,7 +1763,7 @@ exports[`Test Transform > should transform to text containers when label provide
"type": "text", "type": "text",
}, },
], ],
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 120, "height": 120,
@ -1777,7 +1777,7 @@ exports[`Test Transform > should transform to text containers when label provide
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#f08c00", "strokeColor": "#f08c00",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "ellipse", "type": "ellipse",
"updated": 1, "updated": 1,
"version": 2, "version": 2,
@ -1795,7 +1795,7 @@ exports[`Test Transform > should transform to text containers when label provide
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": "id12", "containerId": "id12",
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -1813,7 +1813,7 @@ exports[`Test Transform > should transform to text containers when label provide
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "RECTANGLE TEXT CONTAINER", "text": "RECTANGLE TEXT CONTAINER",
"textAlign": "center", "textAlign": "center",
"type": "text", "type": "text",
@ -1834,7 +1834,7 @@ exports[`Test Transform > should transform to text containers when label provide
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": "id13", "containerId": "id13",
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -1852,7 +1852,7 @@ exports[`Test Transform > should transform to text containers when label provide
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "ELLIPSE TEXT "text": "ELLIPSE TEXT
CONTAINER", CONTAINER",
"textAlign": "center", "textAlign": "center",
@ -1874,7 +1874,7 @@ exports[`Test Transform > should transform to text containers when label provide
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": "id14", "containerId": "id14",
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -1893,7 +1893,7 @@ TEXT CONTAINER",
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "DIAMOND "text": "DIAMOND
TEXT TEXT
CONTAINER", CONTAINER",
@ -1916,7 +1916,7 @@ exports[`Test Transform > should transform to text containers when label provide
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": "id15", "containerId": "id15",
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -1934,7 +1934,7 @@ exports[`Test Transform > should transform to text containers when label provide
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#099268", "strokeColor": "#099268",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "STYLED DIAMOND "text": "STYLED DIAMOND
TEXT CONTAINER", TEXT CONTAINER",
"textAlign": "center", "textAlign": "center",
@ -1956,7 +1956,7 @@ exports[`Test Transform > should transform to text containers when label provide
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": "id16", "containerId": "id16",
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -1974,7 +1974,7 @@ exports[`Test Transform > should transform to text containers when label provide
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#c2255c", "strokeColor": "#c2255c",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "TOP LEFT ALIGNED "text": "TOP LEFT ALIGNED
RECTANGLE TEXT RECTANGLE TEXT
CONTAINER", CONTAINER",
@ -1997,7 +1997,7 @@ exports[`Test Transform > should transform to text containers when label provide
"baseline": 0, "baseline": 0,
"boundElements": null, "boundElements": null,
"containerId": "id17", "containerId": "id17",
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 20, "fontSize": 20,
"frameId": null, "frameId": null,
@ -2015,7 +2015,7 @@ exports[`Test Transform > should transform to text containers when label provide
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#c2255c", "strokeColor": "#c2255c",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "STYLED "text": "STYLED
ELLIPSE TEXT ELLIPSE TEXT
CONTAINER", CONTAINER",

View File

@ -1425,7 +1425,7 @@ describe("textWysiwyg", () => {
type: "text", type: "text",
}, },
], ],
fillStyle: "hachure", fillStyle: "solid",
groupIds: [], groupIds: [],
height: 35, height: 35,
isDeleted: false, isDeleted: false,
@ -1438,7 +1438,7 @@ describe("textWysiwyg", () => {
}, },
strokeColor: "#1e1e1e", strokeColor: "#1e1e1e",
strokeStyle: "solid", strokeStyle: "solid",
strokeWidth: 1, strokeWidth: 2,
type: "rectangle", type: "rectangle",
updated: 1, updated: 1,
version: 1, version: 1,

View File

@ -13,11 +13,21 @@ import { isPathALoop, getCornerRadius } from "../math";
import { generateFreeDrawShape } from "../renderer/renderElement"; import { generateFreeDrawShape } from "../renderer/renderElement";
import { isTransparent, assertNever } from "../utils"; import { isTransparent, assertNever } from "../utils";
import { simplify } from "points-on-curve"; import { simplify } from "points-on-curve";
import { ROUGHNESS } from "../constants";
const getDashArrayDashed = (strokeWidth: number) => [8, 8 + strokeWidth]; const getDashArrayDashed = (strokeWidth: number) => [8, 8 + strokeWidth];
const getDashArrayDotted = (strokeWidth: number) => [1.5, 6 + strokeWidth]; const getDashArrayDotted = (strokeWidth: number) => [1.5, 6 + strokeWidth];
function adjustRoughness(size: number, roughness: number): number {
if (size >= 50) {
return roughness;
}
const factor = 2 + (50 - size) / 10;
return roughness / factor;
}
export const generateRoughOptions = ( export const generateRoughOptions = (
element: ExcalidrawElement, element: ExcalidrawElement,
continuousPath = false, continuousPath = false,
@ -44,9 +54,13 @@ export const generateRoughOptions = (
// calculate them (and we don't want the fills to be modified) // calculate them (and we don't want the fills to be modified)
fillWeight: element.strokeWidth / 2, fillWeight: element.strokeWidth / 2,
hachureGap: element.strokeWidth * 4, hachureGap: element.strokeWidth * 4,
roughness: element.roughness, roughness: adjustRoughness(
Math.min(element.width, element.height),
element.roughness,
),
stroke: element.strokeColor, stroke: element.strokeColor,
preserveVertices: continuousPath, preserveVertices:
continuousPath || element.roughness < ROUGHNESS.cartoonist,
}; };
switch (element.type) { switch (element.type) {

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e
"boundElements": null, "boundElements": null,
"endArrowhead": "arrow", "endArrowhead": "arrow",
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 50, "height": 50,
@ -38,7 +38,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e
"startBinding": null, "startBinding": null,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 3, "version": 3,
@ -56,7 +56,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": null, "boundElements": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 50, "height": 50,
@ -72,7 +72,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e
"seed": 1278240551, "seed": 1278240551,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "diamond", "type": "diamond",
"updated": 1, "updated": 1,
"version": 2, "version": 2,
@ -90,7 +90,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": null, "boundElements": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 50, "height": 50,
@ -106,7 +106,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e
"seed": 1278240551, "seed": 1278240551,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "ellipse", "type": "ellipse",
"updated": 1, "updated": 1,
"version": 2, "version": 2,
@ -124,7 +124,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e
"boundElements": null, "boundElements": null,
"endArrowhead": null, "endArrowhead": null,
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 50, "height": 50,
@ -153,7 +153,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e
"startBinding": null, "startBinding": null,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "line", "type": "line",
"updated": 1, "updated": 1,
"version": 3, "version": 3,
@ -171,7 +171,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": null, "boundElements": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 50, "height": 50,
@ -187,7 +187,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e
"seed": 1278240551, "seed": 1278240551,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 2, "version": 2,

View File

@ -5,7 +5,7 @@ exports[`duplicate element on move when ALT is clicked > rectangle 1`] = `
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": null, "boundElements": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 50, "height": 50,
@ -21,7 +21,7 @@ exports[`duplicate element on move when ALT is clicked > rectangle 1`] = `
"seed": 1014066025, "seed": 1014066025,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 4, "version": 4,
@ -37,7 +37,7 @@ exports[`duplicate element on move when ALT is clicked > rectangle 2`] = `
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": null, "boundElements": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 50, "height": 50,
@ -53,7 +53,7 @@ exports[`duplicate element on move when ALT is clicked > rectangle 2`] = `
"seed": 1278240551, "seed": 1278240551,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 4, "version": 4,
@ -69,7 +69,7 @@ exports[`move element > rectangle 1`] = `
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": null, "boundElements": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 50, "height": 50,
@ -85,7 +85,7 @@ exports[`move element > rectangle 1`] = `
"seed": 1278240551, "seed": 1278240551,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 3, "version": 3,
@ -106,7 +106,7 @@ exports[`move element > rectangles with binding arrow 1`] = `
"type": "arrow", "type": "arrow",
}, },
], ],
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 100, "height": 100,
@ -122,7 +122,7 @@ exports[`move element > rectangles with binding arrow 1`] = `
"seed": 1278240551, "seed": 1278240551,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 3, "version": 3,
@ -143,7 +143,7 @@ exports[`move element > rectangles with binding arrow 2`] = `
"type": "arrow", "type": "arrow",
}, },
], ],
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 300, "height": 300,
@ -159,7 +159,7 @@ exports[`move element > rectangles with binding arrow 2`] = `
"seed": 2019559783, "seed": 2019559783,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 6, "version": 6,
@ -181,7 +181,7 @@ exports[`move element > rectangles with binding arrow 3`] = `
"focus": -0.46666666666666673, "focus": -0.46666666666666673,
"gap": 10, "gap": 10,
}, },
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 81.48231043525051, "height": 81.48231043525051,
@ -214,7 +214,7 @@ exports[`move element > rectangles with binding arrow 3`] = `
}, },
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "line", "type": "line",
"updated": 1, "updated": 1,
"version": 11, "version": 11,

View File

@ -7,7 +7,7 @@ exports[`multi point mode in linear elements > arrow 1`] = `
"boundElements": null, "boundElements": null,
"endArrowhead": "arrow", "endArrowhead": "arrow",
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 110, "height": 110,
@ -43,7 +43,7 @@ exports[`multi point mode in linear elements > arrow 1`] = `
"startBinding": null, "startBinding": null,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 7, "version": 7,
@ -61,7 +61,7 @@ exports[`multi point mode in linear elements > line 1`] = `
"boundElements": null, "boundElements": null,
"endArrowhead": null, "endArrowhead": null,
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 110, "height": 110,
@ -97,7 +97,7 @@ exports[`multi point mode in linear elements > line 1`] = `
"startBinding": null, "startBinding": null,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "line", "type": "line",
"updated": 1, "updated": 1,
"version": 7, "version": 7,

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ exports[`select single element on the scene > arrow 1`] = `
"boundElements": null, "boundElements": null,
"endArrowhead": "arrow", "endArrowhead": "arrow",
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 50, "height": 50,
@ -36,7 +36,7 @@ exports[`select single element on the scene > arrow 1`] = `
"startBinding": null, "startBinding": null,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 3, "version": 3,
@ -54,7 +54,7 @@ exports[`select single element on the scene > arrow escape 1`] = `
"boundElements": null, "boundElements": null,
"endArrowhead": null, "endArrowhead": null,
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 50, "height": 50,
@ -83,7 +83,7 @@ exports[`select single element on the scene > arrow escape 1`] = `
"startBinding": null, "startBinding": null,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "line", "type": "line",
"updated": 1, "updated": 1,
"version": 3, "version": 3,
@ -99,7 +99,7 @@ exports[`select single element on the scene > diamond 1`] = `
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": null, "boundElements": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 50, "height": 50,
@ -115,7 +115,7 @@ exports[`select single element on the scene > diamond 1`] = `
"seed": 1278240551, "seed": 1278240551,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "diamond", "type": "diamond",
"updated": 1, "updated": 1,
"version": 2, "version": 2,
@ -131,7 +131,7 @@ exports[`select single element on the scene > ellipse 1`] = `
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": null, "boundElements": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 50, "height": 50,
@ -147,7 +147,7 @@ exports[`select single element on the scene > ellipse 1`] = `
"seed": 1278240551, "seed": 1278240551,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "ellipse", "type": "ellipse",
"updated": 1, "updated": 1,
"version": 2, "version": 2,
@ -163,7 +163,7 @@ exports[`select single element on the scene > rectangle 1`] = `
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": null, "boundElements": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 50, "height": 50,
@ -179,7 +179,7 @@ exports[`select single element on the scene > rectangle 1`] = `
"seed": 1278240551, "seed": 1278240551,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 2, "version": 2,

View File

@ -7,7 +7,7 @@ exports[`restoreElements > should restore arrow element correctly 1`] = `
"boundElements": [], "boundElements": [],
"endArrowhead": null, "endArrowhead": null,
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 100, "height": 100,
@ -36,7 +36,7 @@ exports[`restoreElements > should restore arrow element correctly 1`] = `
"startBinding": null, "startBinding": null,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 1, "version": 1,
@ -160,7 +160,7 @@ exports[`restoreElements > should restore freedraw element correctly 1`] = `
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
"boundElements": [], "boundElements": [],
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 0, "height": 0,
@ -180,7 +180,7 @@ exports[`restoreElements > should restore freedraw element correctly 1`] = `
"simulatePressure": true, "simulatePressure": true,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "freedraw", "type": "freedraw",
"updated": 1, "updated": 1,
"version": 1, "version": 1,
@ -198,7 +198,7 @@ exports[`restoreElements > should restore line and draw elements correctly 1`] =
"boundElements": [], "boundElements": [],
"endArrowhead": null, "endArrowhead": null,
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 100, "height": 100,
@ -227,7 +227,7 @@ exports[`restoreElements > should restore line and draw elements correctly 1`] =
"startBinding": null, "startBinding": null,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "line", "type": "line",
"updated": 1, "updated": 1,
"version": 1, "version": 1,
@ -245,7 +245,7 @@ exports[`restoreElements > should restore line and draw elements correctly 2`] =
"boundElements": [], "boundElements": [],
"endArrowhead": null, "endArrowhead": null,
"endBinding": null, "endBinding": null,
"fillStyle": "hachure", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": 100, "height": 100,
@ -274,7 +274,7 @@ exports[`restoreElements > should restore line and draw elements correctly 2`] =
"startBinding": null, "startBinding": null,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"type": "line", "type": "line",
"updated": 1, "updated": 1,
"version": 1, "version": 1,
@ -292,7 +292,7 @@ exports[`restoreElements > should restore text element correctly passing value f
"baseline": 0, "baseline": 0,
"boundElements": [], "boundElements": [],
"containerId": null, "containerId": null,
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 14, "fontSize": 14,
"frameId": null, "frameId": null,
@ -312,7 +312,7 @@ exports[`restoreElements > should restore text element correctly passing value f
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "text", "text": "text",
"textAlign": "center", "textAlign": "center",
"type": "text", "type": "text",
@ -333,7 +333,7 @@ exports[`restoreElements > should restore text element correctly with unknown fo
"baseline": 0, "baseline": 0,
"boundElements": [], "boundElements": [],
"containerId": null, "containerId": null,
"fillStyle": "hachure", "fillStyle": "solid",
"fontFamily": 1, "fontFamily": 1,
"fontSize": 10, "fontSize": 10,
"frameId": null, "frameId": null,
@ -353,7 +353,7 @@ exports[`restoreElements > should restore text element correctly with unknown fo
"seed": Any<Number>, "seed": Any<Number>,
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 2,
"text": "", "text": "",
"textAlign": "left", "textAlign": "left",
"type": "text", "type": "text",

View File

@ -14,7 +14,7 @@ exports[`exportToSvg > with default arguments 1`] = `
"currentChartType": "bar", "currentChartType": "bar",
"currentItemBackgroundColor": "transparent", "currentItemBackgroundColor": "transparent",
"currentItemEndArrowhead": "arrow", "currentItemEndArrowhead": "arrow",
"currentItemFillStyle": "hachure", "currentItemFillStyle": "solid",
"currentItemFontFamily": 1, "currentItemFontFamily": 1,
"currentItemFontSize": 20, "currentItemFontSize": 20,
"currentItemOpacity": 100, "currentItemOpacity": 100,
@ -23,7 +23,7 @@ exports[`exportToSvg > with default arguments 1`] = `
"currentItemStartArrowhead": null, "currentItemStartArrowhead": null,
"currentItemStrokeColor": "#1e1e1e", "currentItemStrokeColor": "#1e1e1e",
"currentItemStrokeStyle": "solid", "currentItemStrokeStyle": "solid",
"currentItemStrokeWidth": 1, "currentItemStrokeWidth": 2,
"currentItemTextAlign": "left", "currentItemTextAlign": "left",
"cursorButton": "up", "cursorButton": "up",
"defaultSidebarDockedPreference": false, "defaultSidebarDockedPreference": false,

View File

@ -6,7 +6,7 @@ export const getTextEditor = async (waitForEditor = true) => {
".excalidraw-textEditorContainer > textarea", ".excalidraw-textEditorContainer > textarea",
) as HTMLTextAreaElement; ) as HTMLTextAreaElement;
if (waitForEditor) { if (waitForEditor) {
waitFor(() => expect(query()).not.toBe(null)); await waitFor(() => expect(query()).not.toBe(null));
return query(); return query();
} }
return query(); return query();

File diff suppressed because one or more lines are too long