@idraw/core 0.4.0-beta.35 → 0.4.0-beta.37
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/index.js +1 -0
- 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/layout-selector/config.d.ts +3 -1
- package/dist/esm/middleware/layout-selector/config.js +3 -1
- package/dist/esm/middleware/layout-selector/index.d.ts +2 -2
- package/dist/esm/middleware/layout-selector/index.js +40 -32
- package/dist/esm/middleware/layout-selector/types.d.ts +4 -2
- package/dist/esm/middleware/layout-selector/types.js +1 -1
- 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 +46 -30
- 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/types.d.ts +2 -1
- package/dist/esm/middleware/selector/types.js +1 -1
- package/dist/esm/middleware/selector/util.js +1 -1
- package/dist/index.global.js +760 -551
- 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,
|
|
@@ -5957,8 +5932,10 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5957
5932
|
const keyLayoutActionType = Symbol(`${key$2}_layoutActionType`);
|
|
5958
5933
|
const keyLayoutControlType = Symbol(`${key$2}_layoutControlType`);
|
|
5959
5934
|
const keyLayoutController = Symbol(`${key$2}_layoutController`);
|
|
5960
|
-
const
|
|
5935
|
+
const keyLayoutIsHoverContent = Symbol(`${key$2}_layoutIsHoverContent`);
|
|
5936
|
+
const keyLayoutIsHoverController = Symbol(`${key$2}_layoutIsHoverController`);
|
|
5961
5937
|
const keyLayoutIsSelected = Symbol(`${key$2}_layoutIsSelected`);
|
|
5938
|
+
const keyLayoutIsBusyMoving = Symbol(`${key$2}_layoutIsSelected`);
|
|
5962
5939
|
const controllerSize = 10;
|
|
5963
5940
|
const defaultStyle$2 = {
|
|
5964
5941
|
activeColor: "#b331c9"
|
|
@@ -6036,27 +6013,19 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6036
6013
|
const { activeColor: activeColor2 } = innerConfig;
|
|
6037
6014
|
const style = { activeColor: activeColor2 };
|
|
6038
6015
|
let prevPoint = null;
|
|
6039
|
-
let
|
|
6016
|
+
let prevIsHoverContent = null;
|
|
6040
6017
|
let prevIsSelected = null;
|
|
6041
|
-
let isBusy = null;
|
|
6042
6018
|
const clear = () => {
|
|
6043
6019
|
prevPoint = null;
|
|
6044
6020
|
sharer.setSharedStorage(keyLayoutActionType, null);
|
|
6045
6021
|
sharer.setSharedStorage(keyLayoutControlType, null);
|
|
6046
6022
|
sharer.setSharedStorage(keyLayoutController, null);
|
|
6047
|
-
sharer.setSharedStorage(
|
|
6023
|
+
sharer.setSharedStorage(keyLayoutIsHoverContent, null);
|
|
6024
|
+
sharer.setSharedStorage(keyLayoutIsHoverController, null);
|
|
6048
6025
|
sharer.setSharedStorage(keyLayoutIsSelected, null);
|
|
6049
|
-
|
|
6026
|
+
sharer.setSharedStorage(keyLayoutIsBusyMoving, null);
|
|
6027
|
+
prevIsHoverContent = null;
|
|
6050
6028
|
prevIsSelected = null;
|
|
6051
|
-
isBusy = null;
|
|
6052
|
-
};
|
|
6053
|
-
const isInElementHover = () => {
|
|
6054
|
-
const hoverElement = sharer.getSharedStorage(keyHoverElement);
|
|
6055
|
-
if (hoverElement) {
|
|
6056
|
-
clear();
|
|
6057
|
-
return true;
|
|
6058
|
-
}
|
|
6059
|
-
return false;
|
|
6060
6029
|
};
|
|
6061
6030
|
const isInElementAction = () => {
|
|
6062
6031
|
const elementActionType = sharer.getSharedStorage(keyActionType);
|
|
@@ -6105,6 +6074,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6105
6074
|
const resetControlType = (e) => {
|
|
6106
6075
|
const data = sharer.getActiveStorage("data");
|
|
6107
6076
|
const controller = sharer.getSharedStorage(keyLayoutController);
|
|
6077
|
+
let controllerType = null;
|
|
6108
6078
|
if (controller && (data == null ? void 0 : data.layout) && (e == null ? void 0 : e.point)) {
|
|
6109
6079
|
let layoutControlType = null;
|
|
6110
6080
|
if (controller) {
|
|
@@ -6120,14 +6090,19 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6120
6090
|
if (layoutControlType) {
|
|
6121
6091
|
sharer.setSharedStorage(keyLayoutControlType, layoutControlType);
|
|
6122
6092
|
eventHub.trigger(coreEventKeys.CLEAR_SELECT);
|
|
6123
|
-
|
|
6093
|
+
controllerType = layoutControlType;
|
|
6124
6094
|
}
|
|
6125
6095
|
}
|
|
6126
6096
|
}
|
|
6127
|
-
|
|
6097
|
+
if (controllerType) {
|
|
6098
|
+
sharer.setSharedStorage(keyLayoutIsHoverController, true);
|
|
6099
|
+
} else {
|
|
6100
|
+
sharer.setSharedStorage(keyLayoutIsHoverController, false);
|
|
6101
|
+
}
|
|
6102
|
+
return controllerType;
|
|
6128
6103
|
};
|
|
6129
6104
|
const updateCursor = (controlType) => {
|
|
6130
|
-
if (
|
|
6105
|
+
if (sharer.getSharedStorage(keyLayoutIsBusyMoving) === true) {
|
|
6131
6106
|
return;
|
|
6132
6107
|
}
|
|
6133
6108
|
eventHub.trigger(coreEventKeys.CURSOR, {
|
|
@@ -6143,22 +6118,19 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6143
6118
|
resetController();
|
|
6144
6119
|
},
|
|
6145
6120
|
hover: (e) => {
|
|
6146
|
-
if (
|
|
6121
|
+
if (sharer.getSharedStorage(keyLayoutIsBusyMoving) === true) {
|
|
6147
6122
|
return;
|
|
6148
6123
|
}
|
|
6149
6124
|
if (isInElementAction()) {
|
|
6150
6125
|
return;
|
|
6151
6126
|
}
|
|
6152
|
-
if (isInElementHover()) {
|
|
6153
|
-
return;
|
|
6154
|
-
}
|
|
6155
6127
|
if (isInLayout(e.point)) {
|
|
6156
|
-
sharer.setSharedStorage(
|
|
6128
|
+
sharer.setSharedStorage(keyLayoutIsHoverContent, true);
|
|
6157
6129
|
} else {
|
|
6158
|
-
sharer.setSharedStorage(
|
|
6159
|
-
if (
|
|
6130
|
+
sharer.setSharedStorage(keyLayoutIsHoverContent, false);
|
|
6131
|
+
if (prevIsHoverContent === true) {
|
|
6160
6132
|
viewer.drawFrame();
|
|
6161
|
-
|
|
6133
|
+
prevIsHoverContent = false;
|
|
6162
6134
|
}
|
|
6163
6135
|
}
|
|
6164
6136
|
if (sharer.getSharedStorage(keyLayoutIsSelected) === true) {
|
|
@@ -6179,12 +6151,18 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6179
6151
|
updateCursor(layoutControlType);
|
|
6180
6152
|
}
|
|
6181
6153
|
}
|
|
6154
|
+
if (sharer.getSharedStorage(keyLayoutIsHoverController) === true) {
|
|
6155
|
+
return false;
|
|
6156
|
+
}
|
|
6182
6157
|
return;
|
|
6183
6158
|
}
|
|
6184
|
-
if (sharer.getSharedStorage(
|
|
6159
|
+
if (sharer.getSharedStorage(keyLayoutIsHoverContent) && !prevIsHoverContent) {
|
|
6185
6160
|
viewer.drawFrame();
|
|
6186
6161
|
}
|
|
6187
|
-
|
|
6162
|
+
prevIsHoverContent = sharer.getSharedStorage(keyLayoutIsHoverContent);
|
|
6163
|
+
if (sharer.getSharedStorage(keyLayoutIsHoverController) === true) {
|
|
6164
|
+
return false;
|
|
6165
|
+
}
|
|
6188
6166
|
},
|
|
6189
6167
|
pointStart: (e) => {
|
|
6190
6168
|
if (isInElementAction()) {
|
|
@@ -6209,6 +6187,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6209
6187
|
viewer.drawFrame();
|
|
6210
6188
|
}
|
|
6211
6189
|
prevIsSelected = sharer.getSharedStorage(keyLayoutIsSelected);
|
|
6190
|
+
if (sharer.getSharedStorage(keyLayoutIsHoverController) === true) {
|
|
6191
|
+
return false;
|
|
6192
|
+
}
|
|
6212
6193
|
},
|
|
6213
6194
|
pointMove: (e) => {
|
|
6214
6195
|
if (!sharer.getSharedStorage(keyLayoutIsSelected)) {
|
|
@@ -6221,7 +6202,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6221
6202
|
const data = sharer.getActiveStorage("data");
|
|
6222
6203
|
if (layoutActionType === "resize" && layoutControlType && (data == null ? void 0 : data.layout)) {
|
|
6223
6204
|
if (prevPoint) {
|
|
6224
|
-
|
|
6205
|
+
sharer.setSharedStorage(keyLayoutIsBusyMoving, true);
|
|
6225
6206
|
const scale = sharer.getActiveStorage("scale");
|
|
6226
6207
|
const viewMoveX = e.point.x - prevPoint.x;
|
|
6227
6208
|
const viewMoveY = e.point.y - prevPoint.y;
|
|
@@ -6299,7 +6280,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6299
6280
|
}
|
|
6300
6281
|
},
|
|
6301
6282
|
pointEnd: () => {
|
|
6302
|
-
|
|
6283
|
+
sharer.setSharedStorage(keyLayoutIsBusyMoving, false);
|
|
6303
6284
|
const layoutActionType = sharer.getSharedStorage(keyLayoutActionType);
|
|
6304
6285
|
const layoutControlType = sharer.getSharedStorage(keyLayoutControlType);
|
|
6305
6286
|
const data = sharer.getActiveStorage("data");
|
|
@@ -6309,6 +6290,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6309
6290
|
data
|
|
6310
6291
|
});
|
|
6311
6292
|
}
|
|
6293
|
+
if (sharer.getSharedStorage(keyLayoutIsHoverController) === true) {
|
|
6294
|
+
return false;
|
|
6295
|
+
}
|
|
6312
6296
|
},
|
|
6313
6297
|
beforeDrawFrame: ({ snapshot }) => {
|
|
6314
6298
|
var _a;
|
|
@@ -6317,7 +6301,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6317
6301
|
}
|
|
6318
6302
|
const { sharedStore, activeStore } = snapshot;
|
|
6319
6303
|
const layoutActionType = sharedStore[keyLayoutActionType];
|
|
6320
|
-
const layoutIsHover = sharedStore[
|
|
6304
|
+
const layoutIsHover = sharedStore[keyLayoutIsHoverContent];
|
|
6321
6305
|
const layoutIsSelected = sharedStore[keyLayoutIsSelected];
|
|
6322
6306
|
if ((_a = activeStore.data) == null ? void 0 : _a.layout) {
|
|
6323
6307
|
const { x: x2, y: y2, w: w2, h: h2 } = activeStore.data.layout;
|
|
@@ -6344,64 +6328,513 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6344
6328
|
}
|
|
6345
6329
|
};
|
|
6346
6330
|
};
|
|
6347
|
-
const
|
|
6331
|
+
const createIconRotate = (opts) => {
|
|
6332
|
+
const iconRotate = {
|
|
6333
|
+
uuid: createUUID(),
|
|
6334
|
+
type: "path",
|
|
6335
|
+
x: 0,
|
|
6336
|
+
y: 0,
|
|
6337
|
+
w: 200,
|
|
6338
|
+
h: 200,
|
|
6339
|
+
detail: {
|
|
6340
|
+
commands: [
|
|
6341
|
+
{
|
|
6342
|
+
type: "M",
|
|
6343
|
+
params: [512, 0]
|
|
6344
|
+
},
|
|
6345
|
+
{
|
|
6346
|
+
type: "c",
|
|
6347
|
+
params: [282.8, 0, 512, 229.2, 512, 512]
|
|
6348
|
+
},
|
|
6349
|
+
{
|
|
6350
|
+
type: "s",
|
|
6351
|
+
params: [-229.2, 512, -512, 512]
|
|
6352
|
+
},
|
|
6353
|
+
{
|
|
6354
|
+
type: "S",
|
|
6355
|
+
params: [0, 794.8, 0, 512, 229.2, 0, 512, 0]
|
|
6356
|
+
},
|
|
6357
|
+
{
|
|
6358
|
+
type: "z",
|
|
6359
|
+
params: []
|
|
6360
|
+
},
|
|
6361
|
+
{
|
|
6362
|
+
type: "m",
|
|
6363
|
+
params: [309.8, 253.8]
|
|
6364
|
+
},
|
|
6365
|
+
{
|
|
6366
|
+
type: "c",
|
|
6367
|
+
params: [0, -10.5, -6.5, -19.8, -15.7, -23.8, -9.7, -4, -21, -2, -28.2, 5.6]
|
|
6368
|
+
},
|
|
6369
|
+
{
|
|
6370
|
+
type: "l",
|
|
6371
|
+
params: [-52.5, 52]
|
|
6372
|
+
},
|
|
6373
|
+
{
|
|
6374
|
+
type: "c",
|
|
6375
|
+
params: [
|
|
6376
|
+
-56.9,
|
|
6377
|
+
-53.7,
|
|
6378
|
+
-133.9,
|
|
6379
|
+
-85.5,
|
|
6380
|
+
-213.4,
|
|
6381
|
+
-85.5,
|
|
6382
|
+
-170.7,
|
|
6383
|
+
0,
|
|
6384
|
+
-309.8,
|
|
6385
|
+
139.2,
|
|
6386
|
+
-309.8,
|
|
6387
|
+
309.8,
|
|
6388
|
+
0,
|
|
6389
|
+
170.6,
|
|
6390
|
+
139.2,
|
|
6391
|
+
309.8,
|
|
6392
|
+
309.8,
|
|
6393
|
+
309.8,
|
|
6394
|
+
92.4,
|
|
6395
|
+
0,
|
|
6396
|
+
179.5,
|
|
6397
|
+
-40.8,
|
|
6398
|
+
238.4,
|
|
6399
|
+
-111.8,
|
|
6400
|
+
4,
|
|
6401
|
+
-5.2,
|
|
6402
|
+
4,
|
|
6403
|
+
-12.9,
|
|
6404
|
+
-0.8,
|
|
6405
|
+
-17.3
|
|
6406
|
+
]
|
|
6407
|
+
},
|
|
6408
|
+
{
|
|
6409
|
+
type: "L",
|
|
6410
|
+
params: [694.3, 637]
|
|
6411
|
+
},
|
|
6412
|
+
{
|
|
6413
|
+
type: "c",
|
|
6414
|
+
params: [
|
|
6415
|
+
-2.8,
|
|
6416
|
+
-2.4,
|
|
6417
|
+
-6.5,
|
|
6418
|
+
-3.6,
|
|
6419
|
+
-10.1,
|
|
6420
|
+
-3.6,
|
|
6421
|
+
-3.6,
|
|
6422
|
+
0.4,
|
|
6423
|
+
-7.3,
|
|
6424
|
+
2,
|
|
6425
|
+
-9.3,
|
|
6426
|
+
4.8,
|
|
6427
|
+
-39.5,
|
|
6428
|
+
51.2,
|
|
6429
|
+
-98.8,
|
|
6430
|
+
80.3,
|
|
6431
|
+
-163,
|
|
6432
|
+
80.3,
|
|
6433
|
+
-113.8,
|
|
6434
|
+
0,
|
|
6435
|
+
-206.5,
|
|
6436
|
+
-92.8,
|
|
6437
|
+
-206.5,
|
|
6438
|
+
-206.5,
|
|
6439
|
+
0,
|
|
6440
|
+
-113.8,
|
|
6441
|
+
92.8,
|
|
6442
|
+
-206.5,
|
|
6443
|
+
206.5,
|
|
6444
|
+
-206.5,
|
|
6445
|
+
52.8,
|
|
6446
|
+
0,
|
|
6447
|
+
102.9,
|
|
6448
|
+
20.2,
|
|
6449
|
+
140.8,
|
|
6450
|
+
55.3
|
|
6451
|
+
]
|
|
6452
|
+
},
|
|
6453
|
+
{
|
|
6454
|
+
type: "L",
|
|
6455
|
+
params: [597, 416.5]
|
|
6456
|
+
},
|
|
6457
|
+
{
|
|
6458
|
+
type: "c",
|
|
6459
|
+
params: [-7.7, 7.3, -9.7, 18.6, -5.6, 27.9, 4, 9.7, 13.3, 16.1, 23.8, 16.1]
|
|
6460
|
+
},
|
|
6461
|
+
{
|
|
6462
|
+
type: "H",
|
|
6463
|
+
params: [796]
|
|
6464
|
+
},
|
|
6465
|
+
{
|
|
6466
|
+
type: "c",
|
|
6467
|
+
params: [14.1, 0, 25.8, -11.7, 25.8, -25.8]
|
|
6468
|
+
},
|
|
6469
|
+
{
|
|
6470
|
+
type: "V",
|
|
6471
|
+
params: [253.8]
|
|
6472
|
+
},
|
|
6473
|
+
{
|
|
6474
|
+
type: "z",
|
|
6475
|
+
params: []
|
|
6476
|
+
}
|
|
6477
|
+
],
|
|
6478
|
+
fill: "#2c2c2c",
|
|
6479
|
+
stroke: "transparent",
|
|
6480
|
+
strokeWidth: 0,
|
|
6481
|
+
originX: 0,
|
|
6482
|
+
originY: 0,
|
|
6483
|
+
originW: 1024,
|
|
6484
|
+
originH: 1024,
|
|
6485
|
+
opacity: 1,
|
|
6486
|
+
...opts
|
|
6487
|
+
}
|
|
6488
|
+
};
|
|
6489
|
+
return iconRotate;
|
|
6490
|
+
};
|
|
6491
|
+
function createRotateControllerPattern(opts) {
|
|
6492
|
+
const { fill, devicePixelRatio } = opts;
|
|
6493
|
+
const iconRotate = createIconRotate({ fill });
|
|
6494
|
+
const { w: w2, h: h2 } = iconRotate;
|
|
6495
|
+
const context2d = createOffscreenContext2D({
|
|
6496
|
+
width: w2,
|
|
6497
|
+
height: h2,
|
|
6498
|
+
devicePixelRatio
|
|
6499
|
+
});
|
|
6500
|
+
drawElement(context2d, iconRotate, {
|
|
6501
|
+
loader: void 0,
|
|
6502
|
+
viewScaleInfo: {
|
|
6503
|
+
scale: 1,
|
|
6504
|
+
offsetTop: 0,
|
|
6505
|
+
offsetBottom: 0,
|
|
6506
|
+
offsetLeft: 0,
|
|
6507
|
+
offsetRight: 0
|
|
6508
|
+
},
|
|
6509
|
+
viewSizeInfo: {
|
|
6510
|
+
width: w2,
|
|
6511
|
+
height: h2,
|
|
6512
|
+
devicePixelRatio,
|
|
6513
|
+
contextWidth: w2,
|
|
6514
|
+
contextHeight: h2
|
|
6515
|
+
},
|
|
6516
|
+
parentElementSize: {
|
|
6517
|
+
x: 0,
|
|
6518
|
+
y: 0,
|
|
6519
|
+
w: w2,
|
|
6520
|
+
h: h2
|
|
6521
|
+
},
|
|
6522
|
+
parentOpacity: 1
|
|
6523
|
+
});
|
|
6524
|
+
return context2d;
|
|
6525
|
+
}
|
|
6526
|
+
const fontFamily$1 = "monospace";
|
|
6527
|
+
function drawSizeInfoText(ctx, opts) {
|
|
6528
|
+
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
6529
|
+
const { textColor: textColor2, textBackground } = style;
|
|
6530
|
+
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
6531
|
+
ctx.$setFont({
|
|
6532
|
+
fontWeight: "300",
|
|
6533
|
+
fontSize: fontSize2,
|
|
6534
|
+
fontFamily: fontFamily$1
|
|
6535
|
+
});
|
|
6536
|
+
const padding = (lineHeight2 - fontSize2) / 2;
|
|
6537
|
+
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
6538
|
+
const bgStart = {
|
|
6539
|
+
x: point.x - textWidth / 2 - padding,
|
|
6540
|
+
y: point.y
|
|
6541
|
+
};
|
|
6542
|
+
const bgEnd = {
|
|
6543
|
+
x: bgStart.x + textWidth + padding * 2,
|
|
6544
|
+
y: bgStart.y + fontSize2 + padding
|
|
6545
|
+
};
|
|
6546
|
+
const textStart = {
|
|
6547
|
+
x: point.x - textWidth / 2,
|
|
6548
|
+
y: point.y
|
|
6549
|
+
};
|
|
6550
|
+
ctx.setLineDash([]);
|
|
6551
|
+
ctx.fillStyle = textBackground;
|
|
6552
|
+
ctx.beginPath();
|
|
6553
|
+
ctx.moveTo(bgStart.x, bgStart.y);
|
|
6554
|
+
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
6555
|
+
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
6556
|
+
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
6557
|
+
ctx.closePath();
|
|
6558
|
+
ctx.fill();
|
|
6559
|
+
ctx.fillStyle = textColor2;
|
|
6560
|
+
ctx.textBaseline = "top";
|
|
6561
|
+
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
6562
|
+
});
|
|
6563
|
+
}
|
|
6564
|
+
function drawPositionInfoText(ctx, opts) {
|
|
6565
|
+
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
6566
|
+
const { textBackground, textColor: textColor2 } = style;
|
|
6567
|
+
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
6568
|
+
ctx.$setFont({
|
|
6569
|
+
fontWeight: "300",
|
|
6570
|
+
fontSize: fontSize2,
|
|
6571
|
+
fontFamily: fontFamily$1
|
|
6572
|
+
});
|
|
6573
|
+
const padding = (lineHeight2 - fontSize2) / 2;
|
|
6574
|
+
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
6575
|
+
const bgStart = {
|
|
6576
|
+
x: point.x,
|
|
6577
|
+
y: point.y
|
|
6578
|
+
};
|
|
6579
|
+
const bgEnd = {
|
|
6580
|
+
x: bgStart.x + textWidth + padding * 2,
|
|
6581
|
+
y: bgStart.y + fontSize2 + padding
|
|
6582
|
+
};
|
|
6583
|
+
const textStart = {
|
|
6584
|
+
x: point.x + padding,
|
|
6585
|
+
y: point.y
|
|
6586
|
+
};
|
|
6587
|
+
ctx.setLineDash([]);
|
|
6588
|
+
ctx.fillStyle = textBackground;
|
|
6589
|
+
ctx.beginPath();
|
|
6590
|
+
ctx.moveTo(bgStart.x, bgStart.y);
|
|
6591
|
+
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
6592
|
+
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
6593
|
+
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
6594
|
+
ctx.closePath();
|
|
6595
|
+
ctx.fill();
|
|
6596
|
+
ctx.fillStyle = textColor2;
|
|
6597
|
+
ctx.textBaseline = "top";
|
|
6598
|
+
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
6599
|
+
});
|
|
6600
|
+
}
|
|
6601
|
+
function drawAngleInfoText(ctx, opts) {
|
|
6602
|
+
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
6603
|
+
const { textBackground, textColor: textColor2 } = style;
|
|
6604
|
+
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
6605
|
+
ctx.$setFont({
|
|
6606
|
+
fontWeight: "300",
|
|
6607
|
+
fontSize: fontSize2,
|
|
6608
|
+
fontFamily: fontFamily$1
|
|
6609
|
+
});
|
|
6610
|
+
const padding = (lineHeight2 - fontSize2) / 2;
|
|
6611
|
+
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
6612
|
+
const bgStart = {
|
|
6613
|
+
x: point.x,
|
|
6614
|
+
y: point.y
|
|
6615
|
+
};
|
|
6616
|
+
const bgEnd = {
|
|
6617
|
+
x: bgStart.x + textWidth + padding * 2,
|
|
6618
|
+
y: bgStart.y + fontSize2 + padding
|
|
6619
|
+
};
|
|
6620
|
+
const textStart = {
|
|
6621
|
+
x: point.x + padding,
|
|
6622
|
+
y: point.y
|
|
6623
|
+
};
|
|
6624
|
+
ctx.setLineDash([]);
|
|
6625
|
+
ctx.fillStyle = textBackground;
|
|
6626
|
+
ctx.beginPath();
|
|
6627
|
+
ctx.moveTo(bgStart.x, bgStart.y);
|
|
6628
|
+
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
6629
|
+
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
6630
|
+
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
6631
|
+
ctx.closePath();
|
|
6632
|
+
ctx.fill();
|
|
6633
|
+
ctx.fillStyle = textColor2;
|
|
6634
|
+
ctx.textBaseline = "top";
|
|
6635
|
+
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
6636
|
+
});
|
|
6637
|
+
}
|
|
6638
|
+
const infoBackground = "#1973bac6";
|
|
6639
|
+
const infoTextColor = "#ffffff";
|
|
6640
|
+
const MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE = "@middleware/internal-event/show-info-angle";
|
|
6641
|
+
const defaltStyle = {
|
|
6642
|
+
textBackground: infoBackground,
|
|
6643
|
+
textColor: infoTextColor
|
|
6644
|
+
};
|
|
6645
|
+
const infoFontSize = 10;
|
|
6646
|
+
const infoLineHeight = 16;
|
|
6647
|
+
const MiddlewareInfo = (opts, config) => {
|
|
6648
|
+
const { boardContent, calculator, eventHub } = opts;
|
|
6649
|
+
const { overlayContext } = boardContent;
|
|
6348
6650
|
const innerConfig = {
|
|
6349
|
-
...
|
|
6651
|
+
...defaltStyle,
|
|
6350
6652
|
...config
|
|
6351
6653
|
};
|
|
6352
|
-
const {
|
|
6353
|
-
const style = {
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
let prevPoint = null;
|
|
6357
|
-
let moveOriginalStartPoint = null;
|
|
6358
|
-
let moveOriginalStartElementSize = null;
|
|
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);
|
|
6654
|
+
const { textBackground, textColor: textColor2 } = innerConfig;
|
|
6655
|
+
const style = {
|
|
6656
|
+
textBackground,
|
|
6657
|
+
textColor: textColor2
|
|
6365
6658
|
};
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
groupQueue = [];
|
|
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;
|
|
6659
|
+
let showAngleInfo = true;
|
|
6660
|
+
const showInfoAngleCallback = ({ show }) => {
|
|
6661
|
+
showAngleInfo = show;
|
|
6384
6662
|
};
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
}
|
|
6663
|
+
return {
|
|
6664
|
+
name: "@middleware/info",
|
|
6665
|
+
use() {
|
|
6666
|
+
eventHub.on(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, showInfoAngleCallback);
|
|
6667
|
+
},
|
|
6668
|
+
disuse() {
|
|
6669
|
+
eventHub.off(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, showInfoAngleCallback);
|
|
6670
|
+
},
|
|
6671
|
+
beforeDrawFrame({ snapshot }) {
|
|
6672
|
+
const { sharedStore } = snapshot;
|
|
6673
|
+
const selectedElementList = sharedStore[keySelectedElementList];
|
|
6674
|
+
const actionType = sharedStore[keyActionType];
|
|
6675
|
+
const groupQueue = sharedStore[keyGroupQueue] || [];
|
|
6676
|
+
if (selectedElementList.length === 1) {
|
|
6677
|
+
const elem = selectedElementList[0];
|
|
6678
|
+
if (elem && ["select", "drag", "resize"].includes(actionType)) {
|
|
6679
|
+
const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
|
|
6680
|
+
const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
|
|
6681
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = elem;
|
|
6682
|
+
const totalGroupQueue = [
|
|
6683
|
+
...groupQueue,
|
|
6684
|
+
...[
|
|
6685
|
+
{
|
|
6686
|
+
uuid: createUUID(),
|
|
6687
|
+
x: x2,
|
|
6688
|
+
y: y2,
|
|
6689
|
+
w: w2,
|
|
6690
|
+
h: h2,
|
|
6691
|
+
angle: angle2,
|
|
6692
|
+
type: "group",
|
|
6693
|
+
detail: { children: [] }
|
|
6694
|
+
}
|
|
6695
|
+
]
|
|
6696
|
+
];
|
|
6697
|
+
const calcOpts = { viewScaleInfo, viewSizeInfo };
|
|
6698
|
+
const rangeRectInfo = calculator.calcViewRectInfoFromOrigin(elem.uuid, calcOpts);
|
|
6699
|
+
let totalAngle = 0;
|
|
6700
|
+
totalGroupQueue.forEach((group) => {
|
|
6701
|
+
totalAngle += group.angle || 0;
|
|
6702
|
+
});
|
|
6703
|
+
const totalRadian = parseAngleToRadian(limitAngle(0 - totalAngle));
|
|
6704
|
+
if (rangeRectInfo) {
|
|
6705
|
+
const elemCenter = rangeRectInfo == null ? void 0 : rangeRectInfo.center;
|
|
6706
|
+
const rectInfo = {
|
|
6707
|
+
topLeft: rotatePoint(elemCenter, rangeRectInfo.topLeft, totalRadian),
|
|
6708
|
+
topRight: rotatePoint(elemCenter, rangeRectInfo.topRight, totalRadian),
|
|
6709
|
+
bottomRight: rotatePoint(elemCenter, rangeRectInfo.bottomRight, totalRadian),
|
|
6710
|
+
bottomLeft: rotatePoint(elemCenter, rangeRectInfo.bottomLeft, totalRadian),
|
|
6711
|
+
center: rotatePoint(elemCenter, rangeRectInfo.center, totalRadian),
|
|
6712
|
+
top: rotatePoint(elemCenter, rangeRectInfo.top, totalRadian),
|
|
6713
|
+
right: rotatePoint(elemCenter, rangeRectInfo.right, totalRadian),
|
|
6714
|
+
bottom: rotatePoint(elemCenter, rangeRectInfo.bottom, totalRadian),
|
|
6715
|
+
left: rotatePoint(elemCenter, rangeRectInfo.left, totalRadian)
|
|
6716
|
+
};
|
|
6717
|
+
const x22 = formatNumber(elem.x, { decimalPlaces: 2 });
|
|
6718
|
+
const y22 = formatNumber(elem.y, { decimalPlaces: 2 });
|
|
6719
|
+
const w22 = formatNumber(elem.w, { decimalPlaces: 2 });
|
|
6720
|
+
const h22 = formatNumber(elem.h, { decimalPlaces: 2 });
|
|
6721
|
+
const xyText = `${formatNumber(x22, { decimalPlaces: 0 })},${formatNumber(y22, { decimalPlaces: 0 })}`;
|
|
6722
|
+
const whText = `${formatNumber(w22, { decimalPlaces: 0 })}x${formatNumber(h22, { decimalPlaces: 0 })}`;
|
|
6723
|
+
const angleText = `${formatNumber(elem.angle || 0, { decimalPlaces: 0 })}°`;
|
|
6724
|
+
drawSizeInfoText(overlayContext, {
|
|
6725
|
+
point: {
|
|
6726
|
+
x: rectInfo.bottom.x,
|
|
6727
|
+
y: rectInfo.bottom.y + infoFontSize
|
|
6728
|
+
},
|
|
6729
|
+
rotateCenter: rectInfo.center,
|
|
6730
|
+
angle: totalAngle,
|
|
6731
|
+
text: whText,
|
|
6732
|
+
fontSize: infoFontSize,
|
|
6733
|
+
lineHeight: infoLineHeight,
|
|
6734
|
+
style
|
|
6735
|
+
});
|
|
6736
|
+
drawPositionInfoText(overlayContext, {
|
|
6737
|
+
point: {
|
|
6738
|
+
x: rectInfo.topLeft.x,
|
|
6739
|
+
y: rectInfo.topLeft.y - infoFontSize * 2
|
|
6740
|
+
},
|
|
6741
|
+
rotateCenter: rectInfo.center,
|
|
6742
|
+
angle: totalAngle,
|
|
6743
|
+
text: xyText,
|
|
6744
|
+
fontSize: infoFontSize,
|
|
6745
|
+
lineHeight: infoLineHeight,
|
|
6746
|
+
style
|
|
6747
|
+
});
|
|
6748
|
+
if (showAngleInfo) {
|
|
6749
|
+
drawAngleInfoText(overlayContext, {
|
|
6750
|
+
point: {
|
|
6751
|
+
x: rectInfo.top.x + infoFontSize + 4,
|
|
6752
|
+
y: rectInfo.top.y - infoFontSize * 2 - 18
|
|
6753
|
+
},
|
|
6754
|
+
rotateCenter: rectInfo.center,
|
|
6755
|
+
angle: totalAngle,
|
|
6756
|
+
text: angleText,
|
|
6757
|
+
fontSize: infoFontSize,
|
|
6758
|
+
lineHeight: infoLineHeight,
|
|
6759
|
+
style
|
|
6760
|
+
});
|
|
6761
|
+
}
|
|
6762
|
+
}
|
|
6763
|
+
}
|
|
6764
|
+
}
|
|
6765
|
+
}
|
|
6766
|
+
};
|
|
6767
|
+
};
|
|
6768
|
+
const MiddlewareSelector = (opts, config) => {
|
|
6769
|
+
const innerConfig = {
|
|
6770
|
+
...defaultStyle$3,
|
|
6771
|
+
...config
|
|
6772
|
+
};
|
|
6773
|
+
const { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 } = innerConfig;
|
|
6774
|
+
const style = { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 };
|
|
6775
|
+
const { viewer, sharer, boardContent, calculator, eventHub } = opts;
|
|
6776
|
+
const { overlayContext } = boardContent;
|
|
6777
|
+
let prevPoint = null;
|
|
6778
|
+
let moveOriginalStartPoint = null;
|
|
6779
|
+
let moveOriginalStartElementSize = null;
|
|
6780
|
+
let inBusyMode = null;
|
|
6781
|
+
let hasChangedData = null;
|
|
6782
|
+
const rotateControllerPattern = createRotateControllerPattern({
|
|
6783
|
+
fill: style.activeColor,
|
|
6784
|
+
devicePixelRatio: sharer.getActiveViewSizeInfo().devicePixelRatio
|
|
6785
|
+
});
|
|
6786
|
+
sharer.setSharedStorage(keyActionType, null);
|
|
6787
|
+
sharer.setSharedStorage(keyEnableSnapToGrid, true);
|
|
6788
|
+
const getActiveElements = () => {
|
|
6789
|
+
return sharer.getSharedStorage(keySelectedElementList);
|
|
6790
|
+
};
|
|
6791
|
+
const pushGroupQueue = (elem) => {
|
|
6792
|
+
let groupQueue = sharer.getSharedStorage(keyGroupQueue);
|
|
6793
|
+
if (!Array.isArray(groupQueue)) {
|
|
6794
|
+
groupQueue = [];
|
|
6795
|
+
}
|
|
6796
|
+
if (groupQueue.length > 0) {
|
|
6797
|
+
if (isElementInGroup(elem, groupQueue[groupQueue.length - 1])) {
|
|
6798
|
+
groupQueue.push(elem);
|
|
6799
|
+
} else {
|
|
6800
|
+
groupQueue = [];
|
|
6801
|
+
}
|
|
6802
|
+
} else if (groupQueue.length === 0) {
|
|
6803
|
+
groupQueue.push(elem);
|
|
6804
|
+
}
|
|
6805
|
+
const vertexesList = calcElementQueueVertexesQueueInGroup(groupQueue);
|
|
6806
|
+
sharer.setSharedStorage(keyGroupQueue, groupQueue);
|
|
6807
|
+
sharer.setSharedStorage(keyGroupQueueVertexesList, vertexesList);
|
|
6808
|
+
return groupQueue.length > 0;
|
|
6809
|
+
};
|
|
6810
|
+
const updateHoverElement = (elem) => {
|
|
6811
|
+
sharer.setSharedStorage(keyHoverElement, elem);
|
|
6812
|
+
let vertexes = null;
|
|
6813
|
+
if (elem) {
|
|
6814
|
+
vertexes = calcElementVertexesInGroup(elem, {
|
|
6815
|
+
groupQueue: sharer.getSharedStorage(keyGroupQueue)
|
|
6816
|
+
});
|
|
6817
|
+
}
|
|
6393
6818
|
sharer.setSharedStorage(keyHoverElementVertexes, vertexes);
|
|
6394
6819
|
};
|
|
6395
|
-
const
|
|
6396
|
-
|
|
6397
|
-
sharer.setSharedStorage(keySelectedElementList, list);
|
|
6820
|
+
const updateSelectedElemenetController = () => {
|
|
6821
|
+
const list = sharer.getSharedStorage(keySelectedElementList);
|
|
6398
6822
|
if (list.length === 1) {
|
|
6399
6823
|
const controller = calcElementSizeController(list[0], {
|
|
6400
6824
|
groupQueue: sharer.getSharedStorage(keyGroupQueue),
|
|
6401
6825
|
controllerSize: controllerSize$1,
|
|
6402
|
-
viewScaleInfo: sharer.getActiveViewScaleInfo()
|
|
6826
|
+
viewScaleInfo: sharer.getActiveViewScaleInfo(),
|
|
6827
|
+
rotateControllerPosition,
|
|
6828
|
+
rotateControllerSize
|
|
6403
6829
|
});
|
|
6404
6830
|
sharer.setSharedStorage(keySelectedElementController, controller);
|
|
6831
|
+
}
|
|
6832
|
+
};
|
|
6833
|
+
const updateSelectedElementList = (list, opts2) => {
|
|
6834
|
+
var _a;
|
|
6835
|
+
sharer.setSharedStorage(keySelectedElementList, list);
|
|
6836
|
+
if (list.length === 1) {
|
|
6837
|
+
updateSelectedElemenetController();
|
|
6405
6838
|
sharer.setSharedStorage(keySelectedElementPosition, getElementPositionFromList(list[0].uuid, ((_a = sharer.getActiveStorage("data")) == null ? void 0 : _a.elements) || []));
|
|
6406
6839
|
} else {
|
|
6407
6840
|
sharer.setSharedStorage(keySelectedElementController, null);
|
|
@@ -6495,6 +6928,10 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6495
6928
|
hover: (e) => {
|
|
6496
6929
|
var _a, _b, _c, _d, _e;
|
|
6497
6930
|
const layoutIsSelected = sharer.getSharedStorage(keyLayoutIsSelected);
|
|
6931
|
+
const layoutIsBusyMoving = sharer.getSharedStorage(keyLayoutIsBusyMoving);
|
|
6932
|
+
if (layoutIsBusyMoving === true) {
|
|
6933
|
+
return;
|
|
6934
|
+
}
|
|
6498
6935
|
const resizeType = sharer.getSharedStorage(keyResizeType);
|
|
6499
6936
|
const actionType = sharer.getSharedStorage(keyActionType);
|
|
6500
6937
|
const groupQueue = sharer.getSharedStorage(keyGroupQueue);
|
|
@@ -6673,6 +7110,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6673
7110
|
if (actionType === "drag") {
|
|
6674
7111
|
hasChangedData = true;
|
|
6675
7112
|
inBusyMode = "drag";
|
|
7113
|
+
eventHub.trigger(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, { show: false });
|
|
6676
7114
|
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
7115
|
const { moveX, moveY } = calcMoveInGroup(originalStart, end, groupQueue);
|
|
6678
7116
|
let totalMoveX = calculator.toGridNum(moveX / scale);
|
|
@@ -6830,6 +7268,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6830
7268
|
prevPoint = null;
|
|
6831
7269
|
moveOriginalStartPoint = null;
|
|
6832
7270
|
moveOriginalStartElementSize = null;
|
|
7271
|
+
if (actionType === "drag") {
|
|
7272
|
+
eventHub.trigger(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, { show: true });
|
|
7273
|
+
}
|
|
6833
7274
|
if (actionType === "resize" && resizeType) {
|
|
6834
7275
|
sharer.setSharedStorage(keyResizeType, null);
|
|
6835
7276
|
needDrawFrame = true;
|
|
@@ -6894,11 +7335,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6894
7335
|
finalDrawFrame();
|
|
6895
7336
|
},
|
|
6896
7337
|
pointLeave() {
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
7338
|
+
inBusyMode = null;
|
|
7339
|
+
sharer.setSharedStorage(keyResizeType, null);
|
|
7340
|
+
eventHub.trigger(coreEventKeys.CURSOR, {
|
|
7341
|
+
type: "default"
|
|
7342
|
+
});
|
|
6902
7343
|
},
|
|
6903
7344
|
doubleClick(e) {
|
|
6904
7345
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -6928,6 +7369,12 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6928
7369
|
}
|
|
6929
7370
|
sharer.setSharedStorage(keyActionType, null);
|
|
6930
7371
|
},
|
|
7372
|
+
wheel() {
|
|
7373
|
+
updateSelectedElemenetController();
|
|
7374
|
+
},
|
|
7375
|
+
wheelScale() {
|
|
7376
|
+
updateSelectedElemenetController();
|
|
7377
|
+
},
|
|
6931
7378
|
contextMenu: (e) => {
|
|
6932
7379
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6933
7380
|
const groupQueue = sharer.getSharedStorage(keyGroupQueue);
|
|
@@ -6987,11 +7434,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6987
7434
|
const isMoving = sharedStore[keyIsMoving];
|
|
6988
7435
|
const enableSnapToGrid = sharedStore[keyEnableSnapToGrid];
|
|
6989
7436
|
const drawBaseOpts = { calculator, viewScaleInfo, viewSizeInfo, style };
|
|
6990
|
-
const selectedElementController =
|
|
6991
|
-
groupQueue,
|
|
6992
|
-
controllerSize: 10,
|
|
6993
|
-
viewScaleInfo
|
|
6994
|
-
}) : null;
|
|
7437
|
+
const selectedElementController = sharedStore[keySelectedElementController];
|
|
6995
7438
|
const isHoverLocked = !!((_a = hoverElement == null ? void 0 : hoverElement.operations) == null ? void 0 : _a.locked);
|
|
6996
7439
|
if ((groupQueue == null ? void 0 : groupQueue.length) > 0) {
|
|
6997
7440
|
drawGroupQueueVertexesWrappers(overlayContext, groupQueueVertexesList, drawBaseOpts);
|
|
@@ -6999,11 +7442,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6999
7442
|
if (isHoverLocked) {
|
|
7000
7443
|
drawLockedVertexesWrapper(overlayContext, hoverElementVertexes, {
|
|
7001
7444
|
...drawBaseOpts,
|
|
7002
|
-
controller:
|
|
7003
|
-
groupQueue,
|
|
7004
|
-
controllerSize: 10,
|
|
7005
|
-
viewScaleInfo
|
|
7006
|
-
}),
|
|
7445
|
+
controller: selectedElementController,
|
|
7007
7446
|
style
|
|
7008
7447
|
});
|
|
7009
7448
|
} else {
|
|
@@ -7016,6 +7455,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7016
7455
|
element: elem,
|
|
7017
7456
|
calculator,
|
|
7018
7457
|
hideControllers: !!isMoving && actionType === "drag",
|
|
7458
|
+
rotateControllerPattern,
|
|
7019
7459
|
style
|
|
7020
7460
|
});
|
|
7021
7461
|
if (actionType === "drag") {
|
|
@@ -7045,11 +7485,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7045
7485
|
if (isHoverLocked) {
|
|
7046
7486
|
drawLockedVertexesWrapper(overlayContext, hoverElementVertexes, {
|
|
7047
7487
|
...drawBaseOpts,
|
|
7048
|
-
controller:
|
|
7049
|
-
groupQueue,
|
|
7050
|
-
controllerSize: 10,
|
|
7051
|
-
viewScaleInfo
|
|
7052
|
-
}),
|
|
7488
|
+
controller: selectedElementController,
|
|
7053
7489
|
style
|
|
7054
7490
|
});
|
|
7055
7491
|
} else {
|
|
@@ -7062,6 +7498,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7062
7498
|
element: elem,
|
|
7063
7499
|
calculator,
|
|
7064
7500
|
hideControllers: !!isMoving && actionType === "drag",
|
|
7501
|
+
rotateControllerPattern,
|
|
7065
7502
|
style
|
|
7066
7503
|
});
|
|
7067
7504
|
if (actionType === "drag") {
|
|
@@ -7466,7 +7903,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7466
7903
|
const fontSize = 10;
|
|
7467
7904
|
const fontWeight = 100;
|
|
7468
7905
|
const lineSize = 1;
|
|
7469
|
-
const fontFamily
|
|
7906
|
+
const fontFamily = "monospace";
|
|
7470
7907
|
const background = "#FFFFFFA8";
|
|
7471
7908
|
const borderColor = "#00000080";
|
|
7472
7909
|
const scaleColor = "#000000";
|
|
@@ -7585,7 +8022,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7585
8022
|
ctx.$setFont({
|
|
7586
8023
|
fontWeight,
|
|
7587
8024
|
fontSize,
|
|
7588
|
-
fontFamily
|
|
8025
|
+
fontFamily
|
|
7589
8026
|
});
|
|
7590
8027
|
ctx.fillText(`${item.num}`, item.position + fontStart, fontStart);
|
|
7591
8028
|
}
|
|
@@ -7622,7 +8059,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7622
8059
|
ctx.$setFont({
|
|
7623
8060
|
fontWeight,
|
|
7624
8061
|
fontSize,
|
|
7625
|
-
fontFamily
|
|
8062
|
+
fontFamily
|
|
7626
8063
|
});
|
|
7627
8064
|
ctx.fillText(numText, fontStart + fontSize, item.position + fontStart);
|
|
7628
8065
|
});
|
|
@@ -8063,235 +8500,6 @@ var __privateMethod = (obj, member, method) => {
|
|
|
8063
8500
|
}
|
|
8064
8501
|
};
|
|
8065
8502
|
};
|
|
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
8503
|
const MiddlewarePointer = (opts) => {
|
|
8296
8504
|
const { boardContent, eventHub, sharer } = opts;
|
|
8297
8505
|
const canvas = boardContent.boardContext.canvas;
|
|
@@ -8335,16 +8543,17 @@ var __privateMethod = (obj, member, method) => {
|
|
|
8335
8543
|
};
|
|
8336
8544
|
class Core {
|
|
8337
8545
|
constructor(container, opts) {
|
|
8338
|
-
__privateAdd(this,
|
|
8339
|
-
__privateAdd(this, _board
|
|
8546
|
+
__privateAdd(this, _Core_instances);
|
|
8547
|
+
__privateAdd(this, _board);
|
|
8340
8548
|
// #opts: CoreOptions;
|
|
8341
|
-
__privateAdd(this, _canvas
|
|
8342
|
-
__privateAdd(this, _container2
|
|
8549
|
+
__privateAdd(this, _canvas);
|
|
8550
|
+
__privateAdd(this, _container2);
|
|
8343
8551
|
const { devicePixelRatio = 1, width, height, createCustomContext2D } = opts;
|
|
8344
8552
|
__privateSet(this, _container2, container);
|
|
8345
8553
|
const canvas = document.createElement("canvas");
|
|
8554
|
+
canvas.setAttribute("tabindex", "0");
|
|
8346
8555
|
__privateSet(this, _canvas, canvas);
|
|
8347
|
-
__privateMethod(this,
|
|
8556
|
+
__privateMethod(this, _Core_instances, initContainer_fn).call(this);
|
|
8348
8557
|
container.appendChild(canvas);
|
|
8349
8558
|
const boardContent = createBoardContent(canvas, { width, height, devicePixelRatio, offscreen: true, createCustomContext2D });
|
|
8350
8559
|
const board = new Board({ boardContent, container });
|
|
@@ -8441,7 +8650,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
8441
8650
|
_board = new WeakMap();
|
|
8442
8651
|
_canvas = new WeakMap();
|
|
8443
8652
|
_container2 = new WeakMap();
|
|
8444
|
-
|
|
8653
|
+
_Core_instances = new WeakSet();
|
|
8445
8654
|
initContainer_fn = function() {
|
|
8446
8655
|
const container = __privateGet(this, _container2);
|
|
8447
8656
|
container.style.position = "relative";
|