@misenkashari/excalidraw-element 1.11.2 → 1.11.11

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.
package/dist/dev/index.js CHANGED
@@ -12774,10 +12774,6 @@ var getElementShape = (element, elementsMap) => {
12774
12774
  switch (element.type) {
12775
12775
  case "rectangle":
12776
12776
  case "diamond":
12777
- case "triangle":
12778
- case "hexagon":
12779
- case "heart":
12780
- case "star":
12781
12777
  case "frame":
12782
12778
  case "magicframe":
12783
12779
  case "embeddable":
@@ -12786,6 +12782,76 @@ var getElementShape = (element, elementsMap) => {
12786
12782
  case "text":
12787
12783
  case "selection":
12788
12784
  return getPolygonShape(element);
12785
+ case "triangle": {
12786
+ const [topX, topY, leftX, leftY, rightX, rightY] = getTrianglePoints(element);
12787
+ const { angle, x, y, width, height } = element;
12788
+ const cx = x + width / 2;
12789
+ const cy = y + height / 2;
12790
+ const center = pointFrom13(cx, cy);
12791
+ return {
12792
+ type: "polygon",
12793
+ data: [
12794
+ pointRotateRads12(pointFrom13(x + topX, y + topY), center, angle),
12795
+ pointRotateRads12(pointFrom13(x + leftX, y + leftY), center, angle),
12796
+ pointRotateRads12(pointFrom13(x + rightX, y + rightY), center, angle),
12797
+ pointRotateRads12(pointFrom13(x + topX, y + topY), center, angle)
12798
+ ]
12799
+ };
12800
+ }
12801
+ case "hexagon": {
12802
+ const points = getHexagonPoints(element);
12803
+ const { angle, x, y, width, height } = element;
12804
+ const cx = x + width / 2;
12805
+ const cy = y + height / 2;
12806
+ const center = pointFrom13(cx, cy);
12807
+ const polygonPoints = [];
12808
+ for (let i = 0; i < points.length; i += 2) {
12809
+ polygonPoints.push(
12810
+ pointRotateRads12(pointFrom13(x + points[i], y + points[i + 1]), center, angle)
12811
+ );
12812
+ }
12813
+ polygonPoints.push(polygonPoints[0]);
12814
+ return {
12815
+ type: "polygon",
12816
+ data: polygonPoints
12817
+ };
12818
+ }
12819
+ case "heart": {
12820
+ const points = getHeartPoints(element);
12821
+ const { angle, x, y, width, height } = element;
12822
+ const cx = x + width / 2;
12823
+ const cy = y + height / 2;
12824
+ const center = pointFrom13(cx, cy);
12825
+ const polygonPoints = [];
12826
+ for (let i = 0; i < points.length; i += 2) {
12827
+ polygonPoints.push(
12828
+ pointRotateRads12(pointFrom13(x + points[i], y + points[i + 1]), center, angle)
12829
+ );
12830
+ }
12831
+ polygonPoints.push(polygonPoints[0]);
12832
+ return {
12833
+ type: "polygon",
12834
+ data: polygonPoints
12835
+ };
12836
+ }
12837
+ case "star": {
12838
+ const points = getStarPoints(element);
12839
+ const { angle, x, y, width, height } = element;
12840
+ const cx = x + width / 2;
12841
+ const cy = y + height / 2;
12842
+ const center = pointFrom13(cx, cy);
12843
+ const polygonPoints = [];
12844
+ for (let i = 0; i < points.length; i += 2) {
12845
+ polygonPoints.push(
12846
+ pointRotateRads12(pointFrom13(x + points[i], y + points[i + 1]), center, angle)
12847
+ );
12848
+ }
12849
+ polygonPoints.push(polygonPoints[0]);
12850
+ return {
12851
+ type: "polygon",
12852
+ data: polygonPoints
12853
+ };
12854
+ }
12789
12855
  case "arrow":
12790
12856
  case "line": {
12791
12857
  const roughShape = ShapeCache.generateElementShape(element, null)[0];
@@ -13247,7 +13313,7 @@ var getHexagonPoints = (element) => {
13247
13313
  // left
13248
13314
  ];
13249
13315
  };
13250
- var getHeartPoints2 = (element) => {
13316
+ var getHeartPoints = (element) => {
13251
13317
  const w = element.width;
13252
13318
  const h = element.height;
13253
13319
  return [
@@ -21135,7 +21201,7 @@ export {
21135
21201
  getGlobalFixedPointForBindableElement,
21136
21202
  getGlobalFixedPoints,
21137
21203
  getHeadingForElbowArrowSnap,
21138
- getHeartPoints2 as getHeartPoints,
21204
+ getHeartPoints,
21139
21205
  getHexagonPoints,
21140
21206
  getHoveredElementForBinding,
21141
21207
  getInitializedImageElements,