@idraw/core 0.4.0-beta.35 → 0.4.0-beta.36
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/esm/middleware/info/config.d.ts +1 -0
- package/dist/esm/middleware/info/config.js +1 -0
- package/dist/esm/middleware/info/draw-info.d.ts +1 -1
- package/dist/esm/middleware/info/index.d.ts +7 -1
- package/dist/esm/middleware/info/index.js +27 -14
- package/dist/esm/middleware/selector/config.d.ts +2 -0
- package/dist/esm/middleware/selector/config.js +2 -0
- package/dist/esm/middleware/selector/draw-debug.d.ts +5 -0
- package/dist/esm/middleware/selector/draw-debug.js +30 -0
- package/dist/esm/middleware/selector/draw-wrapper.d.ts +1 -0
- package/dist/esm/middleware/selector/draw-wrapper.js +8 -6
- package/dist/esm/middleware/selector/index.d.ts +6 -1
- package/dist/esm/middleware/selector/index.js +41 -29
- package/dist/esm/middleware/selector/pattern/icon-rotate.d.ts +4 -0
- package/dist/esm/middleware/selector/pattern/icon-rotate.js +88 -0
- package/dist/esm/middleware/selector/pattern/index.d.ts +5 -0
- package/dist/esm/middleware/selector/pattern/index.js +38 -0
- package/dist/esm/middleware/selector/util.js +1 -1
- package/dist/index.global.js +732 -537
- package/dist/index.global.min.js +1 -1
- package/package.json +5 -5
package/dist/index.global.js
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
var iDrawCore = function(exports) {
|
|
2
|
-
"use strict";var
|
|
3
|
-
|
|
4
|
-
throw TypeError("Cannot " + msg);
|
|
5
|
-
};
|
|
6
|
-
var __privateGet = (obj, member, getter) => {
|
|
7
|
-
__accessCheck(obj, member, "read from private field");
|
|
8
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
9
|
-
};
|
|
10
|
-
var __privateAdd = (obj, member, value) => {
|
|
11
|
-
if (member.has(obj))
|
|
12
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
13
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
14
|
-
};
|
|
15
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
16
|
-
__accessCheck(obj, member, "write to private field");
|
|
17
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
18
|
-
return value;
|
|
19
|
-
};
|
|
20
|
-
var __privateMethod = (obj, member, method) => {
|
|
21
|
-
__accessCheck(obj, member, "access private method");
|
|
22
|
-
return method;
|
|
2
|
+
"use strict";var __typeError = (msg) => {
|
|
3
|
+
throw TypeError(msg);
|
|
23
4
|
};
|
|
5
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
6
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
7
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
8
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
9
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
24
10
|
|
|
25
|
-
var _eventHub, _container, _cursorType, _resizeCursorBaseImage, _cursorImageMap,
|
|
11
|
+
var _eventHub, _container, _cursorType, _resizeCursorBaseImage, _cursorImageMap, _Cursor_instances, init_fn, loadResizeCursorBaseImage_fn, resetCursor_fn, setCursorResize_fn, appendRotateResizeImage_fn, _board, _canvas, _container2, _Core_instances, initContainer_fn;
|
|
26
12
|
function isColorStr(color2) {
|
|
27
13
|
return typeof color2 === "string" && (/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(color2) || /^[a-z]{1,}$/i.test(color2));
|
|
28
14
|
}
|
|
@@ -350,19 +336,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
350
336
|
strokeWidth
|
|
351
337
|
};
|
|
352
338
|
var __classPrivateFieldSet$9 = function(receiver, state, value, kind, f) {
|
|
353
|
-
if (kind === "m")
|
|
354
|
-
|
|
355
|
-
if (
|
|
356
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
357
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
358
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
339
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
340
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
341
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
359
342
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
360
343
|
};
|
|
361
344
|
var __classPrivateFieldGet$9 = function(receiver, state, kind, f) {
|
|
362
|
-
if (kind === "a" && !f)
|
|
363
|
-
|
|
364
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
365
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
345
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
346
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
366
347
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
367
348
|
};
|
|
368
349
|
var _Context2D_ctx, _Context2D_opts;
|
|
@@ -726,19 +707,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
726
707
|
}
|
|
727
708
|
}
|
|
728
709
|
var __classPrivateFieldSet$8 = function(receiver, state, value, kind, f) {
|
|
729
|
-
if (kind === "m")
|
|
730
|
-
|
|
731
|
-
if (
|
|
732
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
733
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
734
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
710
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
711
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
712
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
735
713
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
736
714
|
};
|
|
737
715
|
var __classPrivateFieldGet$8 = function(receiver, state, kind, f) {
|
|
738
|
-
if (kind === "a" && !f)
|
|
739
|
-
|
|
740
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
741
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
716
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
717
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
742
718
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
743
719
|
};
|
|
744
720
|
var _EventEmitter_listeners;
|
|
@@ -809,19 +785,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
809
785
|
};
|
|
810
786
|
}
|
|
811
787
|
var __classPrivateFieldSet$7 = function(receiver, state, value, kind, f) {
|
|
812
|
-
if (kind === "m")
|
|
813
|
-
|
|
814
|
-
if (
|
|
815
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
816
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
817
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
788
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
789
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
790
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
818
791
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
819
792
|
};
|
|
820
793
|
var __classPrivateFieldGet$7 = function(receiver, state, kind, f) {
|
|
821
|
-
if (kind === "a" && !f)
|
|
822
|
-
|
|
823
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
824
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
794
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
795
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
825
796
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
826
797
|
};
|
|
827
798
|
var _Store_instances, _Store_temp, _Store_backUpDefaultStorage, _Store_static, _Store_createTempStorage;
|
|
@@ -933,16 +904,10 @@ var __privateMethod = (obj, member, method) => {
|
|
|
933
904
|
return calcElementCenter(elemSize);
|
|
934
905
|
}
|
|
935
906
|
function calcRadian(center, start, end) {
|
|
936
|
-
const
|
|
937
|
-
const
|
|
938
|
-
if (
|
|
939
|
-
|
|
940
|
-
return endAngle + (Math.PI * 2 - startAngle);
|
|
941
|
-
} else if (endAngle > Math.PI * 3 / 2 && startAngle < Math.PI / 2) {
|
|
942
|
-
return startAngle + (Math.PI * 2 - endAngle);
|
|
943
|
-
} else {
|
|
944
|
-
return endAngle - startAngle;
|
|
945
|
-
}
|
|
907
|
+
const startRadian = calcLineRadian(center, start);
|
|
908
|
+
const endRadian = calcLineRadian(center, end);
|
|
909
|
+
if (endRadian !== null && startRadian !== null) {
|
|
910
|
+
return endRadian - startRadian;
|
|
946
911
|
} else {
|
|
947
912
|
return 0;
|
|
948
913
|
}
|
|
@@ -1068,12 +1033,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1068
1033
|
];
|
|
1069
1034
|
}
|
|
1070
1035
|
function limitAngle(angle2) {
|
|
1071
|
-
if (!(angle2 > 0 || angle2 < 0) || angle2 === 0) {
|
|
1036
|
+
if (!(angle2 > 0 || angle2 < 0) || angle2 === 0 || angle2 === 360) {
|
|
1072
1037
|
return 0;
|
|
1073
1038
|
}
|
|
1074
1039
|
let num = angle2 % 360;
|
|
1075
1040
|
if (num < 0) {
|
|
1076
1041
|
num += 360;
|
|
1042
|
+
} else if (angle2 === 360) {
|
|
1043
|
+
num = 0;
|
|
1077
1044
|
}
|
|
1078
1045
|
return num;
|
|
1079
1046
|
}
|
|
@@ -1720,9 +1687,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1720
1687
|
};
|
|
1721
1688
|
}
|
|
1722
1689
|
function calcElementSizeController(elemSize, opts) {
|
|
1723
|
-
const { groupQueue, controllerSize: controllerSize2, viewScaleInfo } = opts;
|
|
1690
|
+
const { groupQueue, controllerSize: controllerSize2, viewScaleInfo, rotateControllerSize: rotateControllerSize2, rotateControllerPosition: rotateControllerPosition2 } = opts;
|
|
1724
1691
|
const ctrlSize = (controllerSize2 && controllerSize2 > 0 ? controllerSize2 : 8) / viewScaleInfo.scale;
|
|
1725
1692
|
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 = 0 } = elemSize;
|
|
1693
|
+
const rotateCtrlSize = rotateControllerSize2;
|
|
1694
|
+
const rotateCtrlPos = rotateControllerPosition2;
|
|
1726
1695
|
const ctrlGroupQueue = [
|
|
1727
1696
|
...[
|
|
1728
1697
|
{
|
|
@@ -1744,10 +1713,10 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1744
1713
|
});
|
|
1745
1714
|
const vertexes = calcElementVertexesInGroup(elemSize, { groupQueue });
|
|
1746
1715
|
const rotateElemVertexes = calcElementVertexesInGroup({
|
|
1747
|
-
x: x2
|
|
1748
|
-
y: y2 -
|
|
1749
|
-
h: h2 +
|
|
1750
|
-
w: w2
|
|
1716
|
+
x: x2,
|
|
1717
|
+
y: y2 - (rotateCtrlPos + rotateCtrlSize / 2) / viewScaleInfo.scale,
|
|
1718
|
+
h: h2 + (rotateCtrlPos * 2 + rotateCtrlSize) / viewScaleInfo.scale,
|
|
1719
|
+
w: w2,
|
|
1751
1720
|
angle: angle2
|
|
1752
1721
|
}, { groupQueue: [...groupQueue] });
|
|
1753
1722
|
const topCenter = getCenterFromTwoPoints(vertexes[0], vertexes[1]);
|
|
@@ -1779,74 +1748,91 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1779
1748
|
const bottomMiddleVertexes = calcElementVertexes(bottomMiddleSize);
|
|
1780
1749
|
const leftMiddleVertexes = calcElementVertexes(leftMiddleSize);
|
|
1781
1750
|
const rotateCenter = getCenterFromTwoPoints(rotateElemVertexes[0], rotateElemVertexes[1]);
|
|
1782
|
-
const
|
|
1751
|
+
const tempRotateSizeRepairRatio = 1.1;
|
|
1752
|
+
const rotateSize = createControllerElementSizeFromCenter(rotateCenter, {
|
|
1753
|
+
size: rotateControllerSize2 * tempRotateSizeRepairRatio / viewScaleInfo.scale,
|
|
1754
|
+
angle: totalAngle
|
|
1755
|
+
});
|
|
1783
1756
|
const rotateVertexes2 = calcElementVertexes(rotateSize);
|
|
1784
1757
|
const sizeController = {
|
|
1785
1758
|
elementWrapper: vertexes,
|
|
1786
1759
|
left: {
|
|
1787
1760
|
type: "left",
|
|
1788
1761
|
vertexes: leftVertexes,
|
|
1789
|
-
center: leftCenter
|
|
1762
|
+
center: leftCenter,
|
|
1763
|
+
size: ctrlSize
|
|
1790
1764
|
},
|
|
1791
1765
|
right: {
|
|
1792
1766
|
type: "right",
|
|
1793
1767
|
vertexes: rightVertexes,
|
|
1794
|
-
center: rightCenter
|
|
1768
|
+
center: rightCenter,
|
|
1769
|
+
size: ctrlSize
|
|
1795
1770
|
},
|
|
1796
1771
|
top: {
|
|
1797
1772
|
type: "top",
|
|
1798
1773
|
vertexes: topVertexes,
|
|
1799
|
-
center: topCenter
|
|
1774
|
+
center: topCenter,
|
|
1775
|
+
size: ctrlSize
|
|
1800
1776
|
},
|
|
1801
1777
|
bottom: {
|
|
1802
1778
|
type: "bottom",
|
|
1803
1779
|
vertexes: bottomVertexes,
|
|
1804
|
-
center: bottomCenter
|
|
1780
|
+
center: bottomCenter,
|
|
1781
|
+
size: ctrlSize
|
|
1805
1782
|
},
|
|
1806
1783
|
topLeft: {
|
|
1807
1784
|
type: "top-left",
|
|
1808
1785
|
vertexes: topLeftVertexes,
|
|
1809
|
-
center: topLeftCenter
|
|
1786
|
+
center: topLeftCenter,
|
|
1787
|
+
size: ctrlSize
|
|
1810
1788
|
},
|
|
1811
1789
|
topRight: {
|
|
1812
1790
|
type: "top-right",
|
|
1813
1791
|
vertexes: topRightVertexes,
|
|
1814
|
-
center: topRightCenter
|
|
1792
|
+
center: topRightCenter,
|
|
1793
|
+
size: ctrlSize
|
|
1815
1794
|
},
|
|
1816
1795
|
bottomLeft: {
|
|
1817
1796
|
type: "bottom-left",
|
|
1818
1797
|
vertexes: bottomLeftVertexes,
|
|
1819
|
-
center: bottomLeftCenter
|
|
1798
|
+
center: bottomLeftCenter,
|
|
1799
|
+
size: ctrlSize
|
|
1820
1800
|
},
|
|
1821
1801
|
bottomRight: {
|
|
1822
1802
|
type: "bottom-right",
|
|
1823
1803
|
vertexes: bottomRightVertexes,
|
|
1824
|
-
center: bottomRightCenter
|
|
1804
|
+
center: bottomRightCenter,
|
|
1805
|
+
size: ctrlSize
|
|
1825
1806
|
},
|
|
1826
1807
|
leftMiddle: {
|
|
1827
1808
|
type: "left-middle",
|
|
1828
1809
|
vertexes: leftMiddleVertexes,
|
|
1829
|
-
center: leftCenter
|
|
1810
|
+
center: leftCenter,
|
|
1811
|
+
size: ctrlSize
|
|
1830
1812
|
},
|
|
1831
1813
|
rightMiddle: {
|
|
1832
1814
|
type: "right-middle",
|
|
1833
1815
|
vertexes: rightMiddleVertexes,
|
|
1834
|
-
center: rightCenter
|
|
1816
|
+
center: rightCenter,
|
|
1817
|
+
size: ctrlSize
|
|
1835
1818
|
},
|
|
1836
1819
|
topMiddle: {
|
|
1837
1820
|
type: "top-middle",
|
|
1838
1821
|
vertexes: topMiddleVertexes,
|
|
1839
|
-
center: topCenter
|
|
1822
|
+
center: topCenter,
|
|
1823
|
+
size: ctrlSize
|
|
1840
1824
|
},
|
|
1841
1825
|
bottomMiddle: {
|
|
1842
1826
|
type: "bottom-middle",
|
|
1843
1827
|
vertexes: bottomMiddleVertexes,
|
|
1844
|
-
center: bottomCenter
|
|
1828
|
+
center: bottomCenter,
|
|
1829
|
+
size: ctrlSize
|
|
1845
1830
|
},
|
|
1846
1831
|
rotate: {
|
|
1847
1832
|
type: "rotate",
|
|
1848
1833
|
vertexes: rotateVertexes2,
|
|
1849
|
-
center: rotateCenter
|
|
1834
|
+
center: rotateCenter,
|
|
1835
|
+
size: rotateControllerSize2
|
|
1850
1836
|
}
|
|
1851
1837
|
};
|
|
1852
1838
|
return sizeController;
|
|
@@ -1888,62 +1874,74 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1888
1874
|
left: {
|
|
1889
1875
|
type: "left",
|
|
1890
1876
|
vertexes: leftVertexes,
|
|
1891
|
-
center: leftCenter
|
|
1877
|
+
center: leftCenter,
|
|
1878
|
+
size: ctrlSize
|
|
1892
1879
|
},
|
|
1893
1880
|
right: {
|
|
1894
1881
|
type: "right",
|
|
1895
1882
|
vertexes: rightVertexes,
|
|
1896
|
-
center: rightCenter
|
|
1883
|
+
center: rightCenter,
|
|
1884
|
+
size: ctrlSize
|
|
1897
1885
|
},
|
|
1898
1886
|
top: {
|
|
1899
1887
|
type: "top",
|
|
1900
1888
|
vertexes: topVertexes,
|
|
1901
|
-
center: topCenter
|
|
1889
|
+
center: topCenter,
|
|
1890
|
+
size: ctrlSize
|
|
1902
1891
|
},
|
|
1903
1892
|
bottom: {
|
|
1904
1893
|
type: "bottom",
|
|
1905
1894
|
vertexes: bottomVertexes,
|
|
1906
|
-
center: bottomCenter
|
|
1895
|
+
center: bottomCenter,
|
|
1896
|
+
size: ctrlSize
|
|
1907
1897
|
},
|
|
1908
1898
|
topLeft: {
|
|
1909
1899
|
type: "top-left",
|
|
1910
1900
|
vertexes: topLeftVertexes,
|
|
1911
|
-
center: topLeftCenter
|
|
1901
|
+
center: topLeftCenter,
|
|
1902
|
+
size: ctrlSize
|
|
1912
1903
|
},
|
|
1913
1904
|
topRight: {
|
|
1914
1905
|
type: "top-right",
|
|
1915
1906
|
vertexes: topRightVertexes,
|
|
1916
|
-
center: topRightCenter
|
|
1907
|
+
center: topRightCenter,
|
|
1908
|
+
size: ctrlSize
|
|
1917
1909
|
},
|
|
1918
1910
|
bottomLeft: {
|
|
1919
1911
|
type: "bottom-left",
|
|
1920
1912
|
vertexes: bottomLeftVertexes,
|
|
1921
|
-
center: bottomLeftCenter
|
|
1913
|
+
center: bottomLeftCenter,
|
|
1914
|
+
size: ctrlSize
|
|
1922
1915
|
},
|
|
1923
1916
|
bottomRight: {
|
|
1924
1917
|
type: "bottom-right",
|
|
1925
1918
|
vertexes: bottomRightVertexes,
|
|
1926
|
-
center: bottomRightCenter
|
|
1919
|
+
center: bottomRightCenter,
|
|
1920
|
+
size: ctrlSize
|
|
1927
1921
|
},
|
|
1928
1922
|
leftMiddle: {
|
|
1929
1923
|
type: "left-middle",
|
|
1930
1924
|
vertexes: leftMiddleVertexes,
|
|
1931
|
-
center: leftCenter
|
|
1925
|
+
center: leftCenter,
|
|
1926
|
+
size: ctrlSize
|
|
1932
1927
|
},
|
|
1933
1928
|
rightMiddle: {
|
|
1934
1929
|
type: "right-middle",
|
|
1935
1930
|
vertexes: rightMiddleVertexes,
|
|
1936
|
-
center: rightCenter
|
|
1931
|
+
center: rightCenter,
|
|
1932
|
+
size: ctrlSize
|
|
1937
1933
|
},
|
|
1938
1934
|
topMiddle: {
|
|
1939
1935
|
type: "top-middle",
|
|
1940
1936
|
vertexes: topMiddleVertexes,
|
|
1941
|
-
center: topCenter
|
|
1937
|
+
center: topCenter,
|
|
1938
|
+
size: ctrlSize
|
|
1942
1939
|
},
|
|
1943
1940
|
bottomMiddle: {
|
|
1944
1941
|
type: "bottom-middle",
|
|
1945
1942
|
vertexes: bottomMiddleVertexes,
|
|
1946
|
-
center: bottomCenter
|
|
1943
|
+
center: bottomCenter,
|
|
1944
|
+
size: ctrlSize
|
|
1947
1945
|
}
|
|
1948
1946
|
};
|
|
1949
1947
|
return sizeController;
|
|
@@ -2095,18 +2093,13 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2095
2093
|
function resizeElement$1(elem, opts) {
|
|
2096
2094
|
const { type } = elem;
|
|
2097
2095
|
resizeElementBase(elem, opts);
|
|
2098
|
-
if (type === "circle")
|
|
2099
|
-
;
|
|
2096
|
+
if (type === "circle") ;
|
|
2100
2097
|
else if (type === "text") {
|
|
2101
2098
|
resizeTextElementDetail(elem, opts);
|
|
2102
|
-
} else if (type === "image")
|
|
2103
|
-
|
|
2104
|
-
else if (type === "
|
|
2105
|
-
|
|
2106
|
-
else if (type === "html")
|
|
2107
|
-
;
|
|
2108
|
-
else if (type === "path")
|
|
2109
|
-
;
|
|
2099
|
+
} else if (type === "image") ;
|
|
2100
|
+
else if (type === "svg") ;
|
|
2101
|
+
else if (type === "html") ;
|
|
2102
|
+
else if (type === "path") ;
|
|
2110
2103
|
else if (type === "group" && Array.isArray(elem.detail.children)) {
|
|
2111
2104
|
elem.detail.children.forEach((child) => {
|
|
2112
2105
|
resizeElement$1(child, opts);
|
|
@@ -2140,9 +2133,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2140
2133
|
}
|
|
2141
2134
|
(function(s, e) {
|
|
2142
2135
|
var t = {};
|
|
2143
|
-
for (var p in s)
|
|
2144
|
-
|
|
2145
|
-
t[p] = s[p];
|
|
2136
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2137
|
+
t[p] = s[p];
|
|
2146
2138
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2147
2139
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2148
2140
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
@@ -2873,9 +2865,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2873
2865
|
}
|
|
2874
2866
|
var __rest = function(s, e) {
|
|
2875
2867
|
var t = {};
|
|
2876
|
-
for (var p in s)
|
|
2877
|
-
|
|
2878
|
-
t[p] = s[p];
|
|
2868
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2869
|
+
t[p] = s[p];
|
|
2879
2870
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2880
2871
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2881
2872
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
@@ -3191,19 +3182,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3191
3182
|
});
|
|
3192
3183
|
};
|
|
3193
3184
|
var __classPrivateFieldGet$6 = function(receiver, state, kind, f) {
|
|
3194
|
-
if (kind === "a" && !f)
|
|
3195
|
-
|
|
3196
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3197
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3185
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3186
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3198
3187
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3199
3188
|
};
|
|
3200
3189
|
var __classPrivateFieldSet$6 = function(receiver, state, value, kind, f) {
|
|
3201
|
-
if (kind === "m")
|
|
3202
|
-
|
|
3203
|
-
if (
|
|
3204
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
3205
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3206
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3190
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3191
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
3192
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3207
3193
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3208
3194
|
};
|
|
3209
3195
|
var _Loader_instances, _Loader_loadFuncMap, _Loader_currentLoadItemMap, _Loader_storageLoadItemMap, _Loader_hasDestroyed, _Loader_registerLoadFunc, _Loader_getLoadElementSource, _Loader_createLoadItem, _Loader_emitLoad, _Loader_emitError, _Loader_loadResource, _Loader_isExistingErrorStorage;
|
|
@@ -3245,8 +3231,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3245
3231
|
};
|
|
3246
3232
|
}));
|
|
3247
3233
|
__classPrivateFieldGet$6(this, _Loader_instances, "m", _Loader_registerLoadFunc).call(this, "html", (elem, assets) => __awaiter(this, void 0, void 0, function* () {
|
|
3248
|
-
var
|
|
3249
|
-
const html2 = ((
|
|
3234
|
+
var _a;
|
|
3235
|
+
const html2 = ((_a = assets[elem.detail.html]) === null || _a === void 0 ? void 0 : _a.value) || elem.detail.html;
|
|
3250
3236
|
const content = yield loadHTML(html2, {
|
|
3251
3237
|
width: elem.detail.originW || elem.w,
|
|
3252
3238
|
height: elem.detail.originH || elem.h
|
|
@@ -3258,8 +3244,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3258
3244
|
};
|
|
3259
3245
|
}));
|
|
3260
3246
|
__classPrivateFieldGet$6(this, _Loader_instances, "m", _Loader_registerLoadFunc).call(this, "svg", (elem, assets) => __awaiter(this, void 0, void 0, function* () {
|
|
3261
|
-
var
|
|
3262
|
-
const svg2 = ((
|
|
3247
|
+
var _a;
|
|
3248
|
+
const svg2 = ((_a = assets[elem.detail.svg]) === null || _a === void 0 ? void 0 : _a.value) || elem.detail.svg;
|
|
3263
3249
|
const content = yield loadSVG(svg2);
|
|
3264
3250
|
return {
|
|
3265
3251
|
uuid: elem.uuid,
|
|
@@ -3388,19 +3374,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3388
3374
|
return false;
|
|
3389
3375
|
};
|
|
3390
3376
|
var __classPrivateFieldSet$5 = function(receiver, state, value, kind, f) {
|
|
3391
|
-
if (kind === "m")
|
|
3392
|
-
|
|
3393
|
-
if (
|
|
3394
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
3395
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3396
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3377
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3378
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
3379
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3397
3380
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3398
3381
|
};
|
|
3399
3382
|
var __classPrivateFieldGet$5 = function(receiver, state, kind, f) {
|
|
3400
|
-
if (kind === "a" && !f)
|
|
3401
|
-
|
|
3402
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3403
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3383
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3384
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3404
3385
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3405
3386
|
};
|
|
3406
3387
|
var _Renderer_instances, _Renderer_opts, _Renderer_loader, _Renderer_hasDestroyed, _Renderer_init;
|
|
@@ -3500,19 +3481,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3500
3481
|
});
|
|
3501
3482
|
};
|
|
3502
3483
|
var __classPrivateFieldSet$4 = function(receiver, state, value, kind, f) {
|
|
3503
|
-
if (kind === "m")
|
|
3504
|
-
|
|
3505
|
-
if (
|
|
3506
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
3507
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3508
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3484
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3485
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
3486
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3509
3487
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3510
3488
|
};
|
|
3511
3489
|
var __classPrivateFieldGet$4 = function(receiver, state, kind, f) {
|
|
3512
|
-
if (kind === "a" && !f)
|
|
3513
|
-
|
|
3514
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3515
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3490
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3491
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3516
3492
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3517
3493
|
};
|
|
3518
3494
|
var _Calculator_opts, _Calculator_store;
|
|
@@ -3674,19 +3650,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3674
3650
|
}
|
|
3675
3651
|
_Calculator_opts = /* @__PURE__ */ new WeakMap(), _Calculator_store = /* @__PURE__ */ new WeakMap();
|
|
3676
3652
|
var __classPrivateFieldSet$3 = function(receiver, state, value, kind, f) {
|
|
3677
|
-
if (kind === "m")
|
|
3678
|
-
|
|
3679
|
-
if (
|
|
3680
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
3681
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3682
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3653
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3654
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
3655
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3683
3656
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3684
3657
|
};
|
|
3685
3658
|
var __classPrivateFieldGet$3 = function(receiver, state, kind, f) {
|
|
3686
|
-
if (kind === "a" && !f)
|
|
3687
|
-
|
|
3688
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3689
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3659
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3660
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3690
3661
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3691
3662
|
};
|
|
3692
3663
|
var _BoardWatcher_instances, _BoardWatcher_opts, _BoardWatcher_store, _BoardWatcher_hasDestroyed, _BoardWatcher_init, _BoardWatcher_onWheel, _BoardWatcher_onContextMenu, _BoardWatcher_onClick, _BoardWatcher_onPointLeave, _BoardWatcher_onPointEnd, _BoardWatcher_onPointMove, _BoardWatcher_onPointStart, _BoardWatcher_onHover, _BoardWatcher_isInTarget, _BoardWatcher_getPoint, _BoardWatcher_isVaildPoint;
|
|
@@ -3752,9 +3723,6 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3752
3723
|
});
|
|
3753
3724
|
_BoardWatcher_onPointLeave.set(this, (e) => {
|
|
3754
3725
|
__classPrivateFieldGet$3(this, _BoardWatcher_store, "f").set("hasPointDown", false);
|
|
3755
|
-
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
3756
|
-
return;
|
|
3757
|
-
}
|
|
3758
3726
|
e.preventDefault();
|
|
3759
3727
|
const point = __classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
3760
3728
|
this.trigger("pointLeave", { point });
|
|
@@ -3804,8 +3772,13 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3804
3772
|
});
|
|
3805
3773
|
_BoardWatcher_onHover.set(this, (e) => {
|
|
3806
3774
|
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
3775
|
+
if (__classPrivateFieldGet$3(this, _BoardWatcher_store, "f").get("inCanvas") === true) {
|
|
3776
|
+
__classPrivateFieldGet$3(this, _BoardWatcher_store, "f").set("inCanvas", false);
|
|
3777
|
+
__classPrivateFieldGet$3(this, _BoardWatcher_onPointLeave, "f").call(this, e);
|
|
3778
|
+
}
|
|
3807
3779
|
return;
|
|
3808
3780
|
}
|
|
3781
|
+
__classPrivateFieldGet$3(this, _BoardWatcher_store, "f").set("inCanvas", true);
|
|
3809
3782
|
e.preventDefault();
|
|
3810
3783
|
const point = __classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
3811
3784
|
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isVaildPoint).call(this, point)) {
|
|
@@ -3813,7 +3786,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3813
3786
|
}
|
|
3814
3787
|
this.trigger("hover", { point });
|
|
3815
3788
|
});
|
|
3816
|
-
const store = new Store({ defaultStorage: { hasPointDown: false, prevClickPoint: null } });
|
|
3789
|
+
const store = new Store({ defaultStorage: { hasPointDown: false, prevClickPoint: null, inCanvas: true } });
|
|
3817
3790
|
__classPrivateFieldSet$3(this, _BoardWatcher_store, store, "f");
|
|
3818
3791
|
__classPrivateFieldSet$3(this, _BoardWatcher_opts, opts, "f");
|
|
3819
3792
|
__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_init).call(this);
|
|
@@ -3827,7 +3800,6 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3827
3800
|
container.addEventListener("mousedown", __classPrivateFieldGet$3(this, _BoardWatcher_onPointStart, "f"));
|
|
3828
3801
|
container.addEventListener("mousemove", __classPrivateFieldGet$3(this, _BoardWatcher_onPointMove, "f"));
|
|
3829
3802
|
container.addEventListener("mouseup", __classPrivateFieldGet$3(this, _BoardWatcher_onPointEnd, "f"));
|
|
3830
|
-
container.addEventListener("mouseleave", __classPrivateFieldGet$3(this, _BoardWatcher_onPointLeave, "f"));
|
|
3831
3803
|
container.addEventListener("wheel", __classPrivateFieldGet$3(this, _BoardWatcher_onWheel, "f"), { passive: false });
|
|
3832
3804
|
container.addEventListener("click", __classPrivateFieldGet$3(this, _BoardWatcher_onClick, "f"));
|
|
3833
3805
|
container.addEventListener("contextmenu", __classPrivateFieldGet$3(this, _BoardWatcher_onContextMenu, "f"));
|
|
@@ -3871,19 +3843,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3871
3843
|
return false;
|
|
3872
3844
|
};
|
|
3873
3845
|
var __classPrivateFieldSet$2 = function(receiver, state, value, kind, f) {
|
|
3874
|
-
if (kind === "m")
|
|
3875
|
-
|
|
3876
|
-
if (
|
|
3877
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
3878
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3879
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3846
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3847
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
3848
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3880
3849
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3881
3850
|
};
|
|
3882
3851
|
var __classPrivateFieldGet$2 = function(receiver, state, kind, f) {
|
|
3883
|
-
if (kind === "a" && !f)
|
|
3884
|
-
|
|
3885
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3886
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3852
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3853
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3887
3854
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3888
3855
|
};
|
|
3889
3856
|
var _Sharer_activeStore, _Sharer_sharedStore;
|
|
@@ -3976,19 +3943,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3976
3943
|
}
|
|
3977
3944
|
_Sharer_activeStore = /* @__PURE__ */ new WeakMap(), _Sharer_sharedStore = /* @__PURE__ */ new WeakMap();
|
|
3978
3945
|
var __classPrivateFieldSet$1 = function(receiver, state, value, kind, f) {
|
|
3979
|
-
if (kind === "m")
|
|
3980
|
-
|
|
3981
|
-
if (
|
|
3982
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
3983
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3984
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3946
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3947
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
3948
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3985
3949
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3986
3950
|
};
|
|
3987
3951
|
var __classPrivateFieldGet$1 = function(receiver, state, kind, f) {
|
|
3988
|
-
if (kind === "a" && !f)
|
|
3989
|
-
|
|
3990
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3991
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3952
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3953
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3992
3954
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3993
3955
|
};
|
|
3994
3956
|
var _Viewer_instances, _Viewer_opts, _Viewer_drawFrameSnapshotQueue, _Viewer_drawFrameStatus, _Viewer_init, _Viewer_drawAnimationFrame;
|
|
@@ -4144,22 +4106,17 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4144
4106
|
}
|
|
4145
4107
|
};
|
|
4146
4108
|
var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
|
|
4147
|
-
if (kind === "m")
|
|
4148
|
-
|
|
4149
|
-
if (
|
|
4150
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
4151
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
4152
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
4109
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4110
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4111
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
4153
4112
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
4154
4113
|
};
|
|
4155
4114
|
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
4156
|
-
if (kind === "a" && !f)
|
|
4157
|
-
|
|
4158
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
4159
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4115
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4116
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4160
4117
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
4161
4118
|
};
|
|
4162
|
-
var _Board_instances, _Board_opts, _Board_middlewareMap, _Board_middlewares, _Board_activeMiddlewareObjs, _Board_watcher, _Board_renderer, _Board_sharer, _Board_viewer, _Board_calculator, _Board_eventHub, _Board_hasDestroyed, _Board_init, _Board_handlePointStart, _Board_handlePointEnd, _Board_handlePointMove, _Board_handleHover, _Board_handleDoubleClick, _Board_handleContextMenu, _Board_handleWheel, _Board_handleWheelScale, _Board_handleScrollX, _Board_handleScrollY, _Board_handleResize, _Board_handleClear, _Board_handleBeforeDrawFrame, _Board_handleAfterDrawFrame, _Board_resetActiveMiddlewareObjs;
|
|
4119
|
+
var _Board_instances, _Board_opts, _Board_middlewareMap, _Board_middlewares, _Board_activeMiddlewareObjs, _Board_watcher, _Board_renderer, _Board_sharer, _Board_viewer, _Board_calculator, _Board_eventHub, _Board_hasDestroyed, _Board_init, _Board_handlePointStart, _Board_handlePointEnd, _Board_handlePointMove, _Board_handlePointLeave, _Board_handleHover, _Board_handleDoubleClick, _Board_handleContextMenu, _Board_handleWheel, _Board_handleWheelScale, _Board_handleScrollX, _Board_handleScrollY, _Board_handleResize, _Board_handleClear, _Board_handleBeforeDrawFrame, _Board_handleAfterDrawFrame, _Board_resetActiveMiddlewareObjs;
|
|
4163
4120
|
class Board {
|
|
4164
4121
|
constructor(opts) {
|
|
4165
4122
|
_Board_instances.add(this);
|
|
@@ -4345,6 +4302,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4345
4302
|
__classPrivateFieldGet(this, _Board_watcher, "f").on("pointStart", __classPrivateFieldGet(this, _Board_instances, "m", _Board_handlePointStart).bind(this));
|
|
4346
4303
|
__classPrivateFieldGet(this, _Board_watcher, "f").on("pointEnd", __classPrivateFieldGet(this, _Board_instances, "m", _Board_handlePointEnd).bind(this));
|
|
4347
4304
|
__classPrivateFieldGet(this, _Board_watcher, "f").on("pointMove", __classPrivateFieldGet(this, _Board_instances, "m", _Board_handlePointMove).bind(this));
|
|
4305
|
+
__classPrivateFieldGet(this, _Board_watcher, "f").on("pointLeave", __classPrivateFieldGet(this, _Board_instances, "m", _Board_handlePointLeave).bind(this));
|
|
4348
4306
|
__classPrivateFieldGet(this, _Board_watcher, "f").on("hover", __classPrivateFieldGet(this, _Board_instances, "m", _Board_handleHover).bind(this));
|
|
4349
4307
|
__classPrivateFieldGet(this, _Board_watcher, "f").on("wheel", __classPrivateFieldGet(this, _Board_instances, "m", _Board_handleWheel).bind(this));
|
|
4350
4308
|
__classPrivateFieldGet(this, _Board_watcher, "f").on("wheelScale", __classPrivateFieldGet(this, _Board_instances, "m", _Board_handleWheelScale).bind(this));
|
|
@@ -4383,6 +4341,15 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4383
4341
|
return;
|
|
4384
4342
|
}
|
|
4385
4343
|
}
|
|
4344
|
+
}, _Board_handlePointLeave = function _Board_handlePointLeave2(e) {
|
|
4345
|
+
var _a;
|
|
4346
|
+
for (let i = 0; i < __classPrivateFieldGet(this, _Board_activeMiddlewareObjs, "f").length; i++) {
|
|
4347
|
+
const obj = __classPrivateFieldGet(this, _Board_activeMiddlewareObjs, "f")[i];
|
|
4348
|
+
const result = (_a = obj === null || obj === void 0 ? void 0 : obj.pointLeave) === null || _a === void 0 ? void 0 : _a.call(obj, e);
|
|
4349
|
+
if (result === false) {
|
|
4350
|
+
return;
|
|
4351
|
+
}
|
|
4352
|
+
}
|
|
4386
4353
|
}, _Board_handleHover = function _Board_handleHover2(e) {
|
|
4387
4354
|
var _a;
|
|
4388
4355
|
for (let i = 0; i < __classPrivateFieldGet(this, _Board_activeMiddlewareObjs, "f").length; i++) {
|
|
@@ -4530,13 +4497,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4530
4497
|
});
|
|
4531
4498
|
class Cursor {
|
|
4532
4499
|
constructor(container, opts) {
|
|
4533
|
-
__privateAdd(this,
|
|
4534
|
-
__privateAdd(this,
|
|
4535
|
-
__privateAdd(this,
|
|
4536
|
-
__privateAdd(this, _setCursorResize);
|
|
4537
|
-
__privateAdd(this, _appendRotateResizeImage);
|
|
4538
|
-
__privateAdd(this, _eventHub, void 0);
|
|
4539
|
-
__privateAdd(this, _container, void 0);
|
|
4500
|
+
__privateAdd(this, _Cursor_instances);
|
|
4501
|
+
__privateAdd(this, _eventHub);
|
|
4502
|
+
__privateAdd(this, _container);
|
|
4540
4503
|
__privateAdd(this, _cursorType, null);
|
|
4541
4504
|
__privateAdd(this, _resizeCursorBaseImage, null);
|
|
4542
4505
|
__privateAdd(this, _cursorImageMap, {
|
|
@@ -4548,8 +4511,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4548
4511
|
});
|
|
4549
4512
|
__privateSet(this, _container, container);
|
|
4550
4513
|
__privateSet(this, _eventHub, opts.eventHub);
|
|
4551
|
-
__privateMethod(this,
|
|
4552
|
-
__privateMethod(this,
|
|
4514
|
+
__privateMethod(this, _Cursor_instances, init_fn).call(this);
|
|
4515
|
+
__privateMethod(this, _Cursor_instances, loadResizeCursorBaseImage_fn).call(this);
|
|
4553
4516
|
}
|
|
4554
4517
|
}
|
|
4555
4518
|
_eventHub = new WeakMap();
|
|
@@ -4557,28 +4520,27 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4557
4520
|
_cursorType = new WeakMap();
|
|
4558
4521
|
_resizeCursorBaseImage = new WeakMap();
|
|
4559
4522
|
_cursorImageMap = new WeakMap();
|
|
4560
|
-
|
|
4523
|
+
_Cursor_instances = new WeakSet();
|
|
4561
4524
|
init_fn = function() {
|
|
4562
4525
|
const eventHub = __privateGet(this, _eventHub);
|
|
4563
|
-
__privateMethod(this,
|
|
4526
|
+
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, "default");
|
|
4564
4527
|
eventHub.on(coreEventKeys.CURSOR, (e) => {
|
|
4565
4528
|
var _a;
|
|
4566
4529
|
if (e.type === "over-element" || !e.type) {
|
|
4567
|
-
__privateMethod(this,
|
|
4530
|
+
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, "auto");
|
|
4568
4531
|
} else if (e.type === "resize-rotate") {
|
|
4569
|
-
__privateMethod(this,
|
|
4532
|
+
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, "rotate");
|
|
4570
4533
|
} else if (typeof e.type === "string" && ((_a = e.type) == null ? void 0 : _a.startsWith("resize-"))) {
|
|
4571
|
-
__privateMethod(this,
|
|
4534
|
+
__privateMethod(this, _Cursor_instances, setCursorResize_fn).call(this, e);
|
|
4572
4535
|
} else if (e.type === "drag-default") {
|
|
4573
|
-
__privateMethod(this,
|
|
4536
|
+
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, "drag-default");
|
|
4574
4537
|
} else if (e.type === "drag-active") {
|
|
4575
|
-
__privateMethod(this,
|
|
4538
|
+
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, "drag-active");
|
|
4576
4539
|
} else {
|
|
4577
|
-
__privateMethod(this,
|
|
4540
|
+
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, "auto");
|
|
4578
4541
|
}
|
|
4579
4542
|
});
|
|
4580
4543
|
};
|
|
4581
|
-
_loadResizeCursorBaseImage = new WeakSet();
|
|
4582
4544
|
loadResizeCursorBaseImage_fn = function() {
|
|
4583
4545
|
loadImage(CURSOR_RESIZE).then((img) => {
|
|
4584
4546
|
__privateSet(this, _resizeCursorBaseImage, img);
|
|
@@ -4586,7 +4548,6 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4586
4548
|
console.error(err);
|
|
4587
4549
|
});
|
|
4588
4550
|
};
|
|
4589
|
-
_resetCursor = new WeakSet();
|
|
4590
4551
|
resetCursor_fn = function(cursorKey) {
|
|
4591
4552
|
if (__privateGet(this, _cursorType) === cursorKey) {
|
|
4592
4553
|
return;
|
|
@@ -4608,7 +4569,6 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4608
4569
|
__privateGet(this, _container).style.cursor = `image-set(url(${image})2x) ${offsetX} ${offsetY}, auto`;
|
|
4609
4570
|
}
|
|
4610
4571
|
};
|
|
4611
|
-
_setCursorResize = new WeakSet();
|
|
4612
4572
|
setCursorResize_fn = function(e) {
|
|
4613
4573
|
var _a;
|
|
4614
4574
|
let totalAngle = 0;
|
|
@@ -4636,10 +4596,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4636
4596
|
});
|
|
4637
4597
|
}
|
|
4638
4598
|
totalAngle = limitAngle(totalAngle);
|
|
4639
|
-
const cursorKey = __privateMethod(this,
|
|
4640
|
-
__privateMethod(this,
|
|
4599
|
+
const cursorKey = __privateMethod(this, _Cursor_instances, appendRotateResizeImage_fn).call(this, totalAngle);
|
|
4600
|
+
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, cursorKey);
|
|
4641
4601
|
};
|
|
4642
|
-
_appendRotateResizeImage = new WeakSet();
|
|
4643
4602
|
appendRotateResizeImage_fn = function(angle2) {
|
|
4644
4603
|
const key2 = `rotate-${angle2}`;
|
|
4645
4604
|
if (!__privateGet(this, _cursorImageMap)[key2]) {
|
|
@@ -4689,6 +4648,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4689
4648
|
const resizeControllerBorderWidth = 4;
|
|
4690
4649
|
const areaBorderWidth = 1;
|
|
4691
4650
|
const controllerSize$1 = 10;
|
|
4651
|
+
const rotateControllerSize = 20;
|
|
4652
|
+
const rotateControllerPosition = 22;
|
|
4692
4653
|
const activeColor = "#1973ba";
|
|
4693
4654
|
const activeAreaColor = "#1976d21c";
|
|
4694
4655
|
const lockedColor = "#5b5959b5";
|
|
@@ -4836,21 +4797,35 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4836
4797
|
}
|
|
4837
4798
|
const {
|
|
4838
4799
|
hideControllers,
|
|
4839
|
-
style
|
|
4800
|
+
style,
|
|
4801
|
+
rotateControllerPattern,
|
|
4802
|
+
viewSizeInfo
|
|
4840
4803
|
// calculator, element, viewScaleInfo, viewSizeInfo
|
|
4841
4804
|
} = opts;
|
|
4805
|
+
const { devicePixelRatio = 1 } = viewSizeInfo;
|
|
4842
4806
|
const { activeColor: activeColor2 } = style;
|
|
4843
|
-
const { elementWrapper, topLeft, topRight, bottomLeft, bottomRight,
|
|
4807
|
+
const { elementWrapper, topLeft, topRight, bottomLeft, bottomRight, rotate } = controller;
|
|
4844
4808
|
const wrapperOpts = { borderColor: activeColor2, borderWidth: selectWrapperBorderWidth, background: "transparent", lineDash: [] };
|
|
4845
4809
|
const ctrlOpts = { ...wrapperOpts, borderWidth: resizeControllerBorderWidth, background: "#FFFFFF" };
|
|
4846
4810
|
drawVertexes(ctx, calcViewVertexes(elementWrapper, opts), wrapperOpts);
|
|
4847
4811
|
if (!hideControllers) {
|
|
4848
|
-
drawLine(ctx, calcViewPointSize(top.center, opts), calcViewPointSize(rotate.center, opts), { ...ctrlOpts, borderWidth: 2 });
|
|
4849
4812
|
drawVertexes(ctx, calcViewVertexes(topLeft.vertexes, opts), ctrlOpts);
|
|
4850
4813
|
drawVertexes(ctx, calcViewVertexes(topRight.vertexes, opts), ctrlOpts);
|
|
4851
4814
|
drawVertexes(ctx, calcViewVertexes(bottomLeft.vertexes, opts), ctrlOpts);
|
|
4852
4815
|
drawVertexes(ctx, calcViewVertexes(bottomRight.vertexes, opts), ctrlOpts);
|
|
4853
|
-
drawCircleController(ctx, calcViewPointSize(rotate.center, opts), { ...ctrlOpts, size:
|
|
4816
|
+
drawCircleController(ctx, calcViewPointSize(rotate.center, opts), { ...ctrlOpts, size: rotate.size, borderWidth: 0 });
|
|
4817
|
+
const rotateCenter = calcViewPointSize(rotate.center, opts);
|
|
4818
|
+
ctx.drawImage(
|
|
4819
|
+
rotateControllerPattern.canvas,
|
|
4820
|
+
0,
|
|
4821
|
+
0,
|
|
4822
|
+
rotateControllerPattern.canvas.width / devicePixelRatio,
|
|
4823
|
+
rotateControllerPattern.canvas.height / devicePixelRatio,
|
|
4824
|
+
rotateCenter.x - rotate.size / 2,
|
|
4825
|
+
rotateCenter.y - rotate.size / 2,
|
|
4826
|
+
rotate.size,
|
|
4827
|
+
rotate.size
|
|
4828
|
+
);
|
|
4854
4829
|
}
|
|
4855
4830
|
}
|
|
4856
4831
|
function drawArea(ctx, opts) {
|
|
@@ -5564,7 +5539,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5564
5539
|
});
|
|
5565
5540
|
const startAngle = limitAngle(angle2);
|
|
5566
5541
|
const changedRadian = calcRadian(elemCenter, start, end);
|
|
5567
|
-
const endAngle = startAngle + parseRadianToAngle(changedRadian);
|
|
5542
|
+
const endAngle = limitAngle(startAngle + parseRadianToAngle(changedRadian));
|
|
5568
5543
|
return {
|
|
5569
5544
|
x: x2,
|
|
5570
5545
|
y: y2,
|
|
@@ -6344,72 +6319,521 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6344
6319
|
}
|
|
6345
6320
|
};
|
|
6346
6321
|
};
|
|
6347
|
-
const
|
|
6348
|
-
const
|
|
6349
|
-
|
|
6350
|
-
|
|
6322
|
+
const createIconRotate = (opts) => {
|
|
6323
|
+
const iconRotate = {
|
|
6324
|
+
uuid: createUUID(),
|
|
6325
|
+
type: "path",
|
|
6326
|
+
x: 0,
|
|
6327
|
+
y: 0,
|
|
6328
|
+
w: 200,
|
|
6329
|
+
h: 200,
|
|
6330
|
+
detail: {
|
|
6331
|
+
commands: [
|
|
6332
|
+
{
|
|
6333
|
+
type: "M",
|
|
6334
|
+
params: [512, 0]
|
|
6335
|
+
},
|
|
6336
|
+
{
|
|
6337
|
+
type: "c",
|
|
6338
|
+
params: [282.8, 0, 512, 229.2, 512, 512]
|
|
6339
|
+
},
|
|
6340
|
+
{
|
|
6341
|
+
type: "s",
|
|
6342
|
+
params: [-229.2, 512, -512, 512]
|
|
6343
|
+
},
|
|
6344
|
+
{
|
|
6345
|
+
type: "S",
|
|
6346
|
+
params: [0, 794.8, 0, 512, 229.2, 0, 512, 0]
|
|
6347
|
+
},
|
|
6348
|
+
{
|
|
6349
|
+
type: "z",
|
|
6350
|
+
params: []
|
|
6351
|
+
},
|
|
6352
|
+
{
|
|
6353
|
+
type: "m",
|
|
6354
|
+
params: [309.8, 253.8]
|
|
6355
|
+
},
|
|
6356
|
+
{
|
|
6357
|
+
type: "c",
|
|
6358
|
+
params: [0, -10.5, -6.5, -19.8, -15.7, -23.8, -9.7, -4, -21, -2, -28.2, 5.6]
|
|
6359
|
+
},
|
|
6360
|
+
{
|
|
6361
|
+
type: "l",
|
|
6362
|
+
params: [-52.5, 52]
|
|
6363
|
+
},
|
|
6364
|
+
{
|
|
6365
|
+
type: "c",
|
|
6366
|
+
params: [
|
|
6367
|
+
-56.9,
|
|
6368
|
+
-53.7,
|
|
6369
|
+
-133.9,
|
|
6370
|
+
-85.5,
|
|
6371
|
+
-213.4,
|
|
6372
|
+
-85.5,
|
|
6373
|
+
-170.7,
|
|
6374
|
+
0,
|
|
6375
|
+
-309.8,
|
|
6376
|
+
139.2,
|
|
6377
|
+
-309.8,
|
|
6378
|
+
309.8,
|
|
6379
|
+
0,
|
|
6380
|
+
170.6,
|
|
6381
|
+
139.2,
|
|
6382
|
+
309.8,
|
|
6383
|
+
309.8,
|
|
6384
|
+
309.8,
|
|
6385
|
+
92.4,
|
|
6386
|
+
0,
|
|
6387
|
+
179.5,
|
|
6388
|
+
-40.8,
|
|
6389
|
+
238.4,
|
|
6390
|
+
-111.8,
|
|
6391
|
+
4,
|
|
6392
|
+
-5.2,
|
|
6393
|
+
4,
|
|
6394
|
+
-12.9,
|
|
6395
|
+
-0.8,
|
|
6396
|
+
-17.3
|
|
6397
|
+
]
|
|
6398
|
+
},
|
|
6399
|
+
{
|
|
6400
|
+
type: "L",
|
|
6401
|
+
params: [694.3, 637]
|
|
6402
|
+
},
|
|
6403
|
+
{
|
|
6404
|
+
type: "c",
|
|
6405
|
+
params: [
|
|
6406
|
+
-2.8,
|
|
6407
|
+
-2.4,
|
|
6408
|
+
-6.5,
|
|
6409
|
+
-3.6,
|
|
6410
|
+
-10.1,
|
|
6411
|
+
-3.6,
|
|
6412
|
+
-3.6,
|
|
6413
|
+
0.4,
|
|
6414
|
+
-7.3,
|
|
6415
|
+
2,
|
|
6416
|
+
-9.3,
|
|
6417
|
+
4.8,
|
|
6418
|
+
-39.5,
|
|
6419
|
+
51.2,
|
|
6420
|
+
-98.8,
|
|
6421
|
+
80.3,
|
|
6422
|
+
-163,
|
|
6423
|
+
80.3,
|
|
6424
|
+
-113.8,
|
|
6425
|
+
0,
|
|
6426
|
+
-206.5,
|
|
6427
|
+
-92.8,
|
|
6428
|
+
-206.5,
|
|
6429
|
+
-206.5,
|
|
6430
|
+
0,
|
|
6431
|
+
-113.8,
|
|
6432
|
+
92.8,
|
|
6433
|
+
-206.5,
|
|
6434
|
+
206.5,
|
|
6435
|
+
-206.5,
|
|
6436
|
+
52.8,
|
|
6437
|
+
0,
|
|
6438
|
+
102.9,
|
|
6439
|
+
20.2,
|
|
6440
|
+
140.8,
|
|
6441
|
+
55.3
|
|
6442
|
+
]
|
|
6443
|
+
},
|
|
6444
|
+
{
|
|
6445
|
+
type: "L",
|
|
6446
|
+
params: [597, 416.5]
|
|
6447
|
+
},
|
|
6448
|
+
{
|
|
6449
|
+
type: "c",
|
|
6450
|
+
params: [-7.7, 7.3, -9.7, 18.6, -5.6, 27.9, 4, 9.7, 13.3, 16.1, 23.8, 16.1]
|
|
6451
|
+
},
|
|
6452
|
+
{
|
|
6453
|
+
type: "H",
|
|
6454
|
+
params: [796]
|
|
6455
|
+
},
|
|
6456
|
+
{
|
|
6457
|
+
type: "c",
|
|
6458
|
+
params: [14.1, 0, 25.8, -11.7, 25.8, -25.8]
|
|
6459
|
+
},
|
|
6460
|
+
{
|
|
6461
|
+
type: "V",
|
|
6462
|
+
params: [253.8]
|
|
6463
|
+
},
|
|
6464
|
+
{
|
|
6465
|
+
type: "z",
|
|
6466
|
+
params: []
|
|
6467
|
+
}
|
|
6468
|
+
],
|
|
6469
|
+
fill: "#2c2c2c",
|
|
6470
|
+
stroke: "transparent",
|
|
6471
|
+
strokeWidth: 0,
|
|
6472
|
+
originX: 0,
|
|
6473
|
+
originY: 0,
|
|
6474
|
+
originW: 1024,
|
|
6475
|
+
originH: 1024,
|
|
6476
|
+
opacity: 1,
|
|
6477
|
+
...opts
|
|
6478
|
+
}
|
|
6351
6479
|
};
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6480
|
+
return iconRotate;
|
|
6481
|
+
};
|
|
6482
|
+
function createRotateControllerPattern(opts) {
|
|
6483
|
+
const { fill, devicePixelRatio } = opts;
|
|
6484
|
+
const iconRotate = createIconRotate({ fill });
|
|
6485
|
+
const { w: w2, h: h2 } = iconRotate;
|
|
6486
|
+
const context2d = createOffscreenContext2D({
|
|
6487
|
+
width: w2,
|
|
6488
|
+
height: h2,
|
|
6489
|
+
devicePixelRatio
|
|
6490
|
+
});
|
|
6491
|
+
drawElement(context2d, iconRotate, {
|
|
6492
|
+
loader: void 0,
|
|
6493
|
+
viewScaleInfo: {
|
|
6494
|
+
scale: 1,
|
|
6495
|
+
offsetTop: 0,
|
|
6496
|
+
offsetBottom: 0,
|
|
6497
|
+
offsetLeft: 0,
|
|
6498
|
+
offsetRight: 0
|
|
6499
|
+
},
|
|
6500
|
+
viewSizeInfo: {
|
|
6501
|
+
width: w2,
|
|
6502
|
+
height: h2,
|
|
6503
|
+
devicePixelRatio,
|
|
6504
|
+
contextWidth: w2,
|
|
6505
|
+
contextHeight: h2
|
|
6506
|
+
},
|
|
6507
|
+
parentElementSize: {
|
|
6508
|
+
x: 0,
|
|
6509
|
+
y: 0,
|
|
6510
|
+
w: w2,
|
|
6511
|
+
h: h2
|
|
6512
|
+
},
|
|
6513
|
+
parentOpacity: 1
|
|
6514
|
+
});
|
|
6515
|
+
return context2d;
|
|
6516
|
+
}
|
|
6517
|
+
const fontFamily$1 = "monospace";
|
|
6518
|
+
function drawSizeInfoText(ctx, opts) {
|
|
6519
|
+
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
6520
|
+
const { textColor: textColor2, textBackground } = style;
|
|
6521
|
+
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
6522
|
+
ctx.$setFont({
|
|
6523
|
+
fontWeight: "300",
|
|
6524
|
+
fontSize: fontSize2,
|
|
6525
|
+
fontFamily: fontFamily$1
|
|
6526
|
+
});
|
|
6527
|
+
const padding = (lineHeight2 - fontSize2) / 2;
|
|
6528
|
+
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
6529
|
+
const bgStart = {
|
|
6530
|
+
x: point.x - textWidth / 2 - padding,
|
|
6531
|
+
y: point.y
|
|
6532
|
+
};
|
|
6533
|
+
const bgEnd = {
|
|
6534
|
+
x: bgStart.x + textWidth + padding * 2,
|
|
6535
|
+
y: bgStart.y + fontSize2 + padding
|
|
6536
|
+
};
|
|
6537
|
+
const textStart = {
|
|
6538
|
+
x: point.x - textWidth / 2,
|
|
6539
|
+
y: point.y
|
|
6540
|
+
};
|
|
6541
|
+
ctx.setLineDash([]);
|
|
6542
|
+
ctx.fillStyle = textBackground;
|
|
6543
|
+
ctx.beginPath();
|
|
6544
|
+
ctx.moveTo(bgStart.x, bgStart.y);
|
|
6545
|
+
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
6546
|
+
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
6547
|
+
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
6548
|
+
ctx.closePath();
|
|
6549
|
+
ctx.fill();
|
|
6550
|
+
ctx.fillStyle = textColor2;
|
|
6551
|
+
ctx.textBaseline = "top";
|
|
6552
|
+
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
6553
|
+
});
|
|
6554
|
+
}
|
|
6555
|
+
function drawPositionInfoText(ctx, opts) {
|
|
6556
|
+
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
6557
|
+
const { textBackground, textColor: textColor2 } = style;
|
|
6558
|
+
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
6559
|
+
ctx.$setFont({
|
|
6560
|
+
fontWeight: "300",
|
|
6561
|
+
fontSize: fontSize2,
|
|
6562
|
+
fontFamily: fontFamily$1
|
|
6563
|
+
});
|
|
6564
|
+
const padding = (lineHeight2 - fontSize2) / 2;
|
|
6565
|
+
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
6566
|
+
const bgStart = {
|
|
6567
|
+
x: point.x,
|
|
6568
|
+
y: point.y
|
|
6569
|
+
};
|
|
6570
|
+
const bgEnd = {
|
|
6571
|
+
x: bgStart.x + textWidth + padding * 2,
|
|
6572
|
+
y: bgStart.y + fontSize2 + padding
|
|
6573
|
+
};
|
|
6574
|
+
const textStart = {
|
|
6575
|
+
x: point.x + padding,
|
|
6576
|
+
y: point.y
|
|
6577
|
+
};
|
|
6578
|
+
ctx.setLineDash([]);
|
|
6579
|
+
ctx.fillStyle = textBackground;
|
|
6580
|
+
ctx.beginPath();
|
|
6581
|
+
ctx.moveTo(bgStart.x, bgStart.y);
|
|
6582
|
+
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
6583
|
+
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
6584
|
+
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
6585
|
+
ctx.closePath();
|
|
6586
|
+
ctx.fill();
|
|
6587
|
+
ctx.fillStyle = textColor2;
|
|
6588
|
+
ctx.textBaseline = "top";
|
|
6589
|
+
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
6590
|
+
});
|
|
6591
|
+
}
|
|
6592
|
+
function drawAngleInfoText(ctx, opts) {
|
|
6593
|
+
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
6594
|
+
const { textBackground, textColor: textColor2 } = style;
|
|
6595
|
+
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
6596
|
+
ctx.$setFont({
|
|
6597
|
+
fontWeight: "300",
|
|
6598
|
+
fontSize: fontSize2,
|
|
6599
|
+
fontFamily: fontFamily$1
|
|
6600
|
+
});
|
|
6601
|
+
const padding = (lineHeight2 - fontSize2) / 2;
|
|
6602
|
+
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
6603
|
+
const bgStart = {
|
|
6604
|
+
x: point.x,
|
|
6605
|
+
y: point.y
|
|
6606
|
+
};
|
|
6607
|
+
const bgEnd = {
|
|
6608
|
+
x: bgStart.x + textWidth + padding * 2,
|
|
6609
|
+
y: bgStart.y + fontSize2 + padding
|
|
6610
|
+
};
|
|
6611
|
+
const textStart = {
|
|
6612
|
+
x: point.x + padding,
|
|
6613
|
+
y: point.y
|
|
6614
|
+
};
|
|
6615
|
+
ctx.setLineDash([]);
|
|
6616
|
+
ctx.fillStyle = textBackground;
|
|
6617
|
+
ctx.beginPath();
|
|
6618
|
+
ctx.moveTo(bgStart.x, bgStart.y);
|
|
6619
|
+
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
6620
|
+
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
6621
|
+
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
6622
|
+
ctx.closePath();
|
|
6623
|
+
ctx.fill();
|
|
6624
|
+
ctx.fillStyle = textColor2;
|
|
6625
|
+
ctx.textBaseline = "top";
|
|
6626
|
+
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
6627
|
+
});
|
|
6628
|
+
}
|
|
6629
|
+
const infoBackground = "#1973bac6";
|
|
6630
|
+
const infoTextColor = "#ffffff";
|
|
6631
|
+
const MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE = "@middleware/internal-event/show-info-angle";
|
|
6632
|
+
const defaltStyle = {
|
|
6633
|
+
textBackground: infoBackground,
|
|
6634
|
+
textColor: infoTextColor
|
|
6635
|
+
};
|
|
6636
|
+
const infoFontSize = 10;
|
|
6637
|
+
const infoLineHeight = 16;
|
|
6638
|
+
const MiddlewareInfo = (opts, config) => {
|
|
6639
|
+
const { boardContent, calculator, eventHub } = opts;
|
|
6355
6640
|
const { overlayContext } = boardContent;
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
let inBusyMode = null;
|
|
6360
|
-
let hasChangedData = null;
|
|
6361
|
-
sharer.setSharedStorage(keyActionType, null);
|
|
6362
|
-
sharer.setSharedStorage(keyEnableSnapToGrid, true);
|
|
6363
|
-
const getActiveElements = () => {
|
|
6364
|
-
return sharer.getSharedStorage(keySelectedElementList);
|
|
6641
|
+
const innerConfig = {
|
|
6642
|
+
...defaltStyle,
|
|
6643
|
+
...config
|
|
6365
6644
|
};
|
|
6366
|
-
const
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
}
|
|
6371
|
-
if (groupQueue.length > 0) {
|
|
6372
|
-
if (isElementInGroup(elem, groupQueue[groupQueue.length - 1])) {
|
|
6373
|
-
groupQueue.push(elem);
|
|
6374
|
-
} else {
|
|
6375
|
-
groupQueue = [];
|
|
6376
|
-
}
|
|
6377
|
-
} else if (groupQueue.length === 0) {
|
|
6378
|
-
groupQueue.push(elem);
|
|
6379
|
-
}
|
|
6380
|
-
const vertexesList = calcElementQueueVertexesQueueInGroup(groupQueue);
|
|
6381
|
-
sharer.setSharedStorage(keyGroupQueue, groupQueue);
|
|
6382
|
-
sharer.setSharedStorage(keyGroupQueueVertexesList, vertexesList);
|
|
6383
|
-
return groupQueue.length > 0;
|
|
6645
|
+
const { textBackground, textColor: textColor2 } = innerConfig;
|
|
6646
|
+
const style = {
|
|
6647
|
+
textBackground,
|
|
6648
|
+
textColor: textColor2
|
|
6384
6649
|
};
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
if (elem) {
|
|
6389
|
-
vertexes = calcElementVertexesInGroup(elem, {
|
|
6390
|
-
groupQueue: sharer.getSharedStorage(keyGroupQueue)
|
|
6391
|
-
});
|
|
6392
|
-
}
|
|
6393
|
-
sharer.setSharedStorage(keyHoverElementVertexes, vertexes);
|
|
6650
|
+
let showAngleInfo = true;
|
|
6651
|
+
const showInfoAngleCallback = ({ show }) => {
|
|
6652
|
+
showAngleInfo = show;
|
|
6394
6653
|
};
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6654
|
+
return {
|
|
6655
|
+
name: "@middleware/info",
|
|
6656
|
+
use() {
|
|
6657
|
+
eventHub.on(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, showInfoAngleCallback);
|
|
6658
|
+
},
|
|
6659
|
+
disuse() {
|
|
6660
|
+
eventHub.off(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, showInfoAngleCallback);
|
|
6661
|
+
},
|
|
6662
|
+
beforeDrawFrame({ snapshot }) {
|
|
6663
|
+
const { sharedStore } = snapshot;
|
|
6664
|
+
const selectedElementList = sharedStore[keySelectedElementList];
|
|
6665
|
+
const actionType = sharedStore[keyActionType];
|
|
6666
|
+
const groupQueue = sharedStore[keyGroupQueue] || [];
|
|
6667
|
+
if (selectedElementList.length === 1) {
|
|
6668
|
+
const elem = selectedElementList[0];
|
|
6669
|
+
if (elem && ["select", "drag", "resize"].includes(actionType)) {
|
|
6670
|
+
const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
|
|
6671
|
+
const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
|
|
6672
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = elem;
|
|
6673
|
+
const totalGroupQueue = [
|
|
6674
|
+
...groupQueue,
|
|
6675
|
+
...[
|
|
6676
|
+
{
|
|
6677
|
+
uuid: createUUID(),
|
|
6678
|
+
x: x2,
|
|
6679
|
+
y: y2,
|
|
6680
|
+
w: w2,
|
|
6681
|
+
h: h2,
|
|
6682
|
+
angle: angle2,
|
|
6683
|
+
type: "group",
|
|
6684
|
+
detail: { children: [] }
|
|
6685
|
+
}
|
|
6686
|
+
]
|
|
6687
|
+
];
|
|
6688
|
+
const calcOpts = { viewScaleInfo, viewSizeInfo };
|
|
6689
|
+
const rangeRectInfo = calculator.calcViewRectInfoFromOrigin(elem.uuid, calcOpts);
|
|
6690
|
+
let totalAngle = 0;
|
|
6691
|
+
totalGroupQueue.forEach((group) => {
|
|
6692
|
+
totalAngle += group.angle || 0;
|
|
6693
|
+
});
|
|
6694
|
+
const totalRadian = parseAngleToRadian(limitAngle(0 - totalAngle));
|
|
6695
|
+
if (rangeRectInfo) {
|
|
6696
|
+
const elemCenter = rangeRectInfo == null ? void 0 : rangeRectInfo.center;
|
|
6697
|
+
const rectInfo = {
|
|
6698
|
+
topLeft: rotatePoint(elemCenter, rangeRectInfo.topLeft, totalRadian),
|
|
6699
|
+
topRight: rotatePoint(elemCenter, rangeRectInfo.topRight, totalRadian),
|
|
6700
|
+
bottomRight: rotatePoint(elemCenter, rangeRectInfo.bottomRight, totalRadian),
|
|
6701
|
+
bottomLeft: rotatePoint(elemCenter, rangeRectInfo.bottomLeft, totalRadian),
|
|
6702
|
+
center: rotatePoint(elemCenter, rangeRectInfo.center, totalRadian),
|
|
6703
|
+
top: rotatePoint(elemCenter, rangeRectInfo.top, totalRadian),
|
|
6704
|
+
right: rotatePoint(elemCenter, rangeRectInfo.right, totalRadian),
|
|
6705
|
+
bottom: rotatePoint(elemCenter, rangeRectInfo.bottom, totalRadian),
|
|
6706
|
+
left: rotatePoint(elemCenter, rangeRectInfo.left, totalRadian)
|
|
6707
|
+
};
|
|
6708
|
+
const x22 = formatNumber(elem.x, { decimalPlaces: 2 });
|
|
6709
|
+
const y22 = formatNumber(elem.y, { decimalPlaces: 2 });
|
|
6710
|
+
const w22 = formatNumber(elem.w, { decimalPlaces: 2 });
|
|
6711
|
+
const h22 = formatNumber(elem.h, { decimalPlaces: 2 });
|
|
6712
|
+
const xyText = `${formatNumber(x22, { decimalPlaces: 0 })},${formatNumber(y22, { decimalPlaces: 0 })}`;
|
|
6713
|
+
const whText = `${formatNumber(w22, { decimalPlaces: 0 })}x${formatNumber(h22, { decimalPlaces: 0 })}`;
|
|
6714
|
+
const angleText = `${formatNumber(elem.angle || 0, { decimalPlaces: 0 })}°`;
|
|
6715
|
+
drawSizeInfoText(overlayContext, {
|
|
6716
|
+
point: {
|
|
6717
|
+
x: rectInfo.bottom.x,
|
|
6718
|
+
y: rectInfo.bottom.y + infoFontSize
|
|
6719
|
+
},
|
|
6720
|
+
rotateCenter: rectInfo.center,
|
|
6721
|
+
angle: totalAngle,
|
|
6722
|
+
text: whText,
|
|
6723
|
+
fontSize: infoFontSize,
|
|
6724
|
+
lineHeight: infoLineHeight,
|
|
6725
|
+
style
|
|
6726
|
+
});
|
|
6727
|
+
drawPositionInfoText(overlayContext, {
|
|
6728
|
+
point: {
|
|
6729
|
+
x: rectInfo.topLeft.x,
|
|
6730
|
+
y: rectInfo.topLeft.y - infoFontSize * 2
|
|
6731
|
+
},
|
|
6732
|
+
rotateCenter: rectInfo.center,
|
|
6733
|
+
angle: totalAngle,
|
|
6734
|
+
text: xyText,
|
|
6735
|
+
fontSize: infoFontSize,
|
|
6736
|
+
lineHeight: infoLineHeight,
|
|
6737
|
+
style
|
|
6738
|
+
});
|
|
6739
|
+
if (showAngleInfo) {
|
|
6740
|
+
drawAngleInfoText(overlayContext, {
|
|
6741
|
+
point: {
|
|
6742
|
+
x: rectInfo.top.x + infoFontSize + 4,
|
|
6743
|
+
y: rectInfo.top.y - infoFontSize * 2 - 18
|
|
6744
|
+
},
|
|
6745
|
+
rotateCenter: rectInfo.center,
|
|
6746
|
+
angle: totalAngle,
|
|
6747
|
+
text: angleText,
|
|
6748
|
+
fontSize: infoFontSize,
|
|
6749
|
+
lineHeight: infoLineHeight,
|
|
6750
|
+
style
|
|
6751
|
+
});
|
|
6752
|
+
}
|
|
6753
|
+
}
|
|
6754
|
+
}
|
|
6755
|
+
}
|
|
6756
|
+
}
|
|
6757
|
+
};
|
|
6758
|
+
};
|
|
6759
|
+
const MiddlewareSelector = (opts, config) => {
|
|
6760
|
+
const innerConfig = {
|
|
6761
|
+
...defaultStyle$3,
|
|
6762
|
+
...config
|
|
6763
|
+
};
|
|
6764
|
+
const { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 } = innerConfig;
|
|
6765
|
+
const style = { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 };
|
|
6766
|
+
const { viewer, sharer, boardContent, calculator, eventHub } = opts;
|
|
6767
|
+
const { overlayContext } = boardContent;
|
|
6768
|
+
let prevPoint = null;
|
|
6769
|
+
let moveOriginalStartPoint = null;
|
|
6770
|
+
let moveOriginalStartElementSize = null;
|
|
6771
|
+
let inBusyMode = null;
|
|
6772
|
+
let hasChangedData = null;
|
|
6773
|
+
const rotateControllerPattern = createRotateControllerPattern({
|
|
6774
|
+
fill: style.activeColor,
|
|
6775
|
+
devicePixelRatio: sharer.getActiveViewSizeInfo().devicePixelRatio
|
|
6776
|
+
});
|
|
6777
|
+
sharer.setSharedStorage(keyActionType, null);
|
|
6778
|
+
sharer.setSharedStorage(keyEnableSnapToGrid, true);
|
|
6779
|
+
const getActiveElements = () => {
|
|
6780
|
+
return sharer.getSharedStorage(keySelectedElementList);
|
|
6781
|
+
};
|
|
6782
|
+
const pushGroupQueue = (elem) => {
|
|
6783
|
+
let groupQueue = sharer.getSharedStorage(keyGroupQueue);
|
|
6784
|
+
if (!Array.isArray(groupQueue)) {
|
|
6785
|
+
groupQueue = [];
|
|
6786
|
+
}
|
|
6787
|
+
if (groupQueue.length > 0) {
|
|
6788
|
+
if (isElementInGroup(elem, groupQueue[groupQueue.length - 1])) {
|
|
6789
|
+
groupQueue.push(elem);
|
|
6790
|
+
} else {
|
|
6791
|
+
groupQueue = [];
|
|
6792
|
+
}
|
|
6793
|
+
} else if (groupQueue.length === 0) {
|
|
6794
|
+
groupQueue.push(elem);
|
|
6795
|
+
}
|
|
6796
|
+
const vertexesList = calcElementQueueVertexesQueueInGroup(groupQueue);
|
|
6797
|
+
sharer.setSharedStorage(keyGroupQueue, groupQueue);
|
|
6798
|
+
sharer.setSharedStorage(keyGroupQueueVertexesList, vertexesList);
|
|
6799
|
+
return groupQueue.length > 0;
|
|
6800
|
+
};
|
|
6801
|
+
const updateHoverElement = (elem) => {
|
|
6802
|
+
sharer.setSharedStorage(keyHoverElement, elem);
|
|
6803
|
+
let vertexes = null;
|
|
6804
|
+
if (elem) {
|
|
6805
|
+
vertexes = calcElementVertexesInGroup(elem, {
|
|
6806
|
+
groupQueue: sharer.getSharedStorage(keyGroupQueue)
|
|
6807
|
+
});
|
|
6808
|
+
}
|
|
6809
|
+
sharer.setSharedStorage(keyHoverElementVertexes, vertexes);
|
|
6810
|
+
};
|
|
6811
|
+
const updateSelectedElemenetController = () => {
|
|
6812
|
+
const list = sharer.getSharedStorage(keySelectedElementList);
|
|
6813
|
+
if (list.length === 1) {
|
|
6814
|
+
const controller = calcElementSizeController(list[0], {
|
|
6815
|
+
groupQueue: sharer.getSharedStorage(keyGroupQueue),
|
|
6816
|
+
controllerSize: controllerSize$1,
|
|
6817
|
+
viewScaleInfo: sharer.getActiveViewScaleInfo(),
|
|
6818
|
+
rotateControllerPosition,
|
|
6819
|
+
rotateControllerSize
|
|
6820
|
+
});
|
|
6821
|
+
sharer.setSharedStorage(keySelectedElementController, controller);
|
|
6822
|
+
}
|
|
6823
|
+
};
|
|
6824
|
+
const updateSelectedElementList = (list, opts2) => {
|
|
6825
|
+
var _a;
|
|
6826
|
+
sharer.setSharedStorage(keySelectedElementList, list);
|
|
6827
|
+
if (list.length === 1) {
|
|
6828
|
+
updateSelectedElemenetController();
|
|
6829
|
+
sharer.setSharedStorage(keySelectedElementPosition, getElementPositionFromList(list[0].uuid, ((_a = sharer.getActiveStorage("data")) == null ? void 0 : _a.elements) || []));
|
|
6830
|
+
} else {
|
|
6831
|
+
sharer.setSharedStorage(keySelectedElementController, null);
|
|
6832
|
+
sharer.setSharedStorage(keySelectedElementPosition, []);
|
|
6833
|
+
}
|
|
6834
|
+
if ((opts2 == null ? void 0 : opts2.triggerEvent) === true) {
|
|
6835
|
+
const uuids = list.map((elem) => elem.uuid);
|
|
6836
|
+
const data = sharer.getActiveStorage("data");
|
|
6413
6837
|
const positionMap = getElementPositionMapFromList(uuids, (data == null ? void 0 : data.elements) || []);
|
|
6414
6838
|
eventHub.trigger(coreEventKeys.SELECT, { uuids, positions: list.map((elem) => [...positionMap[elem.uuid]]) });
|
|
6415
6839
|
}
|
|
@@ -6673,6 +7097,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6673
7097
|
if (actionType === "drag") {
|
|
6674
7098
|
hasChangedData = true;
|
|
6675
7099
|
inBusyMode = "drag";
|
|
7100
|
+
eventHub.trigger(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, { show: false });
|
|
6676
7101
|
if (data && (elems == null ? void 0 : elems.length) === 1 && moveOriginalStartElementSize && originalStart && end && ((_b = (_a = elems[0]) == null ? void 0 : _a.operations) == null ? void 0 : _b.locked) !== true) {
|
|
6677
7102
|
const { moveX, moveY } = calcMoveInGroup(originalStart, end, groupQueue);
|
|
6678
7103
|
let totalMoveX = calculator.toGridNum(moveX / scale);
|
|
@@ -6830,6 +7255,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6830
7255
|
prevPoint = null;
|
|
6831
7256
|
moveOriginalStartPoint = null;
|
|
6832
7257
|
moveOriginalStartElementSize = null;
|
|
7258
|
+
if (actionType === "drag") {
|
|
7259
|
+
eventHub.trigger(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, { show: true });
|
|
7260
|
+
}
|
|
6833
7261
|
if (actionType === "resize" && resizeType) {
|
|
6834
7262
|
sharer.setSharedStorage(keyResizeType, null);
|
|
6835
7263
|
needDrawFrame = true;
|
|
@@ -6894,11 +7322,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6894
7322
|
finalDrawFrame();
|
|
6895
7323
|
},
|
|
6896
7324
|
pointLeave() {
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
7325
|
+
inBusyMode = null;
|
|
7326
|
+
sharer.setSharedStorage(keyResizeType, null);
|
|
7327
|
+
eventHub.trigger(coreEventKeys.CURSOR, {
|
|
7328
|
+
type: "default"
|
|
7329
|
+
});
|
|
6902
7330
|
},
|
|
6903
7331
|
doubleClick(e) {
|
|
6904
7332
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -6928,6 +7356,12 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6928
7356
|
}
|
|
6929
7357
|
sharer.setSharedStorage(keyActionType, null);
|
|
6930
7358
|
},
|
|
7359
|
+
wheel() {
|
|
7360
|
+
updateSelectedElemenetController();
|
|
7361
|
+
},
|
|
7362
|
+
wheelScale() {
|
|
7363
|
+
updateSelectedElemenetController();
|
|
7364
|
+
},
|
|
6931
7365
|
contextMenu: (e) => {
|
|
6932
7366
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6933
7367
|
const groupQueue = sharer.getSharedStorage(keyGroupQueue);
|
|
@@ -6987,11 +7421,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6987
7421
|
const isMoving = sharedStore[keyIsMoving];
|
|
6988
7422
|
const enableSnapToGrid = sharedStore[keyEnableSnapToGrid];
|
|
6989
7423
|
const drawBaseOpts = { calculator, viewScaleInfo, viewSizeInfo, style };
|
|
6990
|
-
const selectedElementController =
|
|
6991
|
-
groupQueue,
|
|
6992
|
-
controllerSize: 10,
|
|
6993
|
-
viewScaleInfo
|
|
6994
|
-
}) : null;
|
|
7424
|
+
const selectedElementController = sharedStore[keySelectedElementController];
|
|
6995
7425
|
const isHoverLocked = !!((_a = hoverElement == null ? void 0 : hoverElement.operations) == null ? void 0 : _a.locked);
|
|
6996
7426
|
if ((groupQueue == null ? void 0 : groupQueue.length) > 0) {
|
|
6997
7427
|
drawGroupQueueVertexesWrappers(overlayContext, groupQueueVertexesList, drawBaseOpts);
|
|
@@ -6999,11 +7429,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6999
7429
|
if (isHoverLocked) {
|
|
7000
7430
|
drawLockedVertexesWrapper(overlayContext, hoverElementVertexes, {
|
|
7001
7431
|
...drawBaseOpts,
|
|
7002
|
-
controller:
|
|
7003
|
-
groupQueue,
|
|
7004
|
-
controllerSize: 10,
|
|
7005
|
-
viewScaleInfo
|
|
7006
|
-
}),
|
|
7432
|
+
controller: selectedElementController,
|
|
7007
7433
|
style
|
|
7008
7434
|
});
|
|
7009
7435
|
} else {
|
|
@@ -7016,6 +7442,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7016
7442
|
element: elem,
|
|
7017
7443
|
calculator,
|
|
7018
7444
|
hideControllers: !!isMoving && actionType === "drag",
|
|
7445
|
+
rotateControllerPattern,
|
|
7019
7446
|
style
|
|
7020
7447
|
});
|
|
7021
7448
|
if (actionType === "drag") {
|
|
@@ -7045,11 +7472,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7045
7472
|
if (isHoverLocked) {
|
|
7046
7473
|
drawLockedVertexesWrapper(overlayContext, hoverElementVertexes, {
|
|
7047
7474
|
...drawBaseOpts,
|
|
7048
|
-
controller:
|
|
7049
|
-
groupQueue,
|
|
7050
|
-
controllerSize: 10,
|
|
7051
|
-
viewScaleInfo
|
|
7052
|
-
}),
|
|
7475
|
+
controller: selectedElementController,
|
|
7053
7476
|
style
|
|
7054
7477
|
});
|
|
7055
7478
|
} else {
|
|
@@ -7062,6 +7485,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7062
7485
|
element: elem,
|
|
7063
7486
|
calculator,
|
|
7064
7487
|
hideControllers: !!isMoving && actionType === "drag",
|
|
7488
|
+
rotateControllerPattern,
|
|
7065
7489
|
style
|
|
7066
7490
|
});
|
|
7067
7491
|
if (actionType === "drag") {
|
|
@@ -7466,7 +7890,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7466
7890
|
const fontSize = 10;
|
|
7467
7891
|
const fontWeight = 100;
|
|
7468
7892
|
const lineSize = 1;
|
|
7469
|
-
const fontFamily
|
|
7893
|
+
const fontFamily = "monospace";
|
|
7470
7894
|
const background = "#FFFFFFA8";
|
|
7471
7895
|
const borderColor = "#00000080";
|
|
7472
7896
|
const scaleColor = "#000000";
|
|
@@ -7585,7 +8009,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7585
8009
|
ctx.$setFont({
|
|
7586
8010
|
fontWeight,
|
|
7587
8011
|
fontSize,
|
|
7588
|
-
fontFamily
|
|
8012
|
+
fontFamily
|
|
7589
8013
|
});
|
|
7590
8014
|
ctx.fillText(`${item.num}`, item.position + fontStart, fontStart);
|
|
7591
8015
|
}
|
|
@@ -7622,7 +8046,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7622
8046
|
ctx.$setFont({
|
|
7623
8047
|
fontWeight,
|
|
7624
8048
|
fontSize,
|
|
7625
|
-
fontFamily
|
|
8049
|
+
fontFamily
|
|
7626
8050
|
});
|
|
7627
8051
|
ctx.fillText(numText, fontStart + fontSize, item.position + fontStart);
|
|
7628
8052
|
});
|
|
@@ -8063,235 +8487,6 @@ var __privateMethod = (obj, member, method) => {
|
|
|
8063
8487
|
}
|
|
8064
8488
|
};
|
|
8065
8489
|
};
|
|
8066
|
-
const fontFamily = "monospace";
|
|
8067
|
-
function drawSizeInfoText(ctx, opts) {
|
|
8068
|
-
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
8069
|
-
const { textColor: textColor2, textBackground } = style;
|
|
8070
|
-
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
8071
|
-
ctx.$setFont({
|
|
8072
|
-
fontWeight: "300",
|
|
8073
|
-
fontSize: fontSize2,
|
|
8074
|
-
fontFamily
|
|
8075
|
-
});
|
|
8076
|
-
const padding = (lineHeight2 - fontSize2) / 2;
|
|
8077
|
-
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
8078
|
-
const bgStart = {
|
|
8079
|
-
x: point.x - textWidth / 2 - padding,
|
|
8080
|
-
y: point.y
|
|
8081
|
-
};
|
|
8082
|
-
const bgEnd = {
|
|
8083
|
-
x: bgStart.x + textWidth + padding * 2,
|
|
8084
|
-
y: bgStart.y + fontSize2 + padding
|
|
8085
|
-
};
|
|
8086
|
-
const textStart = {
|
|
8087
|
-
x: point.x - textWidth / 2,
|
|
8088
|
-
y: point.y
|
|
8089
|
-
};
|
|
8090
|
-
ctx.setLineDash([]);
|
|
8091
|
-
ctx.fillStyle = textBackground;
|
|
8092
|
-
ctx.beginPath();
|
|
8093
|
-
ctx.moveTo(bgStart.x, bgStart.y);
|
|
8094
|
-
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
8095
|
-
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
8096
|
-
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
8097
|
-
ctx.closePath();
|
|
8098
|
-
ctx.fill();
|
|
8099
|
-
ctx.fillStyle = textColor2;
|
|
8100
|
-
ctx.textBaseline = "top";
|
|
8101
|
-
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
8102
|
-
});
|
|
8103
|
-
}
|
|
8104
|
-
function drawPositionInfoText(ctx, opts) {
|
|
8105
|
-
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
8106
|
-
const { textBackground, textColor: textColor2 } = style;
|
|
8107
|
-
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
8108
|
-
ctx.$setFont({
|
|
8109
|
-
fontWeight: "300",
|
|
8110
|
-
fontSize: fontSize2,
|
|
8111
|
-
fontFamily
|
|
8112
|
-
});
|
|
8113
|
-
const padding = (lineHeight2 - fontSize2) / 2;
|
|
8114
|
-
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
8115
|
-
const bgStart = {
|
|
8116
|
-
x: point.x,
|
|
8117
|
-
y: point.y
|
|
8118
|
-
};
|
|
8119
|
-
const bgEnd = {
|
|
8120
|
-
x: bgStart.x + textWidth + padding * 2,
|
|
8121
|
-
y: bgStart.y + fontSize2 + padding
|
|
8122
|
-
};
|
|
8123
|
-
const textStart = {
|
|
8124
|
-
x: point.x + padding,
|
|
8125
|
-
y: point.y
|
|
8126
|
-
};
|
|
8127
|
-
ctx.setLineDash([]);
|
|
8128
|
-
ctx.fillStyle = textBackground;
|
|
8129
|
-
ctx.beginPath();
|
|
8130
|
-
ctx.moveTo(bgStart.x, bgStart.y);
|
|
8131
|
-
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
8132
|
-
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
8133
|
-
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
8134
|
-
ctx.closePath();
|
|
8135
|
-
ctx.fill();
|
|
8136
|
-
ctx.fillStyle = textColor2;
|
|
8137
|
-
ctx.textBaseline = "top";
|
|
8138
|
-
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
8139
|
-
});
|
|
8140
|
-
}
|
|
8141
|
-
function drawAngleInfoText(ctx, opts) {
|
|
8142
|
-
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
8143
|
-
const { textBackground, textColor: textColor2 } = style;
|
|
8144
|
-
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
8145
|
-
ctx.$setFont({
|
|
8146
|
-
fontWeight: "300",
|
|
8147
|
-
fontSize: fontSize2,
|
|
8148
|
-
fontFamily
|
|
8149
|
-
});
|
|
8150
|
-
const padding = (lineHeight2 - fontSize2) / 2;
|
|
8151
|
-
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
8152
|
-
const bgStart = {
|
|
8153
|
-
x: point.x,
|
|
8154
|
-
y: point.y
|
|
8155
|
-
};
|
|
8156
|
-
const bgEnd = {
|
|
8157
|
-
x: bgStart.x + textWidth + padding * 2,
|
|
8158
|
-
y: bgStart.y + fontSize2 + padding
|
|
8159
|
-
};
|
|
8160
|
-
const textStart = {
|
|
8161
|
-
x: point.x + padding,
|
|
8162
|
-
y: point.y
|
|
8163
|
-
};
|
|
8164
|
-
ctx.setLineDash([]);
|
|
8165
|
-
ctx.fillStyle = textBackground;
|
|
8166
|
-
ctx.beginPath();
|
|
8167
|
-
ctx.moveTo(bgStart.x, bgStart.y);
|
|
8168
|
-
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
8169
|
-
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
8170
|
-
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
8171
|
-
ctx.closePath();
|
|
8172
|
-
ctx.fill();
|
|
8173
|
-
ctx.fillStyle = textColor2;
|
|
8174
|
-
ctx.textBaseline = "top";
|
|
8175
|
-
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
8176
|
-
});
|
|
8177
|
-
}
|
|
8178
|
-
const infoBackground = "#1973bac6";
|
|
8179
|
-
const infoTextColor = "#ffffff";
|
|
8180
|
-
const defaltStyle = {
|
|
8181
|
-
textBackground: infoBackground,
|
|
8182
|
-
textColor: infoTextColor
|
|
8183
|
-
};
|
|
8184
|
-
const infoFontSize = 10;
|
|
8185
|
-
const infoLineHeight = 16;
|
|
8186
|
-
const MiddlewareInfo = (opts, config) => {
|
|
8187
|
-
const { boardContent, calculator } = opts;
|
|
8188
|
-
const { overlayContext } = boardContent;
|
|
8189
|
-
const innerConfig = {
|
|
8190
|
-
...defaltStyle,
|
|
8191
|
-
...config
|
|
8192
|
-
};
|
|
8193
|
-
const { textBackground, textColor: textColor2 } = innerConfig;
|
|
8194
|
-
const style = {
|
|
8195
|
-
textBackground,
|
|
8196
|
-
textColor: textColor2
|
|
8197
|
-
};
|
|
8198
|
-
return {
|
|
8199
|
-
name: "@middleware/info",
|
|
8200
|
-
beforeDrawFrame({ snapshot }) {
|
|
8201
|
-
const { sharedStore } = snapshot;
|
|
8202
|
-
const selectedElementList = sharedStore[keySelectedElementList];
|
|
8203
|
-
const actionType = sharedStore[keyActionType];
|
|
8204
|
-
const groupQueue = sharedStore[keyGroupQueue] || [];
|
|
8205
|
-
if (selectedElementList.length === 1) {
|
|
8206
|
-
const elem = selectedElementList[0];
|
|
8207
|
-
if (elem && ["select", "drag", "resize"].includes(actionType)) {
|
|
8208
|
-
const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
|
|
8209
|
-
const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
|
|
8210
|
-
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = elem;
|
|
8211
|
-
const totalGroupQueue = [
|
|
8212
|
-
...groupQueue,
|
|
8213
|
-
...[
|
|
8214
|
-
{
|
|
8215
|
-
uuid: createUUID(),
|
|
8216
|
-
x: x2,
|
|
8217
|
-
y: y2,
|
|
8218
|
-
w: w2,
|
|
8219
|
-
h: h2,
|
|
8220
|
-
angle: angle2,
|
|
8221
|
-
type: "group",
|
|
8222
|
-
detail: { children: [] }
|
|
8223
|
-
}
|
|
8224
|
-
]
|
|
8225
|
-
];
|
|
8226
|
-
const calcOpts = { viewScaleInfo, viewSizeInfo };
|
|
8227
|
-
const rangeRectInfo = calculator.calcViewRectInfoFromOrigin(elem.uuid, calcOpts);
|
|
8228
|
-
let totalAngle = 0;
|
|
8229
|
-
totalGroupQueue.forEach((group) => {
|
|
8230
|
-
totalAngle += group.angle || 0;
|
|
8231
|
-
});
|
|
8232
|
-
const totalRadian = parseAngleToRadian(limitAngle(0 - totalAngle));
|
|
8233
|
-
if (rangeRectInfo) {
|
|
8234
|
-
const elemCenter = rangeRectInfo == null ? void 0 : rangeRectInfo.center;
|
|
8235
|
-
const rectInfo = {
|
|
8236
|
-
topLeft: rotatePoint(elemCenter, rangeRectInfo.topLeft, totalRadian),
|
|
8237
|
-
topRight: rotatePoint(elemCenter, rangeRectInfo.topRight, totalRadian),
|
|
8238
|
-
bottomRight: rotatePoint(elemCenter, rangeRectInfo.bottomRight, totalRadian),
|
|
8239
|
-
bottomLeft: rotatePoint(elemCenter, rangeRectInfo.bottomLeft, totalRadian),
|
|
8240
|
-
center: rotatePoint(elemCenter, rangeRectInfo.center, totalRadian),
|
|
8241
|
-
top: rotatePoint(elemCenter, rangeRectInfo.top, totalRadian),
|
|
8242
|
-
right: rotatePoint(elemCenter, rangeRectInfo.right, totalRadian),
|
|
8243
|
-
bottom: rotatePoint(elemCenter, rangeRectInfo.bottom, totalRadian),
|
|
8244
|
-
left: rotatePoint(elemCenter, rangeRectInfo.left, totalRadian)
|
|
8245
|
-
};
|
|
8246
|
-
const x22 = formatNumber(elem.x, { decimalPlaces: 2 });
|
|
8247
|
-
const y22 = formatNumber(elem.y, { decimalPlaces: 2 });
|
|
8248
|
-
const w22 = formatNumber(elem.w, { decimalPlaces: 2 });
|
|
8249
|
-
const h22 = formatNumber(elem.h, { decimalPlaces: 2 });
|
|
8250
|
-
const xyText = `${formatNumber(x22, { decimalPlaces: 0 })},${formatNumber(y22, { decimalPlaces: 0 })}`;
|
|
8251
|
-
const whText = `${formatNumber(w22, { decimalPlaces: 0 })}x${formatNumber(h22, { decimalPlaces: 0 })}`;
|
|
8252
|
-
const angleText = `${formatNumber(elem.angle || 0, { decimalPlaces: 0 })}°`;
|
|
8253
|
-
drawSizeInfoText(overlayContext, {
|
|
8254
|
-
point: {
|
|
8255
|
-
x: rectInfo.bottom.x,
|
|
8256
|
-
y: rectInfo.bottom.y + infoFontSize
|
|
8257
|
-
},
|
|
8258
|
-
rotateCenter: rectInfo.center,
|
|
8259
|
-
angle: totalAngle,
|
|
8260
|
-
text: whText,
|
|
8261
|
-
fontSize: infoFontSize,
|
|
8262
|
-
lineHeight: infoLineHeight,
|
|
8263
|
-
style
|
|
8264
|
-
});
|
|
8265
|
-
drawPositionInfoText(overlayContext, {
|
|
8266
|
-
point: {
|
|
8267
|
-
x: rectInfo.topLeft.x,
|
|
8268
|
-
y: rectInfo.topLeft.y - infoFontSize * 2
|
|
8269
|
-
},
|
|
8270
|
-
rotateCenter: rectInfo.center,
|
|
8271
|
-
angle: totalAngle,
|
|
8272
|
-
text: xyText,
|
|
8273
|
-
fontSize: infoFontSize,
|
|
8274
|
-
lineHeight: infoLineHeight,
|
|
8275
|
-
style
|
|
8276
|
-
});
|
|
8277
|
-
drawAngleInfoText(overlayContext, {
|
|
8278
|
-
point: {
|
|
8279
|
-
x: rectInfo.top.x + infoFontSize,
|
|
8280
|
-
y: rectInfo.top.y - infoFontSize * 2
|
|
8281
|
-
},
|
|
8282
|
-
rotateCenter: rectInfo.center,
|
|
8283
|
-
angle: totalAngle,
|
|
8284
|
-
text: angleText,
|
|
8285
|
-
fontSize: infoFontSize,
|
|
8286
|
-
lineHeight: infoLineHeight,
|
|
8287
|
-
style
|
|
8288
|
-
});
|
|
8289
|
-
}
|
|
8290
|
-
}
|
|
8291
|
-
}
|
|
8292
|
-
}
|
|
8293
|
-
};
|
|
8294
|
-
};
|
|
8295
8490
|
const MiddlewarePointer = (opts) => {
|
|
8296
8491
|
const { boardContent, eventHub, sharer } = opts;
|
|
8297
8492
|
const canvas = boardContent.boardContext.canvas;
|
|
@@ -8335,16 +8530,16 @@ var __privateMethod = (obj, member, method) => {
|
|
|
8335
8530
|
};
|
|
8336
8531
|
class Core {
|
|
8337
8532
|
constructor(container, opts) {
|
|
8338
|
-
__privateAdd(this,
|
|
8339
|
-
__privateAdd(this, _board
|
|
8533
|
+
__privateAdd(this, _Core_instances);
|
|
8534
|
+
__privateAdd(this, _board);
|
|
8340
8535
|
// #opts: CoreOptions;
|
|
8341
|
-
__privateAdd(this, _canvas
|
|
8342
|
-
__privateAdd(this, _container2
|
|
8536
|
+
__privateAdd(this, _canvas);
|
|
8537
|
+
__privateAdd(this, _container2);
|
|
8343
8538
|
const { devicePixelRatio = 1, width, height, createCustomContext2D } = opts;
|
|
8344
8539
|
__privateSet(this, _container2, container);
|
|
8345
8540
|
const canvas = document.createElement("canvas");
|
|
8346
8541
|
__privateSet(this, _canvas, canvas);
|
|
8347
|
-
__privateMethod(this,
|
|
8542
|
+
__privateMethod(this, _Core_instances, initContainer_fn).call(this);
|
|
8348
8543
|
container.appendChild(canvas);
|
|
8349
8544
|
const boardContent = createBoardContent(canvas, { width, height, devicePixelRatio, offscreen: true, createCustomContext2D });
|
|
8350
8545
|
const board = new Board({ boardContent, container });
|
|
@@ -8441,7 +8636,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
8441
8636
|
_board = new WeakMap();
|
|
8442
8637
|
_canvas = new WeakMap();
|
|
8443
8638
|
_container2 = new WeakMap();
|
|
8444
|
-
|
|
8639
|
+
_Core_instances = new WeakSet();
|
|
8445
8640
|
initContainer_fn = function() {
|
|
8446
8641
|
const container = __privateGet(this, _container2);
|
|
8447
8642
|
container.style.position = "relative";
|