@idraw/core 0.4.0-beta.34 → 0.4.0-beta.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/middleware/info/config.d.ts +1 -0
- package/dist/esm/middleware/info/config.js +1 -0
- package/dist/esm/middleware/info/draw-info.d.ts +1 -1
- package/dist/esm/middleware/info/index.d.ts +7 -1
- package/dist/esm/middleware/info/index.js +27 -14
- package/dist/esm/middleware/selector/config.d.ts +2 -0
- package/dist/esm/middleware/selector/config.js +2 -0
- package/dist/esm/middleware/selector/draw-debug.d.ts +5 -0
- package/dist/esm/middleware/selector/draw-debug.js +30 -0
- package/dist/esm/middleware/selector/draw-wrapper.d.ts +1 -0
- package/dist/esm/middleware/selector/draw-wrapper.js +8 -6
- package/dist/esm/middleware/selector/index.d.ts +6 -1
- package/dist/esm/middleware/selector/index.js +54 -32
- package/dist/esm/middleware/selector/pattern/icon-rotate.d.ts +4 -0
- package/dist/esm/middleware/selector/pattern/icon-rotate.js +88 -0
- package/dist/esm/middleware/selector/pattern/index.d.ts +5 -0
- package/dist/esm/middleware/selector/pattern/index.js +38 -0
- package/dist/esm/middleware/selector/util.js +1 -1
- package/dist/index.global.js +764 -520
- 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,29 +785,26 @@ 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
|
-
var _Store_instances, _Store_temp, _Store_backUpDefaultStorage, _Store_createTempStorage;
|
|
798
|
+
var _Store_instances, _Store_temp, _Store_backUpDefaultStorage, _Store_static, _Store_createTempStorage;
|
|
828
799
|
class Store {
|
|
829
800
|
constructor(opts) {
|
|
830
801
|
_Store_instances.add(this);
|
|
831
802
|
_Store_temp.set(this, void 0);
|
|
832
803
|
_Store_backUpDefaultStorage.set(this, void 0);
|
|
804
|
+
_Store_static.set(this, void 0);
|
|
833
805
|
__classPrivateFieldSet$7(this, _Store_backUpDefaultStorage, deepClone(opts.defaultStorage), "f");
|
|
834
806
|
__classPrivateFieldSet$7(this, _Store_temp, __classPrivateFieldGet$7(this, _Store_instances, "m", _Store_createTempStorage).call(this), "f");
|
|
807
|
+
__classPrivateFieldSet$7(this, _Store_static, opts.defaultStatic || {}, "f");
|
|
835
808
|
}
|
|
836
809
|
set(name, value) {
|
|
837
810
|
__classPrivateFieldGet$7(this, _Store_temp, "f")[name] = value;
|
|
@@ -839,6 +812,12 @@ var __privateMethod = (obj, member, method) => {
|
|
|
839
812
|
get(name) {
|
|
840
813
|
return __classPrivateFieldGet$7(this, _Store_temp, "f")[name];
|
|
841
814
|
}
|
|
815
|
+
setStatic(name, value) {
|
|
816
|
+
__classPrivateFieldGet$7(this, _Store_static, "f")[name] = value;
|
|
817
|
+
}
|
|
818
|
+
getStatic(name) {
|
|
819
|
+
return __classPrivateFieldGet$7(this, _Store_static, "f")[name];
|
|
820
|
+
}
|
|
842
821
|
getSnapshot(opts) {
|
|
843
822
|
if ((opts === null || opts === void 0 ? void 0 : opts.deepClone) === true) {
|
|
844
823
|
return deepClone(__classPrivateFieldGet$7(this, _Store_temp, "f"));
|
|
@@ -850,9 +829,10 @@ var __privateMethod = (obj, member, method) => {
|
|
|
850
829
|
}
|
|
851
830
|
destroy() {
|
|
852
831
|
__classPrivateFieldSet$7(this, _Store_temp, null, "f");
|
|
832
|
+
__classPrivateFieldSet$7(this, _Store_static, null, "f");
|
|
853
833
|
}
|
|
854
834
|
}
|
|
855
|
-
_Store_temp = /* @__PURE__ */ new WeakMap(), _Store_backUpDefaultStorage = /* @__PURE__ */ new WeakMap(), _Store_instances = /* @__PURE__ */ new WeakSet(), _Store_createTempStorage = function _Store_createTempStorage2() {
|
|
835
|
+
_Store_temp = /* @__PURE__ */ new WeakMap(), _Store_backUpDefaultStorage = /* @__PURE__ */ new WeakMap(), _Store_static = /* @__PURE__ */ new WeakMap(), _Store_instances = /* @__PURE__ */ new WeakSet(), _Store_createTempStorage = function _Store_createTempStorage2() {
|
|
856
836
|
return deepClone(__classPrivateFieldGet$7(this, _Store_backUpDefaultStorage, "f"));
|
|
857
837
|
};
|
|
858
838
|
function getViewScaleInfoFromSnapshot(snapshot) {
|
|
@@ -924,16 +904,10 @@ var __privateMethod = (obj, member, method) => {
|
|
|
924
904
|
return calcElementCenter(elemSize);
|
|
925
905
|
}
|
|
926
906
|
function calcRadian(center, start, end) {
|
|
927
|
-
const
|
|
928
|
-
const
|
|
929
|
-
if (
|
|
930
|
-
|
|
931
|
-
return endAngle + (Math.PI * 2 - startAngle);
|
|
932
|
-
} else if (endAngle > Math.PI * 3 / 2 && startAngle < Math.PI / 2) {
|
|
933
|
-
return startAngle + (Math.PI * 2 - endAngle);
|
|
934
|
-
} else {
|
|
935
|
-
return endAngle - startAngle;
|
|
936
|
-
}
|
|
907
|
+
const startRadian = calcLineRadian(center, start);
|
|
908
|
+
const endRadian = calcLineRadian(center, end);
|
|
909
|
+
if (endRadian !== null && startRadian !== null) {
|
|
910
|
+
return endRadian - startRadian;
|
|
937
911
|
} else {
|
|
938
912
|
return 0;
|
|
939
913
|
}
|
|
@@ -1059,12 +1033,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1059
1033
|
];
|
|
1060
1034
|
}
|
|
1061
1035
|
function limitAngle(angle2) {
|
|
1062
|
-
if (!(angle2 > 0 || angle2 < 0) || angle2 === 0) {
|
|
1036
|
+
if (!(angle2 > 0 || angle2 < 0) || angle2 === 0 || angle2 === 360) {
|
|
1063
1037
|
return 0;
|
|
1064
1038
|
}
|
|
1065
1039
|
let num = angle2 % 360;
|
|
1066
1040
|
if (num < 0) {
|
|
1067
1041
|
num += 360;
|
|
1042
|
+
} else if (angle2 === 360) {
|
|
1043
|
+
num = 0;
|
|
1068
1044
|
}
|
|
1069
1045
|
return num;
|
|
1070
1046
|
}
|
|
@@ -1266,6 +1242,36 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1266
1242
|
_loop(elements);
|
|
1267
1243
|
return result;
|
|
1268
1244
|
}
|
|
1245
|
+
function getElementPositionMapFromList(uuids, elements) {
|
|
1246
|
+
const currentPosition = [];
|
|
1247
|
+
const positionMap = {};
|
|
1248
|
+
let over = false;
|
|
1249
|
+
const _loop = (list) => {
|
|
1250
|
+
var _a;
|
|
1251
|
+
for (let i = 0; i < list.length; i++) {
|
|
1252
|
+
if (over === true) {
|
|
1253
|
+
break;
|
|
1254
|
+
}
|
|
1255
|
+
currentPosition.push(i);
|
|
1256
|
+
const elem = list[i];
|
|
1257
|
+
if (uuids.includes(elem.uuid)) {
|
|
1258
|
+
positionMap[elem.uuid] = [...currentPosition];
|
|
1259
|
+
if (Object.keys(positionMap).length === uuids.length) {
|
|
1260
|
+
over = true;
|
|
1261
|
+
break;
|
|
1262
|
+
}
|
|
1263
|
+
} else if (elem.type === "group") {
|
|
1264
|
+
_loop(((_a = elem === null || elem === void 0 ? void 0 : elem.detail) === null || _a === void 0 ? void 0 : _a.children) || []);
|
|
1265
|
+
}
|
|
1266
|
+
if (over) {
|
|
1267
|
+
break;
|
|
1268
|
+
}
|
|
1269
|
+
currentPosition.pop();
|
|
1270
|
+
}
|
|
1271
|
+
};
|
|
1272
|
+
_loop(elements);
|
|
1273
|
+
return positionMap;
|
|
1274
|
+
}
|
|
1269
1275
|
function getElementVertexes(elemSize) {
|
|
1270
1276
|
const { x: x2, y: y2, h: h2, w: w2 } = elemSize;
|
|
1271
1277
|
return [
|
|
@@ -1681,9 +1687,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1681
1687
|
};
|
|
1682
1688
|
}
|
|
1683
1689
|
function calcElementSizeController(elemSize, opts) {
|
|
1684
|
-
const { groupQueue, controllerSize: controllerSize2, viewScaleInfo } = opts;
|
|
1690
|
+
const { groupQueue, controllerSize: controllerSize2, viewScaleInfo, rotateControllerSize: rotateControllerSize2, rotateControllerPosition: rotateControllerPosition2 } = opts;
|
|
1685
1691
|
const ctrlSize = (controllerSize2 && controllerSize2 > 0 ? controllerSize2 : 8) / viewScaleInfo.scale;
|
|
1686
1692
|
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 = 0 } = elemSize;
|
|
1693
|
+
const rotateCtrlSize = rotateControllerSize2;
|
|
1694
|
+
const rotateCtrlPos = rotateControllerPosition2;
|
|
1687
1695
|
const ctrlGroupQueue = [
|
|
1688
1696
|
...[
|
|
1689
1697
|
{
|
|
@@ -1705,10 +1713,10 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1705
1713
|
});
|
|
1706
1714
|
const vertexes = calcElementVertexesInGroup(elemSize, { groupQueue });
|
|
1707
1715
|
const rotateElemVertexes = calcElementVertexesInGroup({
|
|
1708
|
-
x: x2
|
|
1709
|
-
y: y2 -
|
|
1710
|
-
h: h2 +
|
|
1711
|
-
w: w2
|
|
1716
|
+
x: x2,
|
|
1717
|
+
y: y2 - (rotateCtrlPos + rotateCtrlSize / 2) / viewScaleInfo.scale,
|
|
1718
|
+
h: h2 + (rotateCtrlPos * 2 + rotateCtrlSize) / viewScaleInfo.scale,
|
|
1719
|
+
w: w2,
|
|
1712
1720
|
angle: angle2
|
|
1713
1721
|
}, { groupQueue: [...groupQueue] });
|
|
1714
1722
|
const topCenter = getCenterFromTwoPoints(vertexes[0], vertexes[1]);
|
|
@@ -1740,74 +1748,91 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1740
1748
|
const bottomMiddleVertexes = calcElementVertexes(bottomMiddleSize);
|
|
1741
1749
|
const leftMiddleVertexes = calcElementVertexes(leftMiddleSize);
|
|
1742
1750
|
const rotateCenter = getCenterFromTwoPoints(rotateElemVertexes[0], rotateElemVertexes[1]);
|
|
1743
|
-
const
|
|
1751
|
+
const tempRotateSizeRepairRatio = 1.1;
|
|
1752
|
+
const rotateSize = createControllerElementSizeFromCenter(rotateCenter, {
|
|
1753
|
+
size: rotateControllerSize2 * tempRotateSizeRepairRatio / viewScaleInfo.scale,
|
|
1754
|
+
angle: totalAngle
|
|
1755
|
+
});
|
|
1744
1756
|
const rotateVertexes2 = calcElementVertexes(rotateSize);
|
|
1745
1757
|
const sizeController = {
|
|
1746
1758
|
elementWrapper: vertexes,
|
|
1747
1759
|
left: {
|
|
1748
1760
|
type: "left",
|
|
1749
1761
|
vertexes: leftVertexes,
|
|
1750
|
-
center: leftCenter
|
|
1762
|
+
center: leftCenter,
|
|
1763
|
+
size: ctrlSize
|
|
1751
1764
|
},
|
|
1752
1765
|
right: {
|
|
1753
1766
|
type: "right",
|
|
1754
1767
|
vertexes: rightVertexes,
|
|
1755
|
-
center: rightCenter
|
|
1768
|
+
center: rightCenter,
|
|
1769
|
+
size: ctrlSize
|
|
1756
1770
|
},
|
|
1757
1771
|
top: {
|
|
1758
1772
|
type: "top",
|
|
1759
1773
|
vertexes: topVertexes,
|
|
1760
|
-
center: topCenter
|
|
1774
|
+
center: topCenter,
|
|
1775
|
+
size: ctrlSize
|
|
1761
1776
|
},
|
|
1762
1777
|
bottom: {
|
|
1763
1778
|
type: "bottom",
|
|
1764
1779
|
vertexes: bottomVertexes,
|
|
1765
|
-
center: bottomCenter
|
|
1780
|
+
center: bottomCenter,
|
|
1781
|
+
size: ctrlSize
|
|
1766
1782
|
},
|
|
1767
1783
|
topLeft: {
|
|
1768
1784
|
type: "top-left",
|
|
1769
1785
|
vertexes: topLeftVertexes,
|
|
1770
|
-
center: topLeftCenter
|
|
1786
|
+
center: topLeftCenter,
|
|
1787
|
+
size: ctrlSize
|
|
1771
1788
|
},
|
|
1772
1789
|
topRight: {
|
|
1773
1790
|
type: "top-right",
|
|
1774
1791
|
vertexes: topRightVertexes,
|
|
1775
|
-
center: topRightCenter
|
|
1792
|
+
center: topRightCenter,
|
|
1793
|
+
size: ctrlSize
|
|
1776
1794
|
},
|
|
1777
1795
|
bottomLeft: {
|
|
1778
1796
|
type: "bottom-left",
|
|
1779
1797
|
vertexes: bottomLeftVertexes,
|
|
1780
|
-
center: bottomLeftCenter
|
|
1798
|
+
center: bottomLeftCenter,
|
|
1799
|
+
size: ctrlSize
|
|
1781
1800
|
},
|
|
1782
1801
|
bottomRight: {
|
|
1783
1802
|
type: "bottom-right",
|
|
1784
1803
|
vertexes: bottomRightVertexes,
|
|
1785
|
-
center: bottomRightCenter
|
|
1804
|
+
center: bottomRightCenter,
|
|
1805
|
+
size: ctrlSize
|
|
1786
1806
|
},
|
|
1787
1807
|
leftMiddle: {
|
|
1788
1808
|
type: "left-middle",
|
|
1789
1809
|
vertexes: leftMiddleVertexes,
|
|
1790
|
-
center: leftCenter
|
|
1810
|
+
center: leftCenter,
|
|
1811
|
+
size: ctrlSize
|
|
1791
1812
|
},
|
|
1792
1813
|
rightMiddle: {
|
|
1793
1814
|
type: "right-middle",
|
|
1794
1815
|
vertexes: rightMiddleVertexes,
|
|
1795
|
-
center: rightCenter
|
|
1816
|
+
center: rightCenter,
|
|
1817
|
+
size: ctrlSize
|
|
1796
1818
|
},
|
|
1797
1819
|
topMiddle: {
|
|
1798
1820
|
type: "top-middle",
|
|
1799
1821
|
vertexes: topMiddleVertexes,
|
|
1800
|
-
center: topCenter
|
|
1822
|
+
center: topCenter,
|
|
1823
|
+
size: ctrlSize
|
|
1801
1824
|
},
|
|
1802
1825
|
bottomMiddle: {
|
|
1803
1826
|
type: "bottom-middle",
|
|
1804
1827
|
vertexes: bottomMiddleVertexes,
|
|
1805
|
-
center: bottomCenter
|
|
1828
|
+
center: bottomCenter,
|
|
1829
|
+
size: ctrlSize
|
|
1806
1830
|
},
|
|
1807
1831
|
rotate: {
|
|
1808
1832
|
type: "rotate",
|
|
1809
1833
|
vertexes: rotateVertexes2,
|
|
1810
|
-
center: rotateCenter
|
|
1834
|
+
center: rotateCenter,
|
|
1835
|
+
size: rotateControllerSize2
|
|
1811
1836
|
}
|
|
1812
1837
|
};
|
|
1813
1838
|
return sizeController;
|
|
@@ -1849,62 +1874,74 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1849
1874
|
left: {
|
|
1850
1875
|
type: "left",
|
|
1851
1876
|
vertexes: leftVertexes,
|
|
1852
|
-
center: leftCenter
|
|
1877
|
+
center: leftCenter,
|
|
1878
|
+
size: ctrlSize
|
|
1853
1879
|
},
|
|
1854
1880
|
right: {
|
|
1855
1881
|
type: "right",
|
|
1856
1882
|
vertexes: rightVertexes,
|
|
1857
|
-
center: rightCenter
|
|
1883
|
+
center: rightCenter,
|
|
1884
|
+
size: ctrlSize
|
|
1858
1885
|
},
|
|
1859
1886
|
top: {
|
|
1860
1887
|
type: "top",
|
|
1861
1888
|
vertexes: topVertexes,
|
|
1862
|
-
center: topCenter
|
|
1889
|
+
center: topCenter,
|
|
1890
|
+
size: ctrlSize
|
|
1863
1891
|
},
|
|
1864
1892
|
bottom: {
|
|
1865
1893
|
type: "bottom",
|
|
1866
1894
|
vertexes: bottomVertexes,
|
|
1867
|
-
center: bottomCenter
|
|
1895
|
+
center: bottomCenter,
|
|
1896
|
+
size: ctrlSize
|
|
1868
1897
|
},
|
|
1869
1898
|
topLeft: {
|
|
1870
1899
|
type: "top-left",
|
|
1871
1900
|
vertexes: topLeftVertexes,
|
|
1872
|
-
center: topLeftCenter
|
|
1901
|
+
center: topLeftCenter,
|
|
1902
|
+
size: ctrlSize
|
|
1873
1903
|
},
|
|
1874
1904
|
topRight: {
|
|
1875
1905
|
type: "top-right",
|
|
1876
1906
|
vertexes: topRightVertexes,
|
|
1877
|
-
center: topRightCenter
|
|
1907
|
+
center: topRightCenter,
|
|
1908
|
+
size: ctrlSize
|
|
1878
1909
|
},
|
|
1879
1910
|
bottomLeft: {
|
|
1880
1911
|
type: "bottom-left",
|
|
1881
1912
|
vertexes: bottomLeftVertexes,
|
|
1882
|
-
center: bottomLeftCenter
|
|
1913
|
+
center: bottomLeftCenter,
|
|
1914
|
+
size: ctrlSize
|
|
1883
1915
|
},
|
|
1884
1916
|
bottomRight: {
|
|
1885
1917
|
type: "bottom-right",
|
|
1886
1918
|
vertexes: bottomRightVertexes,
|
|
1887
|
-
center: bottomRightCenter
|
|
1919
|
+
center: bottomRightCenter,
|
|
1920
|
+
size: ctrlSize
|
|
1888
1921
|
},
|
|
1889
1922
|
leftMiddle: {
|
|
1890
1923
|
type: "left-middle",
|
|
1891
1924
|
vertexes: leftMiddleVertexes,
|
|
1892
|
-
center: leftCenter
|
|
1925
|
+
center: leftCenter,
|
|
1926
|
+
size: ctrlSize
|
|
1893
1927
|
},
|
|
1894
1928
|
rightMiddle: {
|
|
1895
1929
|
type: "right-middle",
|
|
1896
1930
|
vertexes: rightMiddleVertexes,
|
|
1897
|
-
center: rightCenter
|
|
1931
|
+
center: rightCenter,
|
|
1932
|
+
size: ctrlSize
|
|
1898
1933
|
},
|
|
1899
1934
|
topMiddle: {
|
|
1900
1935
|
type: "top-middle",
|
|
1901
1936
|
vertexes: topMiddleVertexes,
|
|
1902
|
-
center: topCenter
|
|
1937
|
+
center: topCenter,
|
|
1938
|
+
size: ctrlSize
|
|
1903
1939
|
},
|
|
1904
1940
|
bottomMiddle: {
|
|
1905
1941
|
type: "bottom-middle",
|
|
1906
1942
|
vertexes: bottomMiddleVertexes,
|
|
1907
|
-
center: bottomCenter
|
|
1943
|
+
center: bottomCenter,
|
|
1944
|
+
size: ctrlSize
|
|
1908
1945
|
}
|
|
1909
1946
|
};
|
|
1910
1947
|
return sizeController;
|
|
@@ -2056,18 +2093,13 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2056
2093
|
function resizeElement$1(elem, opts) {
|
|
2057
2094
|
const { type } = elem;
|
|
2058
2095
|
resizeElementBase(elem, opts);
|
|
2059
|
-
if (type === "circle")
|
|
2060
|
-
;
|
|
2096
|
+
if (type === "circle") ;
|
|
2061
2097
|
else if (type === "text") {
|
|
2062
2098
|
resizeTextElementDetail(elem, opts);
|
|
2063
|
-
} else if (type === "image")
|
|
2064
|
-
|
|
2065
|
-
else if (type === "
|
|
2066
|
-
|
|
2067
|
-
else if (type === "html")
|
|
2068
|
-
;
|
|
2069
|
-
else if (type === "path")
|
|
2070
|
-
;
|
|
2099
|
+
} else if (type === "image") ;
|
|
2100
|
+
else if (type === "svg") ;
|
|
2101
|
+
else if (type === "html") ;
|
|
2102
|
+
else if (type === "path") ;
|
|
2071
2103
|
else if (type === "group" && Array.isArray(elem.detail.children)) {
|
|
2072
2104
|
elem.detail.children.forEach((child) => {
|
|
2073
2105
|
resizeElement$1(child, opts);
|
|
@@ -2101,9 +2133,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2101
2133
|
}
|
|
2102
2134
|
(function(s, e) {
|
|
2103
2135
|
var t = {};
|
|
2104
|
-
for (var p in s)
|
|
2105
|
-
|
|
2106
|
-
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];
|
|
2107
2138
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2108
2139
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2109
2140
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
@@ -2834,9 +2865,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2834
2865
|
}
|
|
2835
2866
|
var __rest = function(s, e) {
|
|
2836
2867
|
var t = {};
|
|
2837
|
-
for (var p in s)
|
|
2838
|
-
|
|
2839
|
-
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];
|
|
2840
2870
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2841
2871
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2842
2872
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
@@ -3152,19 +3182,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3152
3182
|
});
|
|
3153
3183
|
};
|
|
3154
3184
|
var __classPrivateFieldGet$6 = function(receiver, state, kind, f) {
|
|
3155
|
-
if (kind === "a" && !f)
|
|
3156
|
-
|
|
3157
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3158
|
-
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");
|
|
3159
3187
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3160
3188
|
};
|
|
3161
3189
|
var __classPrivateFieldSet$6 = function(receiver, state, value, kind, f) {
|
|
3162
|
-
if (kind === "m")
|
|
3163
|
-
|
|
3164
|
-
if (
|
|
3165
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
3166
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3167
|
-
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");
|
|
3168
3193
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3169
3194
|
};
|
|
3170
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;
|
|
@@ -3206,8 +3231,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3206
3231
|
};
|
|
3207
3232
|
}));
|
|
3208
3233
|
__classPrivateFieldGet$6(this, _Loader_instances, "m", _Loader_registerLoadFunc).call(this, "html", (elem, assets) => __awaiter(this, void 0, void 0, function* () {
|
|
3209
|
-
var
|
|
3210
|
-
const html2 = ((
|
|
3234
|
+
var _a;
|
|
3235
|
+
const html2 = ((_a = assets[elem.detail.html]) === null || _a === void 0 ? void 0 : _a.value) || elem.detail.html;
|
|
3211
3236
|
const content = yield loadHTML(html2, {
|
|
3212
3237
|
width: elem.detail.originW || elem.w,
|
|
3213
3238
|
height: elem.detail.originH || elem.h
|
|
@@ -3219,8 +3244,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3219
3244
|
};
|
|
3220
3245
|
}));
|
|
3221
3246
|
__classPrivateFieldGet$6(this, _Loader_instances, "m", _Loader_registerLoadFunc).call(this, "svg", (elem, assets) => __awaiter(this, void 0, void 0, function* () {
|
|
3222
|
-
var
|
|
3223
|
-
const svg2 = ((
|
|
3247
|
+
var _a;
|
|
3248
|
+
const svg2 = ((_a = assets[elem.detail.svg]) === null || _a === void 0 ? void 0 : _a.value) || elem.detail.svg;
|
|
3224
3249
|
const content = yield loadSVG(svg2);
|
|
3225
3250
|
return {
|
|
3226
3251
|
uuid: elem.uuid,
|
|
@@ -3349,19 +3374,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3349
3374
|
return false;
|
|
3350
3375
|
};
|
|
3351
3376
|
var __classPrivateFieldSet$5 = function(receiver, state, value, kind, f) {
|
|
3352
|
-
if (kind === "m")
|
|
3353
|
-
|
|
3354
|
-
if (
|
|
3355
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
3356
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3357
|
-
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");
|
|
3358
3380
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3359
3381
|
};
|
|
3360
3382
|
var __classPrivateFieldGet$5 = function(receiver, state, kind, f) {
|
|
3361
|
-
if (kind === "a" && !f)
|
|
3362
|
-
|
|
3363
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3364
|
-
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");
|
|
3365
3385
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3366
3386
|
};
|
|
3367
3387
|
var _Renderer_instances, _Renderer_opts, _Renderer_loader, _Renderer_hasDestroyed, _Renderer_init;
|
|
@@ -3461,19 +3481,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3461
3481
|
});
|
|
3462
3482
|
};
|
|
3463
3483
|
var __classPrivateFieldSet$4 = function(receiver, state, value, kind, f) {
|
|
3464
|
-
if (kind === "m")
|
|
3465
|
-
|
|
3466
|
-
if (
|
|
3467
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
3468
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3469
|
-
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");
|
|
3470
3487
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3471
3488
|
};
|
|
3472
3489
|
var __classPrivateFieldGet$4 = function(receiver, state, kind, f) {
|
|
3473
|
-
if (kind === "a" && !f)
|
|
3474
|
-
|
|
3475
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3476
|
-
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");
|
|
3477
3492
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3478
3493
|
};
|
|
3479
3494
|
var _Calculator_opts, _Calculator_store;
|
|
@@ -3635,19 +3650,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3635
3650
|
}
|
|
3636
3651
|
_Calculator_opts = /* @__PURE__ */ new WeakMap(), _Calculator_store = /* @__PURE__ */ new WeakMap();
|
|
3637
3652
|
var __classPrivateFieldSet$3 = function(receiver, state, value, kind, f) {
|
|
3638
|
-
if (kind === "m")
|
|
3639
|
-
|
|
3640
|
-
if (
|
|
3641
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
3642
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3643
|
-
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");
|
|
3644
3656
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3645
3657
|
};
|
|
3646
3658
|
var __classPrivateFieldGet$3 = function(receiver, state, kind, f) {
|
|
3647
|
-
if (kind === "a" && !f)
|
|
3648
|
-
|
|
3649
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3650
|
-
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");
|
|
3651
3661
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3652
3662
|
};
|
|
3653
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;
|
|
@@ -3713,9 +3723,6 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3713
3723
|
});
|
|
3714
3724
|
_BoardWatcher_onPointLeave.set(this, (e) => {
|
|
3715
3725
|
__classPrivateFieldGet$3(this, _BoardWatcher_store, "f").set("hasPointDown", false);
|
|
3716
|
-
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
3717
|
-
return;
|
|
3718
|
-
}
|
|
3719
3726
|
e.preventDefault();
|
|
3720
3727
|
const point = __classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
3721
3728
|
this.trigger("pointLeave", { point });
|
|
@@ -3765,8 +3772,13 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3765
3772
|
});
|
|
3766
3773
|
_BoardWatcher_onHover.set(this, (e) => {
|
|
3767
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
|
+
}
|
|
3768
3779
|
return;
|
|
3769
3780
|
}
|
|
3781
|
+
__classPrivateFieldGet$3(this, _BoardWatcher_store, "f").set("inCanvas", true);
|
|
3770
3782
|
e.preventDefault();
|
|
3771
3783
|
const point = __classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
3772
3784
|
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isVaildPoint).call(this, point)) {
|
|
@@ -3774,7 +3786,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3774
3786
|
}
|
|
3775
3787
|
this.trigger("hover", { point });
|
|
3776
3788
|
});
|
|
3777
|
-
const store = new Store({ defaultStorage: { hasPointDown: false, prevClickPoint: null } });
|
|
3789
|
+
const store = new Store({ defaultStorage: { hasPointDown: false, prevClickPoint: null, inCanvas: true } });
|
|
3778
3790
|
__classPrivateFieldSet$3(this, _BoardWatcher_store, store, "f");
|
|
3779
3791
|
__classPrivateFieldSet$3(this, _BoardWatcher_opts, opts, "f");
|
|
3780
3792
|
__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_init).call(this);
|
|
@@ -3788,7 +3800,6 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3788
3800
|
container.addEventListener("mousedown", __classPrivateFieldGet$3(this, _BoardWatcher_onPointStart, "f"));
|
|
3789
3801
|
container.addEventListener("mousemove", __classPrivateFieldGet$3(this, _BoardWatcher_onPointMove, "f"));
|
|
3790
3802
|
container.addEventListener("mouseup", __classPrivateFieldGet$3(this, _BoardWatcher_onPointEnd, "f"));
|
|
3791
|
-
container.addEventListener("mouseleave", __classPrivateFieldGet$3(this, _BoardWatcher_onPointLeave, "f"));
|
|
3792
3803
|
container.addEventListener("wheel", __classPrivateFieldGet$3(this, _BoardWatcher_onWheel, "f"), { passive: false });
|
|
3793
3804
|
container.addEventListener("click", __classPrivateFieldGet$3(this, _BoardWatcher_onClick, "f"));
|
|
3794
3805
|
container.addEventListener("contextmenu", __classPrivateFieldGet$3(this, _BoardWatcher_onContextMenu, "f"));
|
|
@@ -3832,19 +3843,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3832
3843
|
return false;
|
|
3833
3844
|
};
|
|
3834
3845
|
var __classPrivateFieldSet$2 = function(receiver, state, value, kind, f) {
|
|
3835
|
-
if (kind === "m")
|
|
3836
|
-
|
|
3837
|
-
if (
|
|
3838
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
3839
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3840
|
-
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");
|
|
3841
3849
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3842
3850
|
};
|
|
3843
3851
|
var __classPrivateFieldGet$2 = function(receiver, state, kind, f) {
|
|
3844
|
-
if (kind === "a" && !f)
|
|
3845
|
-
|
|
3846
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3847
|
-
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");
|
|
3848
3854
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3849
3855
|
};
|
|
3850
3856
|
var _Sharer_activeStore, _Sharer_sharedStore;
|
|
@@ -3937,19 +3943,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3937
3943
|
}
|
|
3938
3944
|
_Sharer_activeStore = /* @__PURE__ */ new WeakMap(), _Sharer_sharedStore = /* @__PURE__ */ new WeakMap();
|
|
3939
3945
|
var __classPrivateFieldSet$1 = function(receiver, state, value, kind, f) {
|
|
3940
|
-
if (kind === "m")
|
|
3941
|
-
|
|
3942
|
-
if (
|
|
3943
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
3944
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3945
|
-
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");
|
|
3946
3949
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3947
3950
|
};
|
|
3948
3951
|
var __classPrivateFieldGet$1 = function(receiver, state, kind, f) {
|
|
3949
|
-
if (kind === "a" && !f)
|
|
3950
|
-
|
|
3951
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3952
|
-
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");
|
|
3953
3954
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3954
3955
|
};
|
|
3955
3956
|
var _Viewer_instances, _Viewer_opts, _Viewer_drawFrameSnapshotQueue, _Viewer_drawFrameStatus, _Viewer_init, _Viewer_drawAnimationFrame;
|
|
@@ -4105,22 +4106,17 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4105
4106
|
}
|
|
4106
4107
|
};
|
|
4107
4108
|
var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
|
|
4108
|
-
if (kind === "m")
|
|
4109
|
-
|
|
4110
|
-
if (
|
|
4111
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
4112
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
4113
|
-
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");
|
|
4114
4112
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
4115
4113
|
};
|
|
4116
4114
|
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
4117
|
-
if (kind === "a" && !f)
|
|
4118
|
-
|
|
4119
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
4120
|
-
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");
|
|
4121
4117
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
4122
4118
|
};
|
|
4123
|
-
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;
|
|
4124
4120
|
class Board {
|
|
4125
4121
|
constructor(opts) {
|
|
4126
4122
|
_Board_instances.add(this);
|
|
@@ -4306,6 +4302,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4306
4302
|
__classPrivateFieldGet(this, _Board_watcher, "f").on("pointStart", __classPrivateFieldGet(this, _Board_instances, "m", _Board_handlePointStart).bind(this));
|
|
4307
4303
|
__classPrivateFieldGet(this, _Board_watcher, "f").on("pointEnd", __classPrivateFieldGet(this, _Board_instances, "m", _Board_handlePointEnd).bind(this));
|
|
4308
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));
|
|
4309
4306
|
__classPrivateFieldGet(this, _Board_watcher, "f").on("hover", __classPrivateFieldGet(this, _Board_instances, "m", _Board_handleHover).bind(this));
|
|
4310
4307
|
__classPrivateFieldGet(this, _Board_watcher, "f").on("wheel", __classPrivateFieldGet(this, _Board_instances, "m", _Board_handleWheel).bind(this));
|
|
4311
4308
|
__classPrivateFieldGet(this, _Board_watcher, "f").on("wheelScale", __classPrivateFieldGet(this, _Board_instances, "m", _Board_handleWheelScale).bind(this));
|
|
@@ -4344,6 +4341,15 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4344
4341
|
return;
|
|
4345
4342
|
}
|
|
4346
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
|
+
}
|
|
4347
4353
|
}, _Board_handleHover = function _Board_handleHover2(e) {
|
|
4348
4354
|
var _a;
|
|
4349
4355
|
for (let i = 0; i < __classPrivateFieldGet(this, _Board_activeMiddlewareObjs, "f").length; i++) {
|
|
@@ -4491,13 +4497,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4491
4497
|
});
|
|
4492
4498
|
class Cursor {
|
|
4493
4499
|
constructor(container, opts) {
|
|
4494
|
-
__privateAdd(this,
|
|
4495
|
-
__privateAdd(this,
|
|
4496
|
-
__privateAdd(this,
|
|
4497
|
-
__privateAdd(this, _setCursorResize);
|
|
4498
|
-
__privateAdd(this, _appendRotateResizeImage);
|
|
4499
|
-
__privateAdd(this, _eventHub, void 0);
|
|
4500
|
-
__privateAdd(this, _container, void 0);
|
|
4500
|
+
__privateAdd(this, _Cursor_instances);
|
|
4501
|
+
__privateAdd(this, _eventHub);
|
|
4502
|
+
__privateAdd(this, _container);
|
|
4501
4503
|
__privateAdd(this, _cursorType, null);
|
|
4502
4504
|
__privateAdd(this, _resizeCursorBaseImage, null);
|
|
4503
4505
|
__privateAdd(this, _cursorImageMap, {
|
|
@@ -4509,8 +4511,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4509
4511
|
});
|
|
4510
4512
|
__privateSet(this, _container, container);
|
|
4511
4513
|
__privateSet(this, _eventHub, opts.eventHub);
|
|
4512
|
-
__privateMethod(this,
|
|
4513
|
-
__privateMethod(this,
|
|
4514
|
+
__privateMethod(this, _Cursor_instances, init_fn).call(this);
|
|
4515
|
+
__privateMethod(this, _Cursor_instances, loadResizeCursorBaseImage_fn).call(this);
|
|
4514
4516
|
}
|
|
4515
4517
|
}
|
|
4516
4518
|
_eventHub = new WeakMap();
|
|
@@ -4518,28 +4520,27 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4518
4520
|
_cursorType = new WeakMap();
|
|
4519
4521
|
_resizeCursorBaseImage = new WeakMap();
|
|
4520
4522
|
_cursorImageMap = new WeakMap();
|
|
4521
|
-
|
|
4523
|
+
_Cursor_instances = new WeakSet();
|
|
4522
4524
|
init_fn = function() {
|
|
4523
4525
|
const eventHub = __privateGet(this, _eventHub);
|
|
4524
|
-
__privateMethod(this,
|
|
4526
|
+
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, "default");
|
|
4525
4527
|
eventHub.on(coreEventKeys.CURSOR, (e) => {
|
|
4526
4528
|
var _a;
|
|
4527
4529
|
if (e.type === "over-element" || !e.type) {
|
|
4528
|
-
__privateMethod(this,
|
|
4530
|
+
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, "auto");
|
|
4529
4531
|
} else if (e.type === "resize-rotate") {
|
|
4530
|
-
__privateMethod(this,
|
|
4532
|
+
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, "rotate");
|
|
4531
4533
|
} else if (typeof e.type === "string" && ((_a = e.type) == null ? void 0 : _a.startsWith("resize-"))) {
|
|
4532
|
-
__privateMethod(this,
|
|
4534
|
+
__privateMethod(this, _Cursor_instances, setCursorResize_fn).call(this, e);
|
|
4533
4535
|
} else if (e.type === "drag-default") {
|
|
4534
|
-
__privateMethod(this,
|
|
4536
|
+
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, "drag-default");
|
|
4535
4537
|
} else if (e.type === "drag-active") {
|
|
4536
|
-
__privateMethod(this,
|
|
4538
|
+
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, "drag-active");
|
|
4537
4539
|
} else {
|
|
4538
|
-
__privateMethod(this,
|
|
4540
|
+
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, "auto");
|
|
4539
4541
|
}
|
|
4540
4542
|
});
|
|
4541
4543
|
};
|
|
4542
|
-
_loadResizeCursorBaseImage = new WeakSet();
|
|
4543
4544
|
loadResizeCursorBaseImage_fn = function() {
|
|
4544
4545
|
loadImage(CURSOR_RESIZE).then((img) => {
|
|
4545
4546
|
__privateSet(this, _resizeCursorBaseImage, img);
|
|
@@ -4547,7 +4548,6 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4547
4548
|
console.error(err);
|
|
4548
4549
|
});
|
|
4549
4550
|
};
|
|
4550
|
-
_resetCursor = new WeakSet();
|
|
4551
4551
|
resetCursor_fn = function(cursorKey) {
|
|
4552
4552
|
if (__privateGet(this, _cursorType) === cursorKey) {
|
|
4553
4553
|
return;
|
|
@@ -4569,7 +4569,6 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4569
4569
|
__privateGet(this, _container).style.cursor = `image-set(url(${image})2x) ${offsetX} ${offsetY}, auto`;
|
|
4570
4570
|
}
|
|
4571
4571
|
};
|
|
4572
|
-
_setCursorResize = new WeakSet();
|
|
4573
4572
|
setCursorResize_fn = function(e) {
|
|
4574
4573
|
var _a;
|
|
4575
4574
|
let totalAngle = 0;
|
|
@@ -4597,10 +4596,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4597
4596
|
});
|
|
4598
4597
|
}
|
|
4599
4598
|
totalAngle = limitAngle(totalAngle);
|
|
4600
|
-
const cursorKey = __privateMethod(this,
|
|
4601
|
-
__privateMethod(this,
|
|
4599
|
+
const cursorKey = __privateMethod(this, _Cursor_instances, appendRotateResizeImage_fn).call(this, totalAngle);
|
|
4600
|
+
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, cursorKey);
|
|
4602
4601
|
};
|
|
4603
|
-
_appendRotateResizeImage = new WeakSet();
|
|
4604
4602
|
appendRotateResizeImage_fn = function(angle2) {
|
|
4605
4603
|
const key2 = `rotate-${angle2}`;
|
|
4606
4604
|
if (!__privateGet(this, _cursorImageMap)[key2]) {
|
|
@@ -4650,6 +4648,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4650
4648
|
const resizeControllerBorderWidth = 4;
|
|
4651
4649
|
const areaBorderWidth = 1;
|
|
4652
4650
|
const controllerSize$1 = 10;
|
|
4651
|
+
const rotateControllerSize = 20;
|
|
4652
|
+
const rotateControllerPosition = 22;
|
|
4653
4653
|
const activeColor = "#1973ba";
|
|
4654
4654
|
const activeAreaColor = "#1976d21c";
|
|
4655
4655
|
const lockedColor = "#5b5959b5";
|
|
@@ -4797,21 +4797,35 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4797
4797
|
}
|
|
4798
4798
|
const {
|
|
4799
4799
|
hideControllers,
|
|
4800
|
-
style
|
|
4800
|
+
style,
|
|
4801
|
+
rotateControllerPattern,
|
|
4802
|
+
viewSizeInfo
|
|
4801
4803
|
// calculator, element, viewScaleInfo, viewSizeInfo
|
|
4802
4804
|
} = opts;
|
|
4805
|
+
const { devicePixelRatio = 1 } = viewSizeInfo;
|
|
4803
4806
|
const { activeColor: activeColor2 } = style;
|
|
4804
|
-
const { elementWrapper, topLeft, topRight, bottomLeft, bottomRight,
|
|
4807
|
+
const { elementWrapper, topLeft, topRight, bottomLeft, bottomRight, rotate } = controller;
|
|
4805
4808
|
const wrapperOpts = { borderColor: activeColor2, borderWidth: selectWrapperBorderWidth, background: "transparent", lineDash: [] };
|
|
4806
4809
|
const ctrlOpts = { ...wrapperOpts, borderWidth: resizeControllerBorderWidth, background: "#FFFFFF" };
|
|
4807
4810
|
drawVertexes(ctx, calcViewVertexes(elementWrapper, opts), wrapperOpts);
|
|
4808
4811
|
if (!hideControllers) {
|
|
4809
|
-
drawLine(ctx, calcViewPointSize(top.center, opts), calcViewPointSize(rotate.center, opts), { ...ctrlOpts, borderWidth: 2 });
|
|
4810
4812
|
drawVertexes(ctx, calcViewVertexes(topLeft.vertexes, opts), ctrlOpts);
|
|
4811
4813
|
drawVertexes(ctx, calcViewVertexes(topRight.vertexes, opts), ctrlOpts);
|
|
4812
4814
|
drawVertexes(ctx, calcViewVertexes(bottomLeft.vertexes, opts), ctrlOpts);
|
|
4813
4815
|
drawVertexes(ctx, calcViewVertexes(bottomRight.vertexes, opts), ctrlOpts);
|
|
4814
|
-
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
|
+
);
|
|
4815
4829
|
}
|
|
4816
4830
|
}
|
|
4817
4831
|
function drawArea(ctx, opts) {
|
|
@@ -5525,7 +5539,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5525
5539
|
});
|
|
5526
5540
|
const startAngle = limitAngle(angle2);
|
|
5527
5541
|
const changedRadian = calcRadian(elemCenter, start, end);
|
|
5528
|
-
const endAngle = startAngle + parseRadianToAngle(changedRadian);
|
|
5542
|
+
const endAngle = limitAngle(startAngle + parseRadianToAngle(changedRadian));
|
|
5529
5543
|
return {
|
|
5530
5544
|
x: x2,
|
|
5531
5545
|
y: y2,
|
|
@@ -6305,70 +6319,523 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6305
6319
|
}
|
|
6306
6320
|
};
|
|
6307
6321
|
};
|
|
6308
|
-
const
|
|
6322
|
+
const createIconRotate = (opts) => {
|
|
6323
|
+
const iconRotate = {
|
|
6324
|
+
uuid: createUUID(),
|
|
6325
|
+
type: "path",
|
|
6326
|
+
x: 0,
|
|
6327
|
+
y: 0,
|
|
6328
|
+
w: 200,
|
|
6329
|
+
h: 200,
|
|
6330
|
+
detail: {
|
|
6331
|
+
commands: [
|
|
6332
|
+
{
|
|
6333
|
+
type: "M",
|
|
6334
|
+
params: [512, 0]
|
|
6335
|
+
},
|
|
6336
|
+
{
|
|
6337
|
+
type: "c",
|
|
6338
|
+
params: [282.8, 0, 512, 229.2, 512, 512]
|
|
6339
|
+
},
|
|
6340
|
+
{
|
|
6341
|
+
type: "s",
|
|
6342
|
+
params: [-229.2, 512, -512, 512]
|
|
6343
|
+
},
|
|
6344
|
+
{
|
|
6345
|
+
type: "S",
|
|
6346
|
+
params: [0, 794.8, 0, 512, 229.2, 0, 512, 0]
|
|
6347
|
+
},
|
|
6348
|
+
{
|
|
6349
|
+
type: "z",
|
|
6350
|
+
params: []
|
|
6351
|
+
},
|
|
6352
|
+
{
|
|
6353
|
+
type: "m",
|
|
6354
|
+
params: [309.8, 253.8]
|
|
6355
|
+
},
|
|
6356
|
+
{
|
|
6357
|
+
type: "c",
|
|
6358
|
+
params: [0, -10.5, -6.5, -19.8, -15.7, -23.8, -9.7, -4, -21, -2, -28.2, 5.6]
|
|
6359
|
+
},
|
|
6360
|
+
{
|
|
6361
|
+
type: "l",
|
|
6362
|
+
params: [-52.5, 52]
|
|
6363
|
+
},
|
|
6364
|
+
{
|
|
6365
|
+
type: "c",
|
|
6366
|
+
params: [
|
|
6367
|
+
-56.9,
|
|
6368
|
+
-53.7,
|
|
6369
|
+
-133.9,
|
|
6370
|
+
-85.5,
|
|
6371
|
+
-213.4,
|
|
6372
|
+
-85.5,
|
|
6373
|
+
-170.7,
|
|
6374
|
+
0,
|
|
6375
|
+
-309.8,
|
|
6376
|
+
139.2,
|
|
6377
|
+
-309.8,
|
|
6378
|
+
309.8,
|
|
6379
|
+
0,
|
|
6380
|
+
170.6,
|
|
6381
|
+
139.2,
|
|
6382
|
+
309.8,
|
|
6383
|
+
309.8,
|
|
6384
|
+
309.8,
|
|
6385
|
+
92.4,
|
|
6386
|
+
0,
|
|
6387
|
+
179.5,
|
|
6388
|
+
-40.8,
|
|
6389
|
+
238.4,
|
|
6390
|
+
-111.8,
|
|
6391
|
+
4,
|
|
6392
|
+
-5.2,
|
|
6393
|
+
4,
|
|
6394
|
+
-12.9,
|
|
6395
|
+
-0.8,
|
|
6396
|
+
-17.3
|
|
6397
|
+
]
|
|
6398
|
+
},
|
|
6399
|
+
{
|
|
6400
|
+
type: "L",
|
|
6401
|
+
params: [694.3, 637]
|
|
6402
|
+
},
|
|
6403
|
+
{
|
|
6404
|
+
type: "c",
|
|
6405
|
+
params: [
|
|
6406
|
+
-2.8,
|
|
6407
|
+
-2.4,
|
|
6408
|
+
-6.5,
|
|
6409
|
+
-3.6,
|
|
6410
|
+
-10.1,
|
|
6411
|
+
-3.6,
|
|
6412
|
+
-3.6,
|
|
6413
|
+
0.4,
|
|
6414
|
+
-7.3,
|
|
6415
|
+
2,
|
|
6416
|
+
-9.3,
|
|
6417
|
+
4.8,
|
|
6418
|
+
-39.5,
|
|
6419
|
+
51.2,
|
|
6420
|
+
-98.8,
|
|
6421
|
+
80.3,
|
|
6422
|
+
-163,
|
|
6423
|
+
80.3,
|
|
6424
|
+
-113.8,
|
|
6425
|
+
0,
|
|
6426
|
+
-206.5,
|
|
6427
|
+
-92.8,
|
|
6428
|
+
-206.5,
|
|
6429
|
+
-206.5,
|
|
6430
|
+
0,
|
|
6431
|
+
-113.8,
|
|
6432
|
+
92.8,
|
|
6433
|
+
-206.5,
|
|
6434
|
+
206.5,
|
|
6435
|
+
-206.5,
|
|
6436
|
+
52.8,
|
|
6437
|
+
0,
|
|
6438
|
+
102.9,
|
|
6439
|
+
20.2,
|
|
6440
|
+
140.8,
|
|
6441
|
+
55.3
|
|
6442
|
+
]
|
|
6443
|
+
},
|
|
6444
|
+
{
|
|
6445
|
+
type: "L",
|
|
6446
|
+
params: [597, 416.5]
|
|
6447
|
+
},
|
|
6448
|
+
{
|
|
6449
|
+
type: "c",
|
|
6450
|
+
params: [-7.7, 7.3, -9.7, 18.6, -5.6, 27.9, 4, 9.7, 13.3, 16.1, 23.8, 16.1]
|
|
6451
|
+
},
|
|
6452
|
+
{
|
|
6453
|
+
type: "H",
|
|
6454
|
+
params: [796]
|
|
6455
|
+
},
|
|
6456
|
+
{
|
|
6457
|
+
type: "c",
|
|
6458
|
+
params: [14.1, 0, 25.8, -11.7, 25.8, -25.8]
|
|
6459
|
+
},
|
|
6460
|
+
{
|
|
6461
|
+
type: "V",
|
|
6462
|
+
params: [253.8]
|
|
6463
|
+
},
|
|
6464
|
+
{
|
|
6465
|
+
type: "z",
|
|
6466
|
+
params: []
|
|
6467
|
+
}
|
|
6468
|
+
],
|
|
6469
|
+
fill: "#2c2c2c",
|
|
6470
|
+
stroke: "transparent",
|
|
6471
|
+
strokeWidth: 0,
|
|
6472
|
+
originX: 0,
|
|
6473
|
+
originY: 0,
|
|
6474
|
+
originW: 1024,
|
|
6475
|
+
originH: 1024,
|
|
6476
|
+
opacity: 1,
|
|
6477
|
+
...opts
|
|
6478
|
+
}
|
|
6479
|
+
};
|
|
6480
|
+
return iconRotate;
|
|
6481
|
+
};
|
|
6482
|
+
function createRotateControllerPattern(opts) {
|
|
6483
|
+
const { fill, devicePixelRatio } = opts;
|
|
6484
|
+
const iconRotate = createIconRotate({ fill });
|
|
6485
|
+
const { w: w2, h: h2 } = iconRotate;
|
|
6486
|
+
const context2d = createOffscreenContext2D({
|
|
6487
|
+
width: w2,
|
|
6488
|
+
height: h2,
|
|
6489
|
+
devicePixelRatio
|
|
6490
|
+
});
|
|
6491
|
+
drawElement(context2d, iconRotate, {
|
|
6492
|
+
loader: void 0,
|
|
6493
|
+
viewScaleInfo: {
|
|
6494
|
+
scale: 1,
|
|
6495
|
+
offsetTop: 0,
|
|
6496
|
+
offsetBottom: 0,
|
|
6497
|
+
offsetLeft: 0,
|
|
6498
|
+
offsetRight: 0
|
|
6499
|
+
},
|
|
6500
|
+
viewSizeInfo: {
|
|
6501
|
+
width: w2,
|
|
6502
|
+
height: h2,
|
|
6503
|
+
devicePixelRatio,
|
|
6504
|
+
contextWidth: w2,
|
|
6505
|
+
contextHeight: h2
|
|
6506
|
+
},
|
|
6507
|
+
parentElementSize: {
|
|
6508
|
+
x: 0,
|
|
6509
|
+
y: 0,
|
|
6510
|
+
w: w2,
|
|
6511
|
+
h: h2
|
|
6512
|
+
},
|
|
6513
|
+
parentOpacity: 1
|
|
6514
|
+
});
|
|
6515
|
+
return context2d;
|
|
6516
|
+
}
|
|
6517
|
+
const fontFamily$1 = "monospace";
|
|
6518
|
+
function drawSizeInfoText(ctx, opts) {
|
|
6519
|
+
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
6520
|
+
const { textColor: textColor2, textBackground } = style;
|
|
6521
|
+
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
6522
|
+
ctx.$setFont({
|
|
6523
|
+
fontWeight: "300",
|
|
6524
|
+
fontSize: fontSize2,
|
|
6525
|
+
fontFamily: fontFamily$1
|
|
6526
|
+
});
|
|
6527
|
+
const padding = (lineHeight2 - fontSize2) / 2;
|
|
6528
|
+
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
6529
|
+
const bgStart = {
|
|
6530
|
+
x: point.x - textWidth / 2 - padding,
|
|
6531
|
+
y: point.y
|
|
6532
|
+
};
|
|
6533
|
+
const bgEnd = {
|
|
6534
|
+
x: bgStart.x + textWidth + padding * 2,
|
|
6535
|
+
y: bgStart.y + fontSize2 + padding
|
|
6536
|
+
};
|
|
6537
|
+
const textStart = {
|
|
6538
|
+
x: point.x - textWidth / 2,
|
|
6539
|
+
y: point.y
|
|
6540
|
+
};
|
|
6541
|
+
ctx.setLineDash([]);
|
|
6542
|
+
ctx.fillStyle = textBackground;
|
|
6543
|
+
ctx.beginPath();
|
|
6544
|
+
ctx.moveTo(bgStart.x, bgStart.y);
|
|
6545
|
+
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
6546
|
+
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
6547
|
+
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
6548
|
+
ctx.closePath();
|
|
6549
|
+
ctx.fill();
|
|
6550
|
+
ctx.fillStyle = textColor2;
|
|
6551
|
+
ctx.textBaseline = "top";
|
|
6552
|
+
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
6553
|
+
});
|
|
6554
|
+
}
|
|
6555
|
+
function drawPositionInfoText(ctx, opts) {
|
|
6556
|
+
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
6557
|
+
const { textBackground, textColor: textColor2 } = style;
|
|
6558
|
+
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
6559
|
+
ctx.$setFont({
|
|
6560
|
+
fontWeight: "300",
|
|
6561
|
+
fontSize: fontSize2,
|
|
6562
|
+
fontFamily: fontFamily$1
|
|
6563
|
+
});
|
|
6564
|
+
const padding = (lineHeight2 - fontSize2) / 2;
|
|
6565
|
+
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
6566
|
+
const bgStart = {
|
|
6567
|
+
x: point.x,
|
|
6568
|
+
y: point.y
|
|
6569
|
+
};
|
|
6570
|
+
const bgEnd = {
|
|
6571
|
+
x: bgStart.x + textWidth + padding * 2,
|
|
6572
|
+
y: bgStart.y + fontSize2 + padding
|
|
6573
|
+
};
|
|
6574
|
+
const textStart = {
|
|
6575
|
+
x: point.x + padding,
|
|
6576
|
+
y: point.y
|
|
6577
|
+
};
|
|
6578
|
+
ctx.setLineDash([]);
|
|
6579
|
+
ctx.fillStyle = textBackground;
|
|
6580
|
+
ctx.beginPath();
|
|
6581
|
+
ctx.moveTo(bgStart.x, bgStart.y);
|
|
6582
|
+
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
6583
|
+
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
6584
|
+
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
6585
|
+
ctx.closePath();
|
|
6586
|
+
ctx.fill();
|
|
6587
|
+
ctx.fillStyle = textColor2;
|
|
6588
|
+
ctx.textBaseline = "top";
|
|
6589
|
+
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
6590
|
+
});
|
|
6591
|
+
}
|
|
6592
|
+
function drawAngleInfoText(ctx, opts) {
|
|
6593
|
+
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
6594
|
+
const { textBackground, textColor: textColor2 } = style;
|
|
6595
|
+
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
6596
|
+
ctx.$setFont({
|
|
6597
|
+
fontWeight: "300",
|
|
6598
|
+
fontSize: fontSize2,
|
|
6599
|
+
fontFamily: fontFamily$1
|
|
6600
|
+
});
|
|
6601
|
+
const padding = (lineHeight2 - fontSize2) / 2;
|
|
6602
|
+
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
6603
|
+
const bgStart = {
|
|
6604
|
+
x: point.x,
|
|
6605
|
+
y: point.y
|
|
6606
|
+
};
|
|
6607
|
+
const bgEnd = {
|
|
6608
|
+
x: bgStart.x + textWidth + padding * 2,
|
|
6609
|
+
y: bgStart.y + fontSize2 + padding
|
|
6610
|
+
};
|
|
6611
|
+
const textStart = {
|
|
6612
|
+
x: point.x + padding,
|
|
6613
|
+
y: point.y
|
|
6614
|
+
};
|
|
6615
|
+
ctx.setLineDash([]);
|
|
6616
|
+
ctx.fillStyle = textBackground;
|
|
6617
|
+
ctx.beginPath();
|
|
6618
|
+
ctx.moveTo(bgStart.x, bgStart.y);
|
|
6619
|
+
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
6620
|
+
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
6621
|
+
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
6622
|
+
ctx.closePath();
|
|
6623
|
+
ctx.fill();
|
|
6624
|
+
ctx.fillStyle = textColor2;
|
|
6625
|
+
ctx.textBaseline = "top";
|
|
6626
|
+
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
6627
|
+
});
|
|
6628
|
+
}
|
|
6629
|
+
const infoBackground = "#1973bac6";
|
|
6630
|
+
const infoTextColor = "#ffffff";
|
|
6631
|
+
const MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE = "@middleware/internal-event/show-info-angle";
|
|
6632
|
+
const defaltStyle = {
|
|
6633
|
+
textBackground: infoBackground,
|
|
6634
|
+
textColor: infoTextColor
|
|
6635
|
+
};
|
|
6636
|
+
const infoFontSize = 10;
|
|
6637
|
+
const infoLineHeight = 16;
|
|
6638
|
+
const MiddlewareInfo = (opts, config) => {
|
|
6639
|
+
const { boardContent, calculator, eventHub } = opts;
|
|
6640
|
+
const { overlayContext } = boardContent;
|
|
6309
6641
|
const innerConfig = {
|
|
6310
|
-
...
|
|
6642
|
+
...defaltStyle,
|
|
6311
6643
|
...config
|
|
6312
6644
|
};
|
|
6313
|
-
const {
|
|
6314
|
-
const style = {
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
let prevPoint = null;
|
|
6318
|
-
let moveOriginalStartPoint = null;
|
|
6319
|
-
let moveOriginalStartElementSize = null;
|
|
6320
|
-
let inBusyMode = null;
|
|
6321
|
-
sharer.setSharedStorage(keyActionType, null);
|
|
6322
|
-
sharer.setSharedStorage(keyEnableSnapToGrid, true);
|
|
6323
|
-
const getActiveElements = () => {
|
|
6324
|
-
return sharer.getSharedStorage(keySelectedElementList);
|
|
6645
|
+
const { textBackground, textColor: textColor2 } = innerConfig;
|
|
6646
|
+
const style = {
|
|
6647
|
+
textBackground,
|
|
6648
|
+
textColor: textColor2
|
|
6325
6649
|
};
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
groupQueue = [];
|
|
6330
|
-
}
|
|
6331
|
-
if (groupQueue.length > 0) {
|
|
6332
|
-
if (isElementInGroup(elem, groupQueue[groupQueue.length - 1])) {
|
|
6333
|
-
groupQueue.push(elem);
|
|
6334
|
-
} else {
|
|
6335
|
-
groupQueue = [];
|
|
6336
|
-
}
|
|
6337
|
-
} else if (groupQueue.length === 0) {
|
|
6338
|
-
groupQueue.push(elem);
|
|
6339
|
-
}
|
|
6340
|
-
const vertexesList = calcElementQueueVertexesQueueInGroup(groupQueue);
|
|
6341
|
-
sharer.setSharedStorage(keyGroupQueue, groupQueue);
|
|
6342
|
-
sharer.setSharedStorage(keyGroupQueueVertexesList, vertexesList);
|
|
6343
|
-
return groupQueue.length > 0;
|
|
6650
|
+
let showAngleInfo = true;
|
|
6651
|
+
const showInfoAngleCallback = ({ show }) => {
|
|
6652
|
+
showAngleInfo = show;
|
|
6344
6653
|
};
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6654
|
+
return {
|
|
6655
|
+
name: "@middleware/info",
|
|
6656
|
+
use() {
|
|
6657
|
+
eventHub.on(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, showInfoAngleCallback);
|
|
6658
|
+
},
|
|
6659
|
+
disuse() {
|
|
6660
|
+
eventHub.off(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, showInfoAngleCallback);
|
|
6661
|
+
},
|
|
6662
|
+
beforeDrawFrame({ snapshot }) {
|
|
6663
|
+
const { sharedStore } = snapshot;
|
|
6664
|
+
const selectedElementList = sharedStore[keySelectedElementList];
|
|
6665
|
+
const actionType = sharedStore[keyActionType];
|
|
6666
|
+
const groupQueue = sharedStore[keyGroupQueue] || [];
|
|
6667
|
+
if (selectedElementList.length === 1) {
|
|
6668
|
+
const elem = selectedElementList[0];
|
|
6669
|
+
if (elem && ["select", "drag", "resize"].includes(actionType)) {
|
|
6670
|
+
const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
|
|
6671
|
+
const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
|
|
6672
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = elem;
|
|
6673
|
+
const totalGroupQueue = [
|
|
6674
|
+
...groupQueue,
|
|
6675
|
+
...[
|
|
6676
|
+
{
|
|
6677
|
+
uuid: createUUID(),
|
|
6678
|
+
x: x2,
|
|
6679
|
+
y: y2,
|
|
6680
|
+
w: w2,
|
|
6681
|
+
h: h2,
|
|
6682
|
+
angle: angle2,
|
|
6683
|
+
type: "group",
|
|
6684
|
+
detail: { children: [] }
|
|
6685
|
+
}
|
|
6686
|
+
]
|
|
6687
|
+
];
|
|
6688
|
+
const calcOpts = { viewScaleInfo, viewSizeInfo };
|
|
6689
|
+
const rangeRectInfo = calculator.calcViewRectInfoFromOrigin(elem.uuid, calcOpts);
|
|
6690
|
+
let totalAngle = 0;
|
|
6691
|
+
totalGroupQueue.forEach((group) => {
|
|
6692
|
+
totalAngle += group.angle || 0;
|
|
6693
|
+
});
|
|
6694
|
+
const totalRadian = parseAngleToRadian(limitAngle(0 - totalAngle));
|
|
6695
|
+
if (rangeRectInfo) {
|
|
6696
|
+
const elemCenter = rangeRectInfo == null ? void 0 : rangeRectInfo.center;
|
|
6697
|
+
const rectInfo = {
|
|
6698
|
+
topLeft: rotatePoint(elemCenter, rangeRectInfo.topLeft, totalRadian),
|
|
6699
|
+
topRight: rotatePoint(elemCenter, rangeRectInfo.topRight, totalRadian),
|
|
6700
|
+
bottomRight: rotatePoint(elemCenter, rangeRectInfo.bottomRight, totalRadian),
|
|
6701
|
+
bottomLeft: rotatePoint(elemCenter, rangeRectInfo.bottomLeft, totalRadian),
|
|
6702
|
+
center: rotatePoint(elemCenter, rangeRectInfo.center, totalRadian),
|
|
6703
|
+
top: rotatePoint(elemCenter, rangeRectInfo.top, totalRadian),
|
|
6704
|
+
right: rotatePoint(elemCenter, rangeRectInfo.right, totalRadian),
|
|
6705
|
+
bottom: rotatePoint(elemCenter, rangeRectInfo.bottom, totalRadian),
|
|
6706
|
+
left: rotatePoint(elemCenter, rangeRectInfo.left, totalRadian)
|
|
6707
|
+
};
|
|
6708
|
+
const x22 = formatNumber(elem.x, { decimalPlaces: 2 });
|
|
6709
|
+
const y22 = formatNumber(elem.y, { decimalPlaces: 2 });
|
|
6710
|
+
const w22 = formatNumber(elem.w, { decimalPlaces: 2 });
|
|
6711
|
+
const h22 = formatNumber(elem.h, { decimalPlaces: 2 });
|
|
6712
|
+
const xyText = `${formatNumber(x22, { decimalPlaces: 0 })},${formatNumber(y22, { decimalPlaces: 0 })}`;
|
|
6713
|
+
const whText = `${formatNumber(w22, { decimalPlaces: 0 })}x${formatNumber(h22, { decimalPlaces: 0 })}`;
|
|
6714
|
+
const angleText = `${formatNumber(elem.angle || 0, { decimalPlaces: 0 })}°`;
|
|
6715
|
+
drawSizeInfoText(overlayContext, {
|
|
6716
|
+
point: {
|
|
6717
|
+
x: rectInfo.bottom.x,
|
|
6718
|
+
y: rectInfo.bottom.y + infoFontSize
|
|
6719
|
+
},
|
|
6720
|
+
rotateCenter: rectInfo.center,
|
|
6721
|
+
angle: totalAngle,
|
|
6722
|
+
text: whText,
|
|
6723
|
+
fontSize: infoFontSize,
|
|
6724
|
+
lineHeight: infoLineHeight,
|
|
6725
|
+
style
|
|
6726
|
+
});
|
|
6727
|
+
drawPositionInfoText(overlayContext, {
|
|
6728
|
+
point: {
|
|
6729
|
+
x: rectInfo.topLeft.x,
|
|
6730
|
+
y: rectInfo.topLeft.y - infoFontSize * 2
|
|
6731
|
+
},
|
|
6732
|
+
rotateCenter: rectInfo.center,
|
|
6733
|
+
angle: totalAngle,
|
|
6734
|
+
text: xyText,
|
|
6735
|
+
fontSize: infoFontSize,
|
|
6736
|
+
lineHeight: infoLineHeight,
|
|
6737
|
+
style
|
|
6738
|
+
});
|
|
6739
|
+
if (showAngleInfo) {
|
|
6740
|
+
drawAngleInfoText(overlayContext, {
|
|
6741
|
+
point: {
|
|
6742
|
+
x: rectInfo.top.x + infoFontSize + 4,
|
|
6743
|
+
y: rectInfo.top.y - infoFontSize * 2 - 18
|
|
6744
|
+
},
|
|
6745
|
+
rotateCenter: rectInfo.center,
|
|
6746
|
+
angle: totalAngle,
|
|
6747
|
+
text: angleText,
|
|
6748
|
+
fontSize: infoFontSize,
|
|
6749
|
+
lineHeight: infoLineHeight,
|
|
6750
|
+
style
|
|
6751
|
+
});
|
|
6752
|
+
}
|
|
6753
|
+
}
|
|
6754
|
+
}
|
|
6755
|
+
}
|
|
6756
|
+
}
|
|
6757
|
+
};
|
|
6758
|
+
};
|
|
6759
|
+
const MiddlewareSelector = (opts, config) => {
|
|
6760
|
+
const innerConfig = {
|
|
6761
|
+
...defaultStyle$3,
|
|
6762
|
+
...config
|
|
6763
|
+
};
|
|
6764
|
+
const { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 } = innerConfig;
|
|
6765
|
+
const style = { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 };
|
|
6766
|
+
const { viewer, sharer, boardContent, calculator, eventHub } = opts;
|
|
6767
|
+
const { overlayContext } = boardContent;
|
|
6768
|
+
let prevPoint = null;
|
|
6769
|
+
let moveOriginalStartPoint = null;
|
|
6770
|
+
let moveOriginalStartElementSize = null;
|
|
6771
|
+
let inBusyMode = null;
|
|
6772
|
+
let hasChangedData = null;
|
|
6773
|
+
const rotateControllerPattern = createRotateControllerPattern({
|
|
6774
|
+
fill: style.activeColor,
|
|
6775
|
+
devicePixelRatio: sharer.getActiveViewSizeInfo().devicePixelRatio
|
|
6776
|
+
});
|
|
6777
|
+
sharer.setSharedStorage(keyActionType, null);
|
|
6778
|
+
sharer.setSharedStorage(keyEnableSnapToGrid, true);
|
|
6779
|
+
const getActiveElements = () => {
|
|
6780
|
+
return sharer.getSharedStorage(keySelectedElementList);
|
|
6781
|
+
};
|
|
6782
|
+
const pushGroupQueue = (elem) => {
|
|
6783
|
+
let groupQueue = sharer.getSharedStorage(keyGroupQueue);
|
|
6784
|
+
if (!Array.isArray(groupQueue)) {
|
|
6785
|
+
groupQueue = [];
|
|
6786
|
+
}
|
|
6787
|
+
if (groupQueue.length > 0) {
|
|
6788
|
+
if (isElementInGroup(elem, groupQueue[groupQueue.length - 1])) {
|
|
6789
|
+
groupQueue.push(elem);
|
|
6790
|
+
} else {
|
|
6791
|
+
groupQueue = [];
|
|
6792
|
+
}
|
|
6793
|
+
} else if (groupQueue.length === 0) {
|
|
6794
|
+
groupQueue.push(elem);
|
|
6795
|
+
}
|
|
6796
|
+
const vertexesList = calcElementQueueVertexesQueueInGroup(groupQueue);
|
|
6797
|
+
sharer.setSharedStorage(keyGroupQueue, groupQueue);
|
|
6798
|
+
sharer.setSharedStorage(keyGroupQueueVertexesList, vertexesList);
|
|
6799
|
+
return groupQueue.length > 0;
|
|
6800
|
+
};
|
|
6801
|
+
const updateHoverElement = (elem) => {
|
|
6802
|
+
sharer.setSharedStorage(keyHoverElement, elem);
|
|
6803
|
+
let vertexes = null;
|
|
6804
|
+
if (elem) {
|
|
6349
6805
|
vertexes = calcElementVertexesInGroup(elem, {
|
|
6350
6806
|
groupQueue: sharer.getSharedStorage(keyGroupQueue)
|
|
6351
6807
|
});
|
|
6352
6808
|
}
|
|
6353
6809
|
sharer.setSharedStorage(keyHoverElementVertexes, vertexes);
|
|
6354
6810
|
};
|
|
6355
|
-
const
|
|
6356
|
-
|
|
6357
|
-
sharer.setSharedStorage(keySelectedElementList, list);
|
|
6811
|
+
const updateSelectedElemenetController = () => {
|
|
6812
|
+
const list = sharer.getSharedStorage(keySelectedElementList);
|
|
6358
6813
|
if (list.length === 1) {
|
|
6359
6814
|
const controller = calcElementSizeController(list[0], {
|
|
6360
6815
|
groupQueue: sharer.getSharedStorage(keyGroupQueue),
|
|
6361
6816
|
controllerSize: controllerSize$1,
|
|
6362
|
-
viewScaleInfo: sharer.getActiveViewScaleInfo()
|
|
6817
|
+
viewScaleInfo: sharer.getActiveViewScaleInfo(),
|
|
6818
|
+
rotateControllerPosition,
|
|
6819
|
+
rotateControllerSize
|
|
6363
6820
|
});
|
|
6364
6821
|
sharer.setSharedStorage(keySelectedElementController, controller);
|
|
6822
|
+
}
|
|
6823
|
+
};
|
|
6824
|
+
const updateSelectedElementList = (list, opts2) => {
|
|
6825
|
+
var _a;
|
|
6826
|
+
sharer.setSharedStorage(keySelectedElementList, list);
|
|
6827
|
+
if (list.length === 1) {
|
|
6828
|
+
updateSelectedElemenetController();
|
|
6365
6829
|
sharer.setSharedStorage(keySelectedElementPosition, getElementPositionFromList(list[0].uuid, ((_a = sharer.getActiveStorage("data")) == null ? void 0 : _a.elements) || []));
|
|
6366
6830
|
} else {
|
|
6367
6831
|
sharer.setSharedStorage(keySelectedElementController, null);
|
|
6368
6832
|
sharer.setSharedStorage(keySelectedElementPosition, []);
|
|
6369
6833
|
}
|
|
6370
6834
|
if ((opts2 == null ? void 0 : opts2.triggerEvent) === true) {
|
|
6371
|
-
|
|
6835
|
+
const uuids = list.map((elem) => elem.uuid);
|
|
6836
|
+
const data = sharer.getActiveStorage("data");
|
|
6837
|
+
const positionMap = getElementPositionMapFromList(uuids, (data == null ? void 0 : data.elements) || []);
|
|
6838
|
+
eventHub.trigger(coreEventKeys.SELECT, { uuids, positions: list.map((elem) => [...positionMap[elem.uuid]]) });
|
|
6372
6839
|
}
|
|
6373
6840
|
};
|
|
6374
6841
|
const pointTargetBaseOptions = () => {
|
|
@@ -6628,7 +7095,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6628
7095
|
const groupQueue = sharer.getSharedStorage(keyGroupQueue);
|
|
6629
7096
|
const enableSnapToGrid = sharer.getSharedStorage(keyEnableSnapToGrid);
|
|
6630
7097
|
if (actionType === "drag") {
|
|
7098
|
+
hasChangedData = true;
|
|
6631
7099
|
inBusyMode = "drag";
|
|
7100
|
+
eventHub.trigger(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, { show: false });
|
|
6632
7101
|
if (data && (elems == null ? void 0 : elems.length) === 1 && moveOriginalStartElementSize && originalStart && end && ((_b = (_a = elems[0]) == null ? void 0 : _a.operations) == null ? void 0 : _b.locked) !== true) {
|
|
6633
7102
|
const { moveX, moveY } = calcMoveInGroup(originalStart, end, groupQueue);
|
|
6634
7103
|
let totalMoveX = calculator.toGridNum(moveX / scale);
|
|
@@ -6671,6 +7140,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6671
7140
|
}
|
|
6672
7141
|
viewer.drawFrame();
|
|
6673
7142
|
} else if (actionType === "drag-list") {
|
|
7143
|
+
hasChangedData = true;
|
|
6674
7144
|
inBusyMode = "drag-list";
|
|
6675
7145
|
if (data && originalStart && start && end && (elems == null ? void 0 : elems.length) > 1) {
|
|
6676
7146
|
const moveX = (end.x - start.x) / scale;
|
|
@@ -6698,6 +7168,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6698
7168
|
viewer.drawFrame();
|
|
6699
7169
|
} else if (actionType === "resize") {
|
|
6700
7170
|
if (data && (elems == null ? void 0 : elems.length) === 1 && originalStart && moveOriginalStartElementSize && (resizeType == null ? void 0 : resizeType.startsWith("resize-"))) {
|
|
7171
|
+
hasChangedData = true;
|
|
6701
7172
|
inBusyMode = "resize";
|
|
6702
7173
|
const pointGroupQueue = [];
|
|
6703
7174
|
groupQueue.forEach((group) => {
|
|
@@ -6784,6 +7255,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6784
7255
|
prevPoint = null;
|
|
6785
7256
|
moveOriginalStartPoint = null;
|
|
6786
7257
|
moveOriginalStartElementSize = null;
|
|
7258
|
+
if (actionType === "drag") {
|
|
7259
|
+
eventHub.trigger(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, { show: true });
|
|
7260
|
+
}
|
|
6787
7261
|
if (actionType === "resize" && resizeType) {
|
|
6788
7262
|
sharer.setSharedStorage(keyResizeType, null);
|
|
6789
7263
|
needDrawFrame = true;
|
|
@@ -6838,18 +7312,21 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6838
7312
|
}
|
|
6839
7313
|
if (data && ["drag", "drag-list", "drag-list-end", "resize"].includes(actionType)) {
|
|
6840
7314
|
let type = "dragElement";
|
|
6841
|
-
|
|
7315
|
+
if (hasChangedData) {
|
|
7316
|
+
eventHub.trigger(coreEventKeys.CHANGE, { data, type, selectedElements, hoverElement });
|
|
7317
|
+
hasChangedData = false;
|
|
7318
|
+
}
|
|
6842
7319
|
}
|
|
6843
7320
|
viewer.drawFrame();
|
|
6844
7321
|
};
|
|
6845
7322
|
finalDrawFrame();
|
|
6846
7323
|
},
|
|
6847
7324
|
pointLeave() {
|
|
6848
|
-
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
7325
|
+
inBusyMode = null;
|
|
7326
|
+
sharer.setSharedStorage(keyResizeType, null);
|
|
7327
|
+
eventHub.trigger(coreEventKeys.CURSOR, {
|
|
7328
|
+
type: "default"
|
|
7329
|
+
});
|
|
6853
7330
|
},
|
|
6854
7331
|
doubleClick(e) {
|
|
6855
7332
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -6879,6 +7356,12 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6879
7356
|
}
|
|
6880
7357
|
sharer.setSharedStorage(keyActionType, null);
|
|
6881
7358
|
},
|
|
7359
|
+
wheel() {
|
|
7360
|
+
updateSelectedElemenetController();
|
|
7361
|
+
},
|
|
7362
|
+
wheelScale() {
|
|
7363
|
+
updateSelectedElemenetController();
|
|
7364
|
+
},
|
|
6882
7365
|
contextMenu: (e) => {
|
|
6883
7366
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6884
7367
|
const groupQueue = sharer.getSharedStorage(keyGroupQueue);
|
|
@@ -6938,11 +7421,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6938
7421
|
const isMoving = sharedStore[keyIsMoving];
|
|
6939
7422
|
const enableSnapToGrid = sharedStore[keyEnableSnapToGrid];
|
|
6940
7423
|
const drawBaseOpts = { calculator, viewScaleInfo, viewSizeInfo, style };
|
|
6941
|
-
const selectedElementController =
|
|
6942
|
-
groupQueue,
|
|
6943
|
-
controllerSize: 10,
|
|
6944
|
-
viewScaleInfo
|
|
6945
|
-
}) : null;
|
|
7424
|
+
const selectedElementController = sharedStore[keySelectedElementController];
|
|
6946
7425
|
const isHoverLocked = !!((_a = hoverElement == null ? void 0 : hoverElement.operations) == null ? void 0 : _a.locked);
|
|
6947
7426
|
if ((groupQueue == null ? void 0 : groupQueue.length) > 0) {
|
|
6948
7427
|
drawGroupQueueVertexesWrappers(overlayContext, groupQueueVertexesList, drawBaseOpts);
|
|
@@ -6950,11 +7429,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6950
7429
|
if (isHoverLocked) {
|
|
6951
7430
|
drawLockedVertexesWrapper(overlayContext, hoverElementVertexes, {
|
|
6952
7431
|
...drawBaseOpts,
|
|
6953
|
-
controller:
|
|
6954
|
-
groupQueue,
|
|
6955
|
-
controllerSize: 10,
|
|
6956
|
-
viewScaleInfo
|
|
6957
|
-
}),
|
|
7432
|
+
controller: selectedElementController,
|
|
6958
7433
|
style
|
|
6959
7434
|
});
|
|
6960
7435
|
} else {
|
|
@@ -6967,6 +7442,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6967
7442
|
element: elem,
|
|
6968
7443
|
calculator,
|
|
6969
7444
|
hideControllers: !!isMoving && actionType === "drag",
|
|
7445
|
+
rotateControllerPattern,
|
|
6970
7446
|
style
|
|
6971
7447
|
});
|
|
6972
7448
|
if (actionType === "drag") {
|
|
@@ -6996,11 +7472,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6996
7472
|
if (isHoverLocked) {
|
|
6997
7473
|
drawLockedVertexesWrapper(overlayContext, hoverElementVertexes, {
|
|
6998
7474
|
...drawBaseOpts,
|
|
6999
|
-
controller:
|
|
7000
|
-
groupQueue,
|
|
7001
|
-
controllerSize: 10,
|
|
7002
|
-
viewScaleInfo
|
|
7003
|
-
}),
|
|
7475
|
+
controller: selectedElementController,
|
|
7004
7476
|
style
|
|
7005
7477
|
});
|
|
7006
7478
|
} else {
|
|
@@ -7013,6 +7485,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7013
7485
|
element: elem,
|
|
7014
7486
|
calculator,
|
|
7015
7487
|
hideControllers: !!isMoving && actionType === "drag",
|
|
7488
|
+
rotateControllerPattern,
|
|
7016
7489
|
style
|
|
7017
7490
|
});
|
|
7018
7491
|
if (actionType === "drag") {
|
|
@@ -7417,7 +7890,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7417
7890
|
const fontSize = 10;
|
|
7418
7891
|
const fontWeight = 100;
|
|
7419
7892
|
const lineSize = 1;
|
|
7420
|
-
const fontFamily
|
|
7893
|
+
const fontFamily = "monospace";
|
|
7421
7894
|
const background = "#FFFFFFA8";
|
|
7422
7895
|
const borderColor = "#00000080";
|
|
7423
7896
|
const scaleColor = "#000000";
|
|
@@ -7536,7 +8009,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7536
8009
|
ctx.$setFont({
|
|
7537
8010
|
fontWeight,
|
|
7538
8011
|
fontSize,
|
|
7539
|
-
fontFamily
|
|
8012
|
+
fontFamily
|
|
7540
8013
|
});
|
|
7541
8014
|
ctx.fillText(`${item.num}`, item.position + fontStart, fontStart);
|
|
7542
8015
|
}
|
|
@@ -7573,7 +8046,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7573
8046
|
ctx.$setFont({
|
|
7574
8047
|
fontWeight,
|
|
7575
8048
|
fontSize,
|
|
7576
|
-
fontFamily
|
|
8049
|
+
fontFamily
|
|
7577
8050
|
});
|
|
7578
8051
|
ctx.fillText(numText, fontStart + fontSize, item.position + fontStart);
|
|
7579
8052
|
});
|
|
@@ -8014,235 +8487,6 @@ var __privateMethod = (obj, member, method) => {
|
|
|
8014
8487
|
}
|
|
8015
8488
|
};
|
|
8016
8489
|
};
|
|
8017
|
-
const fontFamily = "monospace";
|
|
8018
|
-
function drawSizeInfoText(ctx, opts) {
|
|
8019
|
-
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
8020
|
-
const { textColor: textColor2, textBackground } = style;
|
|
8021
|
-
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
8022
|
-
ctx.$setFont({
|
|
8023
|
-
fontWeight: "300",
|
|
8024
|
-
fontSize: fontSize2,
|
|
8025
|
-
fontFamily
|
|
8026
|
-
});
|
|
8027
|
-
const padding = (lineHeight2 - fontSize2) / 2;
|
|
8028
|
-
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
8029
|
-
const bgStart = {
|
|
8030
|
-
x: point.x - textWidth / 2 - padding,
|
|
8031
|
-
y: point.y
|
|
8032
|
-
};
|
|
8033
|
-
const bgEnd = {
|
|
8034
|
-
x: bgStart.x + textWidth + padding * 2,
|
|
8035
|
-
y: bgStart.y + fontSize2 + padding
|
|
8036
|
-
};
|
|
8037
|
-
const textStart = {
|
|
8038
|
-
x: point.x - textWidth / 2,
|
|
8039
|
-
y: point.y
|
|
8040
|
-
};
|
|
8041
|
-
ctx.setLineDash([]);
|
|
8042
|
-
ctx.fillStyle = textBackground;
|
|
8043
|
-
ctx.beginPath();
|
|
8044
|
-
ctx.moveTo(bgStart.x, bgStart.y);
|
|
8045
|
-
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
8046
|
-
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
8047
|
-
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
8048
|
-
ctx.closePath();
|
|
8049
|
-
ctx.fill();
|
|
8050
|
-
ctx.fillStyle = textColor2;
|
|
8051
|
-
ctx.textBaseline = "top";
|
|
8052
|
-
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
8053
|
-
});
|
|
8054
|
-
}
|
|
8055
|
-
function drawPositionInfoText(ctx, opts) {
|
|
8056
|
-
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
8057
|
-
const { textBackground, textColor: textColor2 } = style;
|
|
8058
|
-
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
8059
|
-
ctx.$setFont({
|
|
8060
|
-
fontWeight: "300",
|
|
8061
|
-
fontSize: fontSize2,
|
|
8062
|
-
fontFamily
|
|
8063
|
-
});
|
|
8064
|
-
const padding = (lineHeight2 - fontSize2) / 2;
|
|
8065
|
-
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
8066
|
-
const bgStart = {
|
|
8067
|
-
x: point.x,
|
|
8068
|
-
y: point.y
|
|
8069
|
-
};
|
|
8070
|
-
const bgEnd = {
|
|
8071
|
-
x: bgStart.x + textWidth + padding * 2,
|
|
8072
|
-
y: bgStart.y + fontSize2 + padding
|
|
8073
|
-
};
|
|
8074
|
-
const textStart = {
|
|
8075
|
-
x: point.x + padding,
|
|
8076
|
-
y: point.y
|
|
8077
|
-
};
|
|
8078
|
-
ctx.setLineDash([]);
|
|
8079
|
-
ctx.fillStyle = textBackground;
|
|
8080
|
-
ctx.beginPath();
|
|
8081
|
-
ctx.moveTo(bgStart.x, bgStart.y);
|
|
8082
|
-
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
8083
|
-
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
8084
|
-
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
8085
|
-
ctx.closePath();
|
|
8086
|
-
ctx.fill();
|
|
8087
|
-
ctx.fillStyle = textColor2;
|
|
8088
|
-
ctx.textBaseline = "top";
|
|
8089
|
-
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
8090
|
-
});
|
|
8091
|
-
}
|
|
8092
|
-
function drawAngleInfoText(ctx, opts) {
|
|
8093
|
-
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
8094
|
-
const { textBackground, textColor: textColor2 } = style;
|
|
8095
|
-
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
8096
|
-
ctx.$setFont({
|
|
8097
|
-
fontWeight: "300",
|
|
8098
|
-
fontSize: fontSize2,
|
|
8099
|
-
fontFamily
|
|
8100
|
-
});
|
|
8101
|
-
const padding = (lineHeight2 - fontSize2) / 2;
|
|
8102
|
-
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
8103
|
-
const bgStart = {
|
|
8104
|
-
x: point.x,
|
|
8105
|
-
y: point.y
|
|
8106
|
-
};
|
|
8107
|
-
const bgEnd = {
|
|
8108
|
-
x: bgStart.x + textWidth + padding * 2,
|
|
8109
|
-
y: bgStart.y + fontSize2 + padding
|
|
8110
|
-
};
|
|
8111
|
-
const textStart = {
|
|
8112
|
-
x: point.x + padding,
|
|
8113
|
-
y: point.y
|
|
8114
|
-
};
|
|
8115
|
-
ctx.setLineDash([]);
|
|
8116
|
-
ctx.fillStyle = textBackground;
|
|
8117
|
-
ctx.beginPath();
|
|
8118
|
-
ctx.moveTo(bgStart.x, bgStart.y);
|
|
8119
|
-
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
8120
|
-
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
8121
|
-
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
8122
|
-
ctx.closePath();
|
|
8123
|
-
ctx.fill();
|
|
8124
|
-
ctx.fillStyle = textColor2;
|
|
8125
|
-
ctx.textBaseline = "top";
|
|
8126
|
-
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
8127
|
-
});
|
|
8128
|
-
}
|
|
8129
|
-
const infoBackground = "#1973bac6";
|
|
8130
|
-
const infoTextColor = "#ffffff";
|
|
8131
|
-
const defaltStyle = {
|
|
8132
|
-
textBackground: infoBackground,
|
|
8133
|
-
textColor: infoTextColor
|
|
8134
|
-
};
|
|
8135
|
-
const infoFontSize = 10;
|
|
8136
|
-
const infoLineHeight = 16;
|
|
8137
|
-
const MiddlewareInfo = (opts, config) => {
|
|
8138
|
-
const { boardContent, calculator } = opts;
|
|
8139
|
-
const { overlayContext } = boardContent;
|
|
8140
|
-
const innerConfig = {
|
|
8141
|
-
...defaltStyle,
|
|
8142
|
-
...config
|
|
8143
|
-
};
|
|
8144
|
-
const { textBackground, textColor: textColor2 } = innerConfig;
|
|
8145
|
-
const style = {
|
|
8146
|
-
textBackground,
|
|
8147
|
-
textColor: textColor2
|
|
8148
|
-
};
|
|
8149
|
-
return {
|
|
8150
|
-
name: "@middleware/info",
|
|
8151
|
-
beforeDrawFrame({ snapshot }) {
|
|
8152
|
-
const { sharedStore } = snapshot;
|
|
8153
|
-
const selectedElementList = sharedStore[keySelectedElementList];
|
|
8154
|
-
const actionType = sharedStore[keyActionType];
|
|
8155
|
-
const groupQueue = sharedStore[keyGroupQueue] || [];
|
|
8156
|
-
if (selectedElementList.length === 1) {
|
|
8157
|
-
const elem = selectedElementList[0];
|
|
8158
|
-
if (elem && ["select", "drag", "resize"].includes(actionType)) {
|
|
8159
|
-
const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
|
|
8160
|
-
const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
|
|
8161
|
-
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = elem;
|
|
8162
|
-
const totalGroupQueue = [
|
|
8163
|
-
...groupQueue,
|
|
8164
|
-
...[
|
|
8165
|
-
{
|
|
8166
|
-
uuid: createUUID(),
|
|
8167
|
-
x: x2,
|
|
8168
|
-
y: y2,
|
|
8169
|
-
w: w2,
|
|
8170
|
-
h: h2,
|
|
8171
|
-
angle: angle2,
|
|
8172
|
-
type: "group",
|
|
8173
|
-
detail: { children: [] }
|
|
8174
|
-
}
|
|
8175
|
-
]
|
|
8176
|
-
];
|
|
8177
|
-
const calcOpts = { viewScaleInfo, viewSizeInfo };
|
|
8178
|
-
const rangeRectInfo = calculator.calcViewRectInfoFromOrigin(elem.uuid, calcOpts);
|
|
8179
|
-
let totalAngle = 0;
|
|
8180
|
-
totalGroupQueue.forEach((group) => {
|
|
8181
|
-
totalAngle += group.angle || 0;
|
|
8182
|
-
});
|
|
8183
|
-
const totalRadian = parseAngleToRadian(limitAngle(0 - totalAngle));
|
|
8184
|
-
if (rangeRectInfo) {
|
|
8185
|
-
const elemCenter = rangeRectInfo == null ? void 0 : rangeRectInfo.center;
|
|
8186
|
-
const rectInfo = {
|
|
8187
|
-
topLeft: rotatePoint(elemCenter, rangeRectInfo.topLeft, totalRadian),
|
|
8188
|
-
topRight: rotatePoint(elemCenter, rangeRectInfo.topRight, totalRadian),
|
|
8189
|
-
bottomRight: rotatePoint(elemCenter, rangeRectInfo.bottomRight, totalRadian),
|
|
8190
|
-
bottomLeft: rotatePoint(elemCenter, rangeRectInfo.bottomLeft, totalRadian),
|
|
8191
|
-
center: rotatePoint(elemCenter, rangeRectInfo.center, totalRadian),
|
|
8192
|
-
top: rotatePoint(elemCenter, rangeRectInfo.top, totalRadian),
|
|
8193
|
-
right: rotatePoint(elemCenter, rangeRectInfo.right, totalRadian),
|
|
8194
|
-
bottom: rotatePoint(elemCenter, rangeRectInfo.bottom, totalRadian),
|
|
8195
|
-
left: rotatePoint(elemCenter, rangeRectInfo.left, totalRadian)
|
|
8196
|
-
};
|
|
8197
|
-
const x22 = formatNumber(elem.x, { decimalPlaces: 2 });
|
|
8198
|
-
const y22 = formatNumber(elem.y, { decimalPlaces: 2 });
|
|
8199
|
-
const w22 = formatNumber(elem.w, { decimalPlaces: 2 });
|
|
8200
|
-
const h22 = formatNumber(elem.h, { decimalPlaces: 2 });
|
|
8201
|
-
const xyText = `${formatNumber(x22, { decimalPlaces: 0 })},${formatNumber(y22, { decimalPlaces: 0 })}`;
|
|
8202
|
-
const whText = `${formatNumber(w22, { decimalPlaces: 0 })}x${formatNumber(h22, { decimalPlaces: 0 })}`;
|
|
8203
|
-
const angleText = `${formatNumber(elem.angle || 0, { decimalPlaces: 0 })}°`;
|
|
8204
|
-
drawSizeInfoText(overlayContext, {
|
|
8205
|
-
point: {
|
|
8206
|
-
x: rectInfo.bottom.x,
|
|
8207
|
-
y: rectInfo.bottom.y + infoFontSize
|
|
8208
|
-
},
|
|
8209
|
-
rotateCenter: rectInfo.center,
|
|
8210
|
-
angle: totalAngle,
|
|
8211
|
-
text: whText,
|
|
8212
|
-
fontSize: infoFontSize,
|
|
8213
|
-
lineHeight: infoLineHeight,
|
|
8214
|
-
style
|
|
8215
|
-
});
|
|
8216
|
-
drawPositionInfoText(overlayContext, {
|
|
8217
|
-
point: {
|
|
8218
|
-
x: rectInfo.topLeft.x,
|
|
8219
|
-
y: rectInfo.topLeft.y - infoFontSize * 2
|
|
8220
|
-
},
|
|
8221
|
-
rotateCenter: rectInfo.center,
|
|
8222
|
-
angle: totalAngle,
|
|
8223
|
-
text: xyText,
|
|
8224
|
-
fontSize: infoFontSize,
|
|
8225
|
-
lineHeight: infoLineHeight,
|
|
8226
|
-
style
|
|
8227
|
-
});
|
|
8228
|
-
drawAngleInfoText(overlayContext, {
|
|
8229
|
-
point: {
|
|
8230
|
-
x: rectInfo.top.x + infoFontSize,
|
|
8231
|
-
y: rectInfo.top.y - infoFontSize * 2
|
|
8232
|
-
},
|
|
8233
|
-
rotateCenter: rectInfo.center,
|
|
8234
|
-
angle: totalAngle,
|
|
8235
|
-
text: angleText,
|
|
8236
|
-
fontSize: infoFontSize,
|
|
8237
|
-
lineHeight: infoLineHeight,
|
|
8238
|
-
style
|
|
8239
|
-
});
|
|
8240
|
-
}
|
|
8241
|
-
}
|
|
8242
|
-
}
|
|
8243
|
-
}
|
|
8244
|
-
};
|
|
8245
|
-
};
|
|
8246
8490
|
const MiddlewarePointer = (opts) => {
|
|
8247
8491
|
const { boardContent, eventHub, sharer } = opts;
|
|
8248
8492
|
const canvas = boardContent.boardContext.canvas;
|
|
@@ -8286,16 +8530,16 @@ var __privateMethod = (obj, member, method) => {
|
|
|
8286
8530
|
};
|
|
8287
8531
|
class Core {
|
|
8288
8532
|
constructor(container, opts) {
|
|
8289
|
-
__privateAdd(this,
|
|
8290
|
-
__privateAdd(this, _board
|
|
8533
|
+
__privateAdd(this, _Core_instances);
|
|
8534
|
+
__privateAdd(this, _board);
|
|
8291
8535
|
// #opts: CoreOptions;
|
|
8292
|
-
__privateAdd(this, _canvas
|
|
8293
|
-
__privateAdd(this, _container2
|
|
8536
|
+
__privateAdd(this, _canvas);
|
|
8537
|
+
__privateAdd(this, _container2);
|
|
8294
8538
|
const { devicePixelRatio = 1, width, height, createCustomContext2D } = opts;
|
|
8295
8539
|
__privateSet(this, _container2, container);
|
|
8296
8540
|
const canvas = document.createElement("canvas");
|
|
8297
8541
|
__privateSet(this, _canvas, canvas);
|
|
8298
|
-
__privateMethod(this,
|
|
8542
|
+
__privateMethod(this, _Core_instances, initContainer_fn).call(this);
|
|
8299
8543
|
container.appendChild(canvas);
|
|
8300
8544
|
const boardContent = createBoardContent(canvas, { width, height, devicePixelRatio, offscreen: true, createCustomContext2D });
|
|
8301
8545
|
const board = new Board({ boardContent, container });
|
|
@@ -8392,7 +8636,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
8392
8636
|
_board = new WeakMap();
|
|
8393
8637
|
_canvas = new WeakMap();
|
|
8394
8638
|
_container2 = new WeakMap();
|
|
8395
|
-
|
|
8639
|
+
_Core_instances = new WeakSet();
|
|
8396
8640
|
initContainer_fn = function() {
|
|
8397
8641
|
const container = __privateGet(this, _container2);
|
|
8398
8642
|
container.style.position = "relative";
|