@excalidraw/excalidraw 0.17.1-f597bd3 → 0.17.1-f59b4f6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@
11
11
  * also included in this file are methods for converting an Excalidraw element or a Drawable from roughjs
12
12
  * to pure shapes
13
13
  */
14
- import { ExcalidrawDiamondElement, ExcalidrawEllipseElement, ExcalidrawEmbeddableElement, ExcalidrawFrameLikeElement, ExcalidrawFreeDrawElement, ExcalidrawIframeElement, ExcalidrawImageElement, ExcalidrawRectangleElement, ExcalidrawSelectionElement, ExcalidrawTextElement } from "../../excalidraw/element/types";
14
+ import { ExcalidrawDiamondElement, ExcalidrawEllipseElement, ExcalidrawEmbeddableElement, ExcalidrawFrameLikeElement, ExcalidrawFreeDrawElement, ExcalidrawIframeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawRectangleElement, ExcalidrawSelectionElement, ExcalidrawTextElement } from "../../excalidraw/element/types";
15
15
  import type { Drawable, Op } from "roughjs/bin/core";
16
16
  export type Point = [number, number];
17
17
  export type Vector = Point;
@@ -51,5 +51,5 @@ export declare const getEllipseShape: (element: ExcalidrawEllipseElement) => Geo
51
51
  export declare const getCurvePathOps: (shape: Drawable) => Op[];
52
52
  export declare const getCurveShape: (roughShape: Drawable, startingPoint: Point | undefined, angleInRadian: number, center: Point) => GeometricShape;
53
53
  export declare const getFreedrawShape: (element: ExcalidrawFreeDrawElement, center: Point, isClosed?: boolean) => GeometricShape;
54
- export declare const getClosedCurveShape: (roughShape: Drawable, startingPoint: Point | undefined, angleInRadian: number, center: Point) => GeometricShape;
54
+ export declare const getClosedCurveShape: (element: ExcalidrawLinearElement, roughShape: Drawable, startingPoint: Point | undefined, angleInRadian: number, center: Point) => GeometricShape;
55
55
  export {};
@@ -110,9 +110,15 @@ export const getFreedrawShape = (element, center, isClosed = false) => {
110
110
  data: polyline,
111
111
  };
112
112
  };
113
- export const getClosedCurveShape = (roughShape, startingPoint = [0, 0], angleInRadian, center) => {
114
- const ops = getCurvePathOps(roughShape);
113
+ export const getClosedCurveShape = (element, roughShape, startingPoint = [0, 0], angleInRadian, center) => {
115
114
  const transform = (p) => pointRotate([p[0] + startingPoint[0], p[1] + startingPoint[1]], angleToDegrees(angleInRadian), center);
115
+ if (element.roundness === null) {
116
+ return {
117
+ type: "polygon",
118
+ data: close(element.points.map((p) => transform(p))),
119
+ };
120
+ }
121
+ const ops = getCurvePathOps(roughShape);
116
122
  const points = [];
117
123
  let odd = false;
118
124
  for (const operation of ops) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excalidraw/excalidraw",
3
- "version": "0.17.1-f597bd3",
3
+ "version": "0.17.1-f59b4f6",
4
4
  "main": "./dist/prod/index.js",
5
5
  "type": "module",
6
6
  "module": "./dist/prod/index.js",