Browse Source

feat: renderer tweaks (#6698)

pull/6644/merge
David Luzar 2 years ago committed by GitHub
parent
commit
afea0df141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      src/constants.ts
  2. 180
      src/data/__snapshots__/transform.test.ts.snap
  3. 4
      src/element/textWysiwyg.test.tsx
  4. 18
      src/scene/Shape.ts
  5. 504
      src/tests/__snapshots__/contextmenu.test.tsx.snap
  6. 20
      src/tests/__snapshots__/dragCreate.test.tsx.snap
  7. 24
      src/tests/__snapshots__/move.test.tsx.snap
  8. 8
      src/tests/__snapshots__/multiPointCreate.test.tsx.snap
  9. 1372
      src/tests/__snapshots__/regressionTests.test.tsx.snap
  10. 20
      src/tests/__snapshots__/selection.test.tsx.snap
  11. 24
      src/tests/data/__snapshots__/restore.test.ts.snap
  12. 4
      src/tests/packages/__snapshots__/utils.test.ts.snap
  13. 2
      src/tests/queries/dom.ts
  14. 10
      src/tests/scene/__snapshots__/export.test.ts.snap

12
src/constants.ts

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

180
src/data/__snapshots__/transform.test.ts.snap

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

4
src/element/textWysiwyg.test.tsx

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

18
src/scene/Shape.ts

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

504
src/tests/__snapshots__/contextmenu.test.tsx.snap

File diff suppressed because it is too large Load Diff

20
src/tests/__snapshots__/dragCreate.test.tsx.snap

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

24
src/tests/__snapshots__/move.test.tsx.snap

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

8
src/tests/__snapshots__/multiPointCreate.test.tsx.snap

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

1372
src/tests/__snapshots__/regressionTests.test.tsx.snap

File diff suppressed because it is too large Load Diff

20
src/tests/__snapshots__/selection.test.tsx.snap

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

24
src/tests/data/__snapshots__/restore.test.ts.snap

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

4
src/tests/packages/__snapshots__/utils.test.ts.snap

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

2
src/tests/queries/dom.ts

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

10
src/tests/scene/__snapshots__/export.test.ts.snap

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save