@idraw/core 0.4.0-beta.40 → 0.4.0-beta.42
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/board/index.d.ts +2 -4
- package/dist/esm/board/index.js +20 -33
- package/dist/esm/index.d.ts +22 -7
- package/dist/esm/index.js +233 -2
- package/dist/esm/middleware/dragger/index.d.ts +2 -2
- package/dist/esm/middleware/info/draw-info.js +3 -3
- package/dist/esm/middleware/info/index.d.ts +2 -2
- package/dist/esm/middleware/layout-selector/index.d.ts +2 -2
- package/dist/esm/middleware/layout-selector/index.js +24 -2
- package/dist/esm/middleware/layout-selector/util.js +19 -4
- package/dist/esm/middleware/pointer/index.d.ts +2 -2
- package/dist/esm/middleware/pointer/index.js +11 -12
- package/dist/esm/middleware/ruler/config.js +1 -1
- package/dist/esm/middleware/ruler/index.d.ts +2 -2
- package/dist/esm/middleware/ruler/index.js +1 -1
- package/dist/esm/middleware/ruler/util.js +5 -4
- package/dist/esm/middleware/scaler/index.d.ts +2 -2
- package/dist/esm/middleware/scroller/index.d.ts +2 -2
- package/dist/esm/middleware/scroller/util.js +1 -1
- package/dist/esm/middleware/selector/draw-base.js +2 -2
- package/dist/esm/middleware/selector/draw-debug.js +1 -1
- package/dist/esm/middleware/selector/draw-wrapper.js +15 -5
- package/dist/esm/middleware/selector/index.d.ts +2 -2
- package/dist/esm/middleware/selector/index.js +35 -5
- package/dist/esm/middleware/selector/types.d.ts +2 -2
- package/dist/esm/middleware/text-editor/index.d.ts +2 -2
- package/dist/esm/middleware/text-editor/index.js +85 -22
- package/dist/esm/record.d.ts +5 -0
- package/dist/esm/record.js +38 -0
- package/dist/index.global.js +1040 -135
- package/dist/index.global.min.js +1 -1
- package/package.json +4 -4
package/dist/index.global.js
CHANGED
|
@@ -8,7 +8,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
8
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
9
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
10
10
|
|
|
11
|
-
var _opts, _store, _hasDestroyed, _BoardWatcher_instances, init_fn, _onWheel, _onContextMenu, _onClick, _onPointLeave, _onPointEnd, _onPointMove, _onPointStart, _onHover, isInTarget_fn, getPoint_fn, isVaildPoint_fn, _activeStore, _sharedStore, _opts2, _drawFrameSnapshotQueue, _drawFrameStatus, _Viewer_instances, init_fn2, drawAnimationFrame_fn, _opts3, _middlewareMap,
|
|
11
|
+
var _opts, _store, _hasDestroyed, _BoardWatcher_instances, init_fn, _onWheel, _onContextMenu, _onClick, _onPointLeave, _onPointEnd, _onPointMove, _onPointStart, _onHover, isInTarget_fn, getPoint_fn, isVaildPoint_fn, _activeStore, _sharedStore, _opts2, _drawFrameSnapshotQueue, _drawFrameStatus, _Viewer_instances, init_fn2, drawAnimationFrame_fn, _opts3, _middlewareMap, _activeMiddlewareObjs, _watcher, _renderer, _sharer, _viewer, _calculator, _eventHub, _hasDestroyed2, _Board_instances, init_fn3, handlePointStart_fn, handlePointEnd_fn, handlePointMove_fn, handlePointLeave_fn, handleHover_fn, handleDoubleClick_fn, handleContextMenu_fn, handleWheel_fn, handleWheelScale_fn, handleScrollX_fn, handleScrollY_fn, handleResize_fn, handleClear_fn, handleBeforeDrawFrame_fn, handleAfterDrawFrame_fn, resetActiveMiddlewareObjs_fn, _eventHub2, _container, _cursorType, _resizeCursorBaseImage, _cursorImageMap, _Cursor_instances, init_fn4, loadResizeCursorBaseImage_fn, resetCursor_fn, setCursorResize_fn, appendRotateResizeImage_fn, _board, _canvas, _container2, _Core_instances, initContainer_fn;
|
|
12
12
|
function isColorStr(color2) {
|
|
13
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));
|
|
14
14
|
}
|
|
@@ -39,30 +39,38 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
39
39
|
}
|
|
40
40
|
return `${_createStr()}${_createStr()}-${_createStr()}-${_createStr()}-${_createStr()}-${_createStr()}${_createStr()}${_createStr()}`;
|
|
41
41
|
}
|
|
42
|
-
function limitHexStr(str) {
|
|
42
|
+
function limitHexStr(str, seed) {
|
|
43
43
|
let count = 0;
|
|
44
44
|
for (let i = 0; i < str.length; i++) {
|
|
45
|
-
count += str.charCodeAt(i)
|
|
45
|
+
count += str.charCodeAt(i);
|
|
46
46
|
}
|
|
47
|
-
return count.toString(16).substring(0, 4);
|
|
47
|
+
return (count + seed).toString(16).substring(0, 4);
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function sumCharCodes(str) {
|
|
50
|
+
let sum = 0;
|
|
51
|
+
for (let i = 0; i < str.length; i++) {
|
|
52
|
+
sum += str.charCodeAt(i);
|
|
53
|
+
}
|
|
54
|
+
return sum;
|
|
55
|
+
}
|
|
56
|
+
function createAssetId(assetStr, elemUUID) {
|
|
50
57
|
const len = assetStr.length;
|
|
58
|
+
const seed = sumCharCodes(elemUUID);
|
|
51
59
|
const mid = Math.floor(len / 2);
|
|
52
|
-
const start4 = assetStr.substring(0, 4).
|
|
53
|
-
const end4 = assetStr.substring(0, 4).
|
|
54
|
-
const str1 = limitHexStr(len.toString(16).
|
|
55
|
-
const str2 = limitHexStr(assetStr.substring(mid - 4, mid).
|
|
56
|
-
const str3 = limitHexStr(assetStr.substring(mid - 8, mid - 4).
|
|
57
|
-
const str4 = limitHexStr(assetStr.substring(mid - 12, mid - 8).
|
|
58
|
-
const str5 = limitHexStr(assetStr.substring(mid - 16, mid - 12).
|
|
59
|
-
const str6 = limitHexStr(assetStr.substring(mid, mid + 4).
|
|
60
|
-
const str7 = limitHexStr(assetStr.substring(mid + 4, mid + 8).
|
|
61
|
-
const str8 = limitHexStr(end4.
|
|
60
|
+
const start4 = assetStr.substring(0, 4).padStart(4, "0");
|
|
61
|
+
const end4 = assetStr.substring(0, 4).padStart(4, "0");
|
|
62
|
+
const str1 = limitHexStr(len.toString(16).padStart(4, start4), seed).padStart(4, "0");
|
|
63
|
+
const str2 = limitHexStr(assetStr.substring(mid - 4, mid).padStart(4, start4), seed).padStart(4, "0");
|
|
64
|
+
const str3 = limitHexStr(assetStr.substring(mid - 8, mid - 4).padStart(4, start4), seed).padStart(4, "0");
|
|
65
|
+
const str4 = limitHexStr(assetStr.substring(mid - 12, mid - 8).padStart(4, start4), seed).padStart(4, "0");
|
|
66
|
+
const str5 = limitHexStr(assetStr.substring(mid - 16, mid - 12).padStart(4, end4), seed).padStart(4, "0");
|
|
67
|
+
const str6 = limitHexStr(assetStr.substring(mid, mid + 4).padStart(4, end4), seed).padStart(4, "0");
|
|
68
|
+
const str7 = limitHexStr(assetStr.substring(mid + 4, mid + 8).padStart(4, end4), seed).padStart(4, "0");
|
|
69
|
+
const str8 = limitHexStr(end4.padStart(4, start4).padStart(4, end4), seed);
|
|
62
70
|
return `@assets/${str1}${str2}-${str3}-${str4}-${str5}-${str6}${str7}${str8}`;
|
|
63
71
|
}
|
|
64
72
|
function isAssetId(id) {
|
|
65
|
-
return /^@assets\/[0-9a-z
|
|
73
|
+
return /^@assets\/[0-9a-z-]{0,}$/.test(`${id}`);
|
|
66
74
|
}
|
|
67
75
|
(function(s, e) {
|
|
68
76
|
var t = {};
|
|
@@ -1092,7 +1100,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1092
1100
|
return ctxSize;
|
|
1093
1101
|
}
|
|
1094
1102
|
function calcElementsViewInfo(elements, prevViewSize, options) {
|
|
1095
|
-
const contextSize = calcElementsContextSize(elements, {
|
|
1103
|
+
const contextSize = calcElementsContextSize(elements, {
|
|
1104
|
+
viewWidth: prevViewSize.width,
|
|
1105
|
+
viewHeight: prevViewSize.height,
|
|
1106
|
+
extend: options === null || options === void 0 ? void 0 : options.extend
|
|
1107
|
+
});
|
|
1096
1108
|
if ((options === null || options === void 0 ? void 0 : options.extend) === true) {
|
|
1097
1109
|
contextSize.contextWidth = Math.max(contextSize.contextWidth, prevViewSize.contextWidth);
|
|
1098
1110
|
contextSize.contextHeight = Math.max(contextSize.contextHeight, prevViewSize.contextHeight);
|
|
@@ -1181,7 +1193,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1181
1193
|
for (let i = 0; i < position.length; i++) {
|
|
1182
1194
|
const pos = position[i];
|
|
1183
1195
|
const item = tempList[pos];
|
|
1184
|
-
if (i < position.length - 1 && item.type === "group") {
|
|
1196
|
+
if (i < position.length - 1 && (item === null || item === void 0 ? void 0 : item.type) === "group") {
|
|
1185
1197
|
tempList = item.detail.children;
|
|
1186
1198
|
} else if (i === position.length - 1) {
|
|
1187
1199
|
result = item;
|
|
@@ -1624,15 +1636,38 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1624
1636
|
const topLeftSize = createControllerElementSizeFromCenter(topLeftCenter, { size: ctrlSize, angle: totalAngle });
|
|
1625
1637
|
const topRightSize = createControllerElementSizeFromCenter(topRightCenter, { size: ctrlSize, angle: totalAngle });
|
|
1626
1638
|
const bottomLeftSize = createControllerElementSizeFromCenter(bottomLeftCenter, { size: ctrlSize, angle: totalAngle });
|
|
1627
|
-
const bottomRightSize = createControllerElementSizeFromCenter(bottomRightCenter, {
|
|
1639
|
+
const bottomRightSize = createControllerElementSizeFromCenter(bottomRightCenter, {
|
|
1640
|
+
size: ctrlSize,
|
|
1641
|
+
angle: totalAngle
|
|
1642
|
+
});
|
|
1628
1643
|
const topLeftVertexes = calcElementVertexes(topLeftSize);
|
|
1629
1644
|
const topRightVertexes = calcElementVertexes(topRightSize);
|
|
1630
1645
|
const bottomLeftVertexes = calcElementVertexes(bottomLeftSize);
|
|
1631
1646
|
const bottomRightVertexes = calcElementVertexes(bottomRightSize);
|
|
1632
|
-
const topVertexes = [
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1647
|
+
const topVertexes = [
|
|
1648
|
+
topLeftVertexes[1],
|
|
1649
|
+
topRightVertexes[0],
|
|
1650
|
+
topRightVertexes[3],
|
|
1651
|
+
topLeftVertexes[2]
|
|
1652
|
+
];
|
|
1653
|
+
const rightVertexes = [
|
|
1654
|
+
topRightVertexes[3],
|
|
1655
|
+
topRightVertexes[2],
|
|
1656
|
+
bottomRightVertexes[1],
|
|
1657
|
+
bottomRightVertexes[0]
|
|
1658
|
+
];
|
|
1659
|
+
const bottomVertexes = [
|
|
1660
|
+
bottomLeftVertexes[1],
|
|
1661
|
+
bottomRightVertexes[0],
|
|
1662
|
+
bottomRightVertexes[3],
|
|
1663
|
+
bottomLeftVertexes[2]
|
|
1664
|
+
];
|
|
1665
|
+
const leftVertexes = [
|
|
1666
|
+
topLeftVertexes[3],
|
|
1667
|
+
topLeftVertexes[2],
|
|
1668
|
+
bottomLeftVertexes[1],
|
|
1669
|
+
bottomLeftVertexes[0]
|
|
1670
|
+
];
|
|
1636
1671
|
const topMiddleVertexes = calcElementVertexes(topMiddleSize);
|
|
1637
1672
|
const rightMiddleVertexes = calcElementVertexes(rightMiddleSize);
|
|
1638
1673
|
const bottomMiddleVertexes = calcElementVertexes(bottomMiddleSize);
|
|
@@ -1754,10 +1789,30 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1754
1789
|
const topRightVertexes = calcElementVertexes(topRightSize);
|
|
1755
1790
|
const bottomLeftVertexes = calcElementVertexes(bottomLeftSize);
|
|
1756
1791
|
const bottomRightVertexes = calcElementVertexes(bottomRightSize);
|
|
1757
|
-
const topVertexes = [
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1792
|
+
const topVertexes = [
|
|
1793
|
+
topLeftVertexes[1],
|
|
1794
|
+
topRightVertexes[0],
|
|
1795
|
+
topRightVertexes[3],
|
|
1796
|
+
topLeftVertexes[2]
|
|
1797
|
+
];
|
|
1798
|
+
const rightVertexes = [
|
|
1799
|
+
topRightVertexes[3],
|
|
1800
|
+
topRightVertexes[2],
|
|
1801
|
+
bottomRightVertexes[1],
|
|
1802
|
+
bottomRightVertexes[0]
|
|
1803
|
+
];
|
|
1804
|
+
const bottomVertexes = [
|
|
1805
|
+
bottomLeftVertexes[1],
|
|
1806
|
+
bottomRightVertexes[0],
|
|
1807
|
+
bottomRightVertexes[3],
|
|
1808
|
+
bottomLeftVertexes[2]
|
|
1809
|
+
];
|
|
1810
|
+
const leftVertexes = [
|
|
1811
|
+
topLeftVertexes[3],
|
|
1812
|
+
topLeftVertexes[2],
|
|
1813
|
+
bottomLeftVertexes[1],
|
|
1814
|
+
bottomLeftVertexes[0]
|
|
1815
|
+
];
|
|
1761
1816
|
const topMiddleVertexes = calcElementVertexes(topMiddleSize);
|
|
1762
1817
|
const rightMiddleVertexes = calcElementVertexes(rightMiddleSize);
|
|
1763
1818
|
const bottomMiddleVertexes = calcElementVertexes(bottomMiddleSize);
|
|
@@ -1852,6 +1907,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1852
1907
|
}
|
|
1853
1908
|
return parseFloat(num.toFixed(decimalPlaces));
|
|
1854
1909
|
}
|
|
1910
|
+
const defaultText = "Text Element";
|
|
1855
1911
|
function getDefaultElementDetailConfig() {
|
|
1856
1912
|
const config = {
|
|
1857
1913
|
boxSizing: "border-box",
|
|
@@ -1876,6 +1932,53 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1876
1932
|
};
|
|
1877
1933
|
return config;
|
|
1878
1934
|
}
|
|
1935
|
+
function getDefaultElementRectDetail() {
|
|
1936
|
+
const detail = {
|
|
1937
|
+
background: "#D9D9D9"
|
|
1938
|
+
};
|
|
1939
|
+
return detail;
|
|
1940
|
+
}
|
|
1941
|
+
function getDefaultElementCircleDetail() {
|
|
1942
|
+
const detail = {
|
|
1943
|
+
background: "#D9D9D9",
|
|
1944
|
+
radius: 0
|
|
1945
|
+
};
|
|
1946
|
+
return detail;
|
|
1947
|
+
}
|
|
1948
|
+
function getDefaultElementTextDetail(elementSize) {
|
|
1949
|
+
const detailConfig2 = getDefaultElementDetailConfig();
|
|
1950
|
+
const detail = {
|
|
1951
|
+
text: defaultText,
|
|
1952
|
+
color: detailConfig2.color,
|
|
1953
|
+
fontFamily: detailConfig2.fontFamily,
|
|
1954
|
+
fontWeight: detailConfig2.fontWeight,
|
|
1955
|
+
lineHeight: elementSize.w / defaultText.length,
|
|
1956
|
+
fontSize: elementSize.w / defaultText.length,
|
|
1957
|
+
textAlign: "center",
|
|
1958
|
+
verticalAlign: "middle"
|
|
1959
|
+
};
|
|
1960
|
+
return detail;
|
|
1961
|
+
}
|
|
1962
|
+
function getDefaultElementSVGDetail() {
|
|
1963
|
+
const detail = {
|
|
1964
|
+
svg: '<svg t="1701004189871" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3-12.3 12.7-12.1 32.9 0.6 45.3l183.7 179.1-43.4 252.9c-1.2 6.9-0.1 14.1 3.2 20.3 8.2 15.6 27.6 21.7 43.2 13.4L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3zM664.8 561.6l36.1 210.3L512 672.7 323.1 772l36.1-210.3-152.8-149L417.6 382 512 190.7 606.4 382l211.2 30.7-152.8 148.9z" fill="#2c2c2c"></path></svg>'
|
|
1965
|
+
};
|
|
1966
|
+
return detail;
|
|
1967
|
+
}
|
|
1968
|
+
function getDefaultElementImageDetail() {
|
|
1969
|
+
const detail = {
|
|
1970
|
+
src: "data:image/svg+xml;base64,PHN2ZyAgIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgd2lkdGg9IjIwMCIgaGVpZ2h0PSIyMDAiPjxwYXRoIGQ9Ik05MjggMTYwSDk2Yy0xNy43IDAtMzIgMTQuMy0zMiAzMnY2NDBjMCAxNy43IDE0LjMgMzIgMzIgMzJoODMyYzE3LjcgMCAzMi0xNC4zIDMyLTMyVjE5MmMwLTE3LjctMTQuMy0zMi0zMi0zMnogbS00MCA2MzJIMTM2di0zOS45bDEzOC41LTE2NC4zIDE1MC4xIDE3OEw2NTguMSA0ODkgODg4IDc2MS42Vjc5MnogbTAtMTI5LjhMNjY0LjIgMzk2LjhjLTMuMi0zLjgtOS0zLjgtMTIuMiAwTDQyNC42IDY2Ni40bC0xNDQtMTcwLjdjLTMuMi0zLjgtOS0zLjgtMTIuMiAwTDEzNiA2NTIuN1YyMzJoNzUydjQzMC4yeiIgIGZpbGw9IiM1MTUxNTEiPjwvcGF0aD48cGF0aCBkPSJNMzA0IDQ1NmM0OC42IDAgODgtMzkuNCA4OC04OHMtMzkuNC04OC04OC04OC04OCAzOS40LTg4IDg4IDM5LjQgODggODggODh6IG0wLTExNmMxNS41IDAgMjggMTIuNSAyOCAyOHMtMTIuNSAyOC0yOCAyOC0yOC0xMi41LTI4LTI4IDEyLjUtMjggMjgtMjh6IiAgZmlsbD0iIzUxNTE1MSI+PC9wYXRoPjwvc3ZnPg=="
|
|
1971
|
+
};
|
|
1972
|
+
return detail;
|
|
1973
|
+
}
|
|
1974
|
+
function getDefaultElementGroupDetail() {
|
|
1975
|
+
const detail = {
|
|
1976
|
+
children: [],
|
|
1977
|
+
background: "#D9D9D9",
|
|
1978
|
+
overflow: "hidden"
|
|
1979
|
+
};
|
|
1980
|
+
return detail;
|
|
1981
|
+
}
|
|
1879
1982
|
const defaultElemConfig$1 = getDefaultElementDetailConfig();
|
|
1880
1983
|
function calcViewBoxSize(viewElem, opts) {
|
|
1881
1984
|
const { viewScaleInfo } = opts;
|
|
@@ -1928,6 +2031,107 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1928
2031
|
radiusList
|
|
1929
2032
|
};
|
|
1930
2033
|
}
|
|
2034
|
+
function flattenObject(obj, parentKey = "", result = {}, opts) {
|
|
2035
|
+
Object.keys(obj).forEach((key2) => {
|
|
2036
|
+
var _a;
|
|
2037
|
+
const currentKey = parentKey ? `${parentKey}${isArrayIndex(key2) ? `[${key2}]` : `.${key2}`}` : key2;
|
|
2038
|
+
if (!((_a = opts === null || opts === void 0 ? void 0 : opts.ignorePaths) === null || _a === void 0 ? void 0 : _a.includes(currentKey))) {
|
|
2039
|
+
const value = obj[key2];
|
|
2040
|
+
if (isFlattenable(value)) {
|
|
2041
|
+
flattenObject(value, Array.isArray(value) ? currentKey : currentKey, result, opts);
|
|
2042
|
+
} else {
|
|
2043
|
+
result[currentKey] = value;
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
});
|
|
2047
|
+
return result;
|
|
2048
|
+
}
|
|
2049
|
+
function isFlattenable(value) {
|
|
2050
|
+
return typeof value === "object" && value !== null && !(value instanceof Date) || Array.isArray(value);
|
|
2051
|
+
}
|
|
2052
|
+
function isArrayIndex(key2) {
|
|
2053
|
+
return /^\d+$/.test(key2) && !isNaN(Number(key2));
|
|
2054
|
+
}
|
|
2055
|
+
function flatObject(obj, opts) {
|
|
2056
|
+
if (typeof obj !== "object" || obj === null) {
|
|
2057
|
+
return { "": obj };
|
|
2058
|
+
}
|
|
2059
|
+
return flattenObject(obj, "", {}, opts);
|
|
2060
|
+
}
|
|
2061
|
+
function toFlattenElement(elem) {
|
|
2062
|
+
return flatObject(elem, { ignorePaths: ["detail.children"] });
|
|
2063
|
+
}
|
|
2064
|
+
function toFlattenLayout(layout) {
|
|
2065
|
+
return flatObject(layout);
|
|
2066
|
+
}
|
|
2067
|
+
function toFlattenGlobal(global) {
|
|
2068
|
+
return flatObject(global);
|
|
2069
|
+
}
|
|
2070
|
+
function toPath(path) {
|
|
2071
|
+
if (Array.isArray(path))
|
|
2072
|
+
return [...path];
|
|
2073
|
+
return path.split(/\.|\[|\]/).filter((key2) => key2 !== "");
|
|
2074
|
+
}
|
|
2075
|
+
function get(obj, path, defaultValue) {
|
|
2076
|
+
if (!path) {
|
|
2077
|
+
return void 0;
|
|
2078
|
+
}
|
|
2079
|
+
const pathArray = toPath(path);
|
|
2080
|
+
let current = obj;
|
|
2081
|
+
for (const key2 of pathArray) {
|
|
2082
|
+
if (current === null || current === void 0) {
|
|
2083
|
+
return defaultValue;
|
|
2084
|
+
}
|
|
2085
|
+
current = current[key2];
|
|
2086
|
+
}
|
|
2087
|
+
return current !== void 0 ? current : defaultValue;
|
|
2088
|
+
}
|
|
2089
|
+
function set(obj, path, value) {
|
|
2090
|
+
const pathArray = toPath(path);
|
|
2091
|
+
if (pathArray.length === 0) {
|
|
2092
|
+
return obj;
|
|
2093
|
+
}
|
|
2094
|
+
let current = obj;
|
|
2095
|
+
if (current) {
|
|
2096
|
+
for (let i = 0; i < pathArray.length; i++) {
|
|
2097
|
+
const key2 = pathArray[i];
|
|
2098
|
+
if (i === pathArray.length - 1) {
|
|
2099
|
+
current[key2] = value;
|
|
2100
|
+
break;
|
|
2101
|
+
}
|
|
2102
|
+
if (current && ((current === null || current === void 0 ? void 0 : current[key2]) === void 0 || typeof (current === null || current === void 0 ? void 0 : current[key2]) !== "object" || (current === null || current === void 0 ? void 0 : current[key2]) === null)) {
|
|
2103
|
+
const nextKey = pathArray[i + 1];
|
|
2104
|
+
const isNextNumeric = /^\d+$/.test(nextKey);
|
|
2105
|
+
current[key2] = isNextNumeric ? [] : {};
|
|
2106
|
+
}
|
|
2107
|
+
current = current === null || current === void 0 ? void 0 : current[key2];
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
return obj;
|
|
2111
|
+
}
|
|
2112
|
+
function del(obj, path) {
|
|
2113
|
+
const pathArray = toPath(path);
|
|
2114
|
+
if (pathArray.length === 0) {
|
|
2115
|
+
return obj;
|
|
2116
|
+
}
|
|
2117
|
+
let current = obj;
|
|
2118
|
+
if (current) {
|
|
2119
|
+
for (let i = 0; i < pathArray.length; i++) {
|
|
2120
|
+
const key2 = pathArray[i];
|
|
2121
|
+
if (i === pathArray.length - 1) {
|
|
2122
|
+
delete current[key2];
|
|
2123
|
+
break;
|
|
2124
|
+
}
|
|
2125
|
+
if (current && ((current === null || current === void 0 ? void 0 : current[key2]) === void 0 || typeof (current === null || current === void 0 ? void 0 : current[key2]) !== "object" || (current === null || current === void 0 ? void 0 : current[key2]) === null)) {
|
|
2126
|
+
const nextKey = pathArray[i + 1];
|
|
2127
|
+
const isNextNumeric = /^\d+$/.test(nextKey);
|
|
2128
|
+
current[key2] = isNextNumeric ? [] : {};
|
|
2129
|
+
}
|
|
2130
|
+
current = current === null || current === void 0 ? void 0 : current[key2];
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
return obj;
|
|
2134
|
+
}
|
|
1931
2135
|
const doNum = (n) => {
|
|
1932
2136
|
return formatNumber(n, { decimalPlaces: 4 });
|
|
1933
2137
|
};
|
|
@@ -2020,6 +2224,266 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2020
2224
|
resizeElementBaseDetail(elem, opts);
|
|
2021
2225
|
return elem;
|
|
2022
2226
|
}
|
|
2227
|
+
const defaultViewWidth = 200;
|
|
2228
|
+
const defaultViewHeight = 200;
|
|
2229
|
+
function createElementSize(type, opts) {
|
|
2230
|
+
let x2 = 0;
|
|
2231
|
+
let y2 = 0;
|
|
2232
|
+
let w2 = defaultViewWidth;
|
|
2233
|
+
let h2 = defaultViewHeight;
|
|
2234
|
+
if (opts) {
|
|
2235
|
+
const { viewScaleInfo, viewSizeInfo } = opts;
|
|
2236
|
+
const { scale, offsetLeft, offsetTop } = viewScaleInfo;
|
|
2237
|
+
const { width, height } = viewSizeInfo;
|
|
2238
|
+
const limitViewWidth = width / 4;
|
|
2239
|
+
const limitViewHeight = height / 4;
|
|
2240
|
+
if (defaultViewWidth >= limitViewWidth) {
|
|
2241
|
+
w2 = limitViewWidth / scale;
|
|
2242
|
+
} else {
|
|
2243
|
+
w2 = defaultViewWidth / scale;
|
|
2244
|
+
}
|
|
2245
|
+
if (defaultViewHeight >= limitViewHeight) {
|
|
2246
|
+
h2 = limitViewHeight / scale;
|
|
2247
|
+
} else {
|
|
2248
|
+
h2 = defaultViewHeight / scale;
|
|
2249
|
+
}
|
|
2250
|
+
if (["circle", "svg", "image"].includes(type)) {
|
|
2251
|
+
w2 = h2 = Math.max(w2, h2);
|
|
2252
|
+
} else if (type === "text") {
|
|
2253
|
+
const fontSize2 = w2 / defaultText.length;
|
|
2254
|
+
h2 = fontSize2 * 2;
|
|
2255
|
+
}
|
|
2256
|
+
x2 = (0 - offsetLeft + width / 2 - w2 * scale / 2) / scale;
|
|
2257
|
+
y2 = (0 - offsetTop + height / 2 - h2 * scale / 2) / scale;
|
|
2258
|
+
}
|
|
2259
|
+
const elemSize = {
|
|
2260
|
+
x: x2,
|
|
2261
|
+
y: y2,
|
|
2262
|
+
w: w2,
|
|
2263
|
+
h: h2
|
|
2264
|
+
};
|
|
2265
|
+
return elemSize;
|
|
2266
|
+
}
|
|
2267
|
+
function createElement(type, baseElem, opts) {
|
|
2268
|
+
const elementSize = createElementSize(type, opts);
|
|
2269
|
+
let detail = {};
|
|
2270
|
+
if (type === "rect") {
|
|
2271
|
+
detail = getDefaultElementRectDetail();
|
|
2272
|
+
} else if (type === "circle") {
|
|
2273
|
+
detail = getDefaultElementCircleDetail();
|
|
2274
|
+
} else if (type === "text") {
|
|
2275
|
+
detail = getDefaultElementTextDetail(elementSize);
|
|
2276
|
+
} else if (type === "svg") {
|
|
2277
|
+
detail = getDefaultElementSVGDetail();
|
|
2278
|
+
} else if (type === "image") {
|
|
2279
|
+
detail = getDefaultElementImageDetail();
|
|
2280
|
+
} else if (type === "group") {
|
|
2281
|
+
detail = getDefaultElementGroupDetail();
|
|
2282
|
+
}
|
|
2283
|
+
const elem = Object.assign(Object.assign(Object.assign({ uuid: createUUID() }, elementSize), baseElem), { type, detail: Object.assign(Object.assign({}, detail), baseElem.detail || {}) });
|
|
2284
|
+
return elem;
|
|
2285
|
+
}
|
|
2286
|
+
function insertElementToListByPosition(element, position, list) {
|
|
2287
|
+
let result = false;
|
|
2288
|
+
if (position.length === 1) {
|
|
2289
|
+
const pos = position[0];
|
|
2290
|
+
list.splice(pos, 0, element);
|
|
2291
|
+
result = true;
|
|
2292
|
+
} else if (position.length > 1) {
|
|
2293
|
+
let tempList = list;
|
|
2294
|
+
for (let i = 0; i < position.length; i++) {
|
|
2295
|
+
const pos = position[i];
|
|
2296
|
+
const item = tempList[pos];
|
|
2297
|
+
if (i === position.length - 1) {
|
|
2298
|
+
const pos2 = position[i];
|
|
2299
|
+
tempList.splice(pos2, 0, element);
|
|
2300
|
+
result = true;
|
|
2301
|
+
} else if (i < position.length - 1 && item.type === "group") {
|
|
2302
|
+
tempList = item.detail.children;
|
|
2303
|
+
} else {
|
|
2304
|
+
break;
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
return result;
|
|
2309
|
+
}
|
|
2310
|
+
function deleteElementInListByPosition(position, list) {
|
|
2311
|
+
let result = false;
|
|
2312
|
+
if (position.length === 1) {
|
|
2313
|
+
const pos = position[0];
|
|
2314
|
+
list.splice(pos, 1);
|
|
2315
|
+
result = true;
|
|
2316
|
+
} else if (position.length > 1) {
|
|
2317
|
+
let tempList = list;
|
|
2318
|
+
for (let i = 0; i < position.length; i++) {
|
|
2319
|
+
const pos = position[i];
|
|
2320
|
+
const item = tempList[pos];
|
|
2321
|
+
if (i === position.length - 1) {
|
|
2322
|
+
const pos2 = position[i];
|
|
2323
|
+
tempList.splice(pos2, 1);
|
|
2324
|
+
result = true;
|
|
2325
|
+
} else if (i < position.length - 1 && item.type === "group") {
|
|
2326
|
+
tempList = item.detail.children;
|
|
2327
|
+
} else {
|
|
2328
|
+
break;
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
return result;
|
|
2333
|
+
}
|
|
2334
|
+
function deleteElementInList(uuid, list) {
|
|
2335
|
+
const position = getElementPositionFromList(uuid, list);
|
|
2336
|
+
return deleteElementInListByPosition(position, list);
|
|
2337
|
+
}
|
|
2338
|
+
function moveElementPosition(elements, opts) {
|
|
2339
|
+
const from = [...opts.from];
|
|
2340
|
+
const to = [...opts.to];
|
|
2341
|
+
if (from.length === 0 || to.length === 0) {
|
|
2342
|
+
return { elements, from, to };
|
|
2343
|
+
}
|
|
2344
|
+
if (from.length <= to.length) {
|
|
2345
|
+
for (let i = 0; i < from.length; i++) {
|
|
2346
|
+
if (to[i] === from[i]) {
|
|
2347
|
+
if (i === from.length - 1) {
|
|
2348
|
+
return { elements, from, to };
|
|
2349
|
+
}
|
|
2350
|
+
continue;
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
const target = findElementFromListByPosition(from, elements);
|
|
2355
|
+
if (target) {
|
|
2356
|
+
const insterResult = insertElementToListByPosition(target, to, elements);
|
|
2357
|
+
if (!insterResult) {
|
|
2358
|
+
return { elements, from, to };
|
|
2359
|
+
}
|
|
2360
|
+
let trimDeletePosIndex = -1;
|
|
2361
|
+
let isEffectToIndex = false;
|
|
2362
|
+
if (from.length >= 1 && to.length >= 1) {
|
|
2363
|
+
if (from.length <= to.length) {
|
|
2364
|
+
if (from.length === 1) {
|
|
2365
|
+
if (from[0] < to[0]) {
|
|
2366
|
+
isEffectToIndex = true;
|
|
2367
|
+
}
|
|
2368
|
+
} else {
|
|
2369
|
+
for (let i = 0; i < from.length; i++) {
|
|
2370
|
+
if (from[i] === to[i]) {
|
|
2371
|
+
if (from.length === from.length - 1) {
|
|
2372
|
+
isEffectToIndex = true;
|
|
2373
|
+
break;
|
|
2374
|
+
}
|
|
2375
|
+
} else {
|
|
2376
|
+
break;
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
if (from.length >= to.length) {
|
|
2382
|
+
if (to.length === 1) {
|
|
2383
|
+
if (to[0] < from[0]) {
|
|
2384
|
+
isEffectToIndex = true;
|
|
2385
|
+
}
|
|
2386
|
+
} else {
|
|
2387
|
+
for (let i = 0; i < to.length; i++) {
|
|
2388
|
+
if (i === to.length - 1 && to[i] < from[i]) {
|
|
2389
|
+
isEffectToIndex = true;
|
|
2390
|
+
}
|
|
2391
|
+
if (from[i] === to[i]) {
|
|
2392
|
+
continue;
|
|
2393
|
+
} else {
|
|
2394
|
+
break;
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
if (isEffectToIndex === true) {
|
|
2401
|
+
for (let i = 0; i < from.length; i++) {
|
|
2402
|
+
if (!(to[i] >= 0)) {
|
|
2403
|
+
break;
|
|
2404
|
+
}
|
|
2405
|
+
if (to[i] === from[i]) {
|
|
2406
|
+
continue;
|
|
2407
|
+
}
|
|
2408
|
+
if (to[i] < from[i] && i == to.length - 1) {
|
|
2409
|
+
trimDeletePosIndex = i;
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
if (trimDeletePosIndex >= 0) {
|
|
2414
|
+
{
|
|
2415
|
+
from[trimDeletePosIndex] = from[trimDeletePosIndex] + 1;
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
deleteElementInListByPosition(from, elements);
|
|
2419
|
+
}
|
|
2420
|
+
return { elements, from, to };
|
|
2421
|
+
}
|
|
2422
|
+
function mergeElement(originElem, updateContent, opts) {
|
|
2423
|
+
const updatedFlatten = toFlattenElement(updateContent);
|
|
2424
|
+
const ignoreKeys = ["uuid", "type"];
|
|
2425
|
+
const updatedKeys = Object.keys(updatedFlatten);
|
|
2426
|
+
updatedKeys.forEach((key2) => {
|
|
2427
|
+
if (!ignoreKeys.includes(key2)) {
|
|
2428
|
+
const value = updatedFlatten[key2];
|
|
2429
|
+
del(originElem, key2);
|
|
2430
|
+
if (value !== void 0) {
|
|
2431
|
+
set(originElem, key2, value);
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
});
|
|
2435
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.strict) === true) {
|
|
2436
|
+
const originFlatten = toFlattenElement(originElem);
|
|
2437
|
+
const originKeys = Object.keys(originFlatten);
|
|
2438
|
+
originKeys.forEach((key2) => {
|
|
2439
|
+
if (!ignoreKeys.includes(key2)) {
|
|
2440
|
+
if (!updatedKeys.includes(key2)) {
|
|
2441
|
+
del(originElem, key2);
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
});
|
|
2445
|
+
}
|
|
2446
|
+
return originElem;
|
|
2447
|
+
}
|
|
2448
|
+
function updateElementInList(uuid, updateContent, elements) {
|
|
2449
|
+
var _a, _b;
|
|
2450
|
+
let targetElement = null;
|
|
2451
|
+
for (let i = 0; i < elements.length; i++) {
|
|
2452
|
+
const elem = elements[i];
|
|
2453
|
+
if (elem.uuid === uuid) {
|
|
2454
|
+
if (elem.type === "group" && ((_a = elem.operations) === null || _a === void 0 ? void 0 : _a.deepResize) === true) {
|
|
2455
|
+
if (updateContent.w && updateContent.w > 0 || updateContent.h && updateContent.h > 0) {
|
|
2456
|
+
deepResizeGroupElement(elem, {
|
|
2457
|
+
w: updateContent.w,
|
|
2458
|
+
h: updateContent.h
|
|
2459
|
+
});
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
mergeElement(elem, updateContent);
|
|
2463
|
+
targetElement = elem;
|
|
2464
|
+
break;
|
|
2465
|
+
} else if (elem.type === "group") {
|
|
2466
|
+
targetElement = updateElementInList(uuid, updateContent, ((_b = elem === null || elem === void 0 ? void 0 : elem.detail) === null || _b === void 0 ? void 0 : _b.children) || []);
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
return targetElement;
|
|
2470
|
+
}
|
|
2471
|
+
function updateElementInListByPosition(position, updateContent, elements, opts) {
|
|
2472
|
+
var _a;
|
|
2473
|
+
const elem = findElementFromListByPosition(position, elements);
|
|
2474
|
+
if (elem) {
|
|
2475
|
+
if (elem.type === "group" && ((_a = elem.operations) === null || _a === void 0 ? void 0 : _a.deepResize) === true) {
|
|
2476
|
+
if (updateContent.w && updateContent.w > 0 || updateContent.h && updateContent.h > 0) {
|
|
2477
|
+
deepResizeGroupElement(elem, {
|
|
2478
|
+
w: updateContent.w,
|
|
2479
|
+
h: updateContent.h
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
mergeElement(elem, updateContent, opts);
|
|
2484
|
+
}
|
|
2485
|
+
return elem;
|
|
2486
|
+
}
|
|
2023
2487
|
const baseFontFamilyList = ["-apple-system", '"system-ui"', ' "Segoe UI"', " Roboto", '"Helvetica Neue"', "Arial", '"Noto Sans"', " sans-serif"];
|
|
2024
2488
|
function enhanceFontFamliy(fontFamily2) {
|
|
2025
2489
|
return [fontFamily2, ...baseFontFamilyList].join(", ");
|
|
@@ -2060,6 +2524,36 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2060
2524
|
moveY
|
|
2061
2525
|
};
|
|
2062
2526
|
}
|
|
2527
|
+
function mergeLayout(originLayout, updateContent, opts) {
|
|
2528
|
+
const updatedFlatten = toFlattenLayout(updateContent);
|
|
2529
|
+
const ignoreKeys = [];
|
|
2530
|
+
const updatedKeys = Object.keys(updatedFlatten);
|
|
2531
|
+
updatedKeys.forEach((key2) => {
|
|
2532
|
+
if (!ignoreKeys.includes(key2)) {
|
|
2533
|
+
const value = updatedFlatten[key2];
|
|
2534
|
+
del(originLayout, key2);
|
|
2535
|
+
if (value !== void 0) {
|
|
2536
|
+
set(originLayout, key2, value);
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
});
|
|
2540
|
+
return originLayout;
|
|
2541
|
+
}
|
|
2542
|
+
function mergeGlobal(originGlobal, updateContent, opts) {
|
|
2543
|
+
const updatedFlatten = toFlattenGlobal(updateContent);
|
|
2544
|
+
const ignoreKeys = [];
|
|
2545
|
+
const updatedKeys = Object.keys(updatedFlatten);
|
|
2546
|
+
updatedKeys.forEach((key2) => {
|
|
2547
|
+
if (!ignoreKeys.includes(key2)) {
|
|
2548
|
+
const value = updatedFlatten[key2];
|
|
2549
|
+
del(originGlobal, key2);
|
|
2550
|
+
if (value !== void 0) {
|
|
2551
|
+
set(originGlobal, key2, value);
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
});
|
|
2555
|
+
return originGlobal;
|
|
2556
|
+
}
|
|
2063
2557
|
function createColorStyle(ctx, color2, opts) {
|
|
2064
2558
|
if (typeof color2 === "string") {
|
|
2065
2559
|
return color2;
|
|
@@ -2163,7 +2657,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2163
2657
|
ctx.scale(totalScale * scaleW, totalScale * scaleH);
|
|
2164
2658
|
const pathStr = generateSVGPath(clipPath.commands || []);
|
|
2165
2659
|
const path2d = new Path2D(pathStr);
|
|
2166
|
-
ctx.clip(path2d);
|
|
2660
|
+
ctx.clip(path2d, "nonzero");
|
|
2167
2661
|
ctx.translate(0 - internalX, 0 - internalY);
|
|
2168
2662
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
2169
2663
|
rotateElement$1(ctx, Object.assign({}, viewElem), () => {
|
|
@@ -2254,7 +2748,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2254
2748
|
}
|
|
2255
2749
|
}
|
|
2256
2750
|
}
|
|
2257
|
-
ctx.fill();
|
|
2751
|
+
ctx.fill("nonzero");
|
|
2258
2752
|
if (transform && transform.length > 0) {
|
|
2259
2753
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
2260
2754
|
}
|
|
@@ -2460,7 +2954,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2460
2954
|
ctx.fillStyle = fillStyle;
|
|
2461
2955
|
ctx.circle(centerX, centerY, radiusA, radiusB, 0, 0, 2 * Math.PI);
|
|
2462
2956
|
ctx.closePath();
|
|
2463
|
-
ctx.fill();
|
|
2957
|
+
ctx.fill("nonzero");
|
|
2464
2958
|
ctx.globalAlpha = parentOpacity;
|
|
2465
2959
|
if (typeof bw === "number" && bw > 0) {
|
|
2466
2960
|
const ba = bw / 2 + a;
|
|
@@ -2540,8 +3034,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2540
3034
|
ctx.arcTo(x3, y3 + h3, x3, y3, radiusList[3]);
|
|
2541
3035
|
ctx.arcTo(x3, y3, x3 + w3, y3, radiusList[0]);
|
|
2542
3036
|
ctx.closePath();
|
|
2543
|
-
ctx.fill();
|
|
2544
|
-
ctx.clip();
|
|
3037
|
+
ctx.fill("nonzero");
|
|
3038
|
+
ctx.clip("nonzero");
|
|
2545
3039
|
if (scaleMode && originH && originW) {
|
|
2546
3040
|
let sx = 0;
|
|
2547
3041
|
let sy = 0;
|
|
@@ -2741,7 +3235,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2741
3235
|
}
|
|
2742
3236
|
}
|
|
2743
3237
|
if (detail.fill) {
|
|
2744
|
-
ctx.fill(path2d, fillRule);
|
|
3238
|
+
ctx.fill(path2d, fillRule || "nonzero");
|
|
2745
3239
|
}
|
|
2746
3240
|
if (detail.stroke && detail.strokeWidth !== 0) {
|
|
2747
3241
|
ctx.strokeStyle = detail.stroke;
|
|
@@ -2844,8 +3338,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2844
3338
|
ctx.arcTo(x3, y3 + h3, x3, y3, radiusList[3]);
|
|
2845
3339
|
ctx.arcTo(x3, y3, x3 + w3, y3, radiusList[0]);
|
|
2846
3340
|
ctx.closePath();
|
|
2847
|
-
ctx.fill();
|
|
2848
|
-
ctx.clip();
|
|
3341
|
+
ctx.fill("nonzero");
|
|
3342
|
+
ctx.clip("nonzero");
|
|
2849
3343
|
}
|
|
2850
3344
|
if (Array.isArray(elem.detail.children)) {
|
|
2851
3345
|
const { parentElementSize: parentSize } = opts;
|
|
@@ -2939,8 +3433,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2939
3433
|
ctx.arcTo(x3, y3 + h3, x3, y3, radiusList[3]);
|
|
2940
3434
|
ctx.arcTo(x3, y3, x3 + w3, y3, radiusList[0]);
|
|
2941
3435
|
ctx.closePath();
|
|
2942
|
-
ctx.fill();
|
|
2943
|
-
ctx.clip();
|
|
3436
|
+
ctx.fill("nonzero");
|
|
3437
|
+
ctx.clip("nonzero");
|
|
2944
3438
|
}
|
|
2945
3439
|
renderContent(ctx);
|
|
2946
3440
|
if (layout.detail.overflow === "hidden") {
|
|
@@ -3012,9 +3506,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3012
3506
|
if (isAssetId(source)) {
|
|
3013
3507
|
return source;
|
|
3014
3508
|
}
|
|
3015
|
-
return createAssetId(source);
|
|
3509
|
+
return createAssetId(source, element.uuid);
|
|
3016
3510
|
}
|
|
3017
|
-
return createAssetId(`${createUUID()}-${element.uuid}-${createUUID()}-${createUUID()}
|
|
3511
|
+
return createAssetId(`${createUUID()}-${element.uuid}-${createUUID()}-${createUUID()}`, element.uuid);
|
|
3018
3512
|
};
|
|
3019
3513
|
class Loader extends EventEmitter {
|
|
3020
3514
|
constructor() {
|
|
@@ -3288,9 +3782,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3288
3782
|
eachLineStartY = (fontHeight - fontSize2) / 2;
|
|
3289
3783
|
}
|
|
3290
3784
|
if (lines.length * fontHeight < h2) {
|
|
3291
|
-
if (
|
|
3785
|
+
if (detail.verticalAlign === "top") {
|
|
3292
3786
|
startY = 0;
|
|
3293
|
-
} else if (
|
|
3787
|
+
} else if (detail.verticalAlign === "bottom") {
|
|
3294
3788
|
startY += h2 - lines.length * fontHeight;
|
|
3295
3789
|
} else {
|
|
3296
3790
|
startY += (h2 - lines.length * fontHeight) / 2;
|
|
@@ -3525,9 +4019,20 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3525
4019
|
};
|
|
3526
4020
|
return viewRectInfo;
|
|
3527
4021
|
}
|
|
4022
|
+
modifyText(element) {
|
|
4023
|
+
const virtualFlatItemMap = __classPrivateFieldGet$1(this, _Calculator_store, "f").get("virtualFlatItemMap");
|
|
4024
|
+
const flatItem = virtualFlatItemMap[element.uuid];
|
|
4025
|
+
if (element && element.type === "text") {
|
|
4026
|
+
const newVirtualFlatItem = Object.assign(Object.assign({}, flatItem), calcVirtualTextDetail(element, {
|
|
4027
|
+
tempContext: __classPrivateFieldGet$1(this, _Calculator_opts, "f").tempContext
|
|
4028
|
+
}));
|
|
4029
|
+
virtualFlatItemMap[element.uuid] = newVirtualFlatItem;
|
|
4030
|
+
__classPrivateFieldGet$1(this, _Calculator_store, "f").set("virtualFlatItemMap", virtualFlatItemMap);
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
3528
4033
|
modifyVirtualFlatItemMap(data, opts) {
|
|
3529
|
-
const {
|
|
3530
|
-
const { type, content } =
|
|
4034
|
+
const { modifyInfo, viewScaleInfo, viewSizeInfo } = opts;
|
|
4035
|
+
const { type, content } = modifyInfo;
|
|
3531
4036
|
const list = data.elements;
|
|
3532
4037
|
const virtualFlatItemMap = __classPrivateFieldGet$1(this, _Calculator_store, "f").get("virtualFlatItemMap");
|
|
3533
4038
|
if (type === "deleteElement") {
|
|
@@ -3628,6 +4133,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3628
4133
|
w: opts.viewSizeInfo.width,
|
|
3629
4134
|
h: opts.viewSizeInfo.height
|
|
3630
4135
|
};
|
|
4136
|
+
if (opts.forceDrawAll === true) {
|
|
4137
|
+
__classPrivateFieldGet(this, _Renderer_calculator, "f").resetVirtualFlatItemMap(data, {
|
|
4138
|
+
viewScaleInfo: opts.viewScaleInfo,
|
|
4139
|
+
viewSizeInfo: opts.viewSizeInfo
|
|
4140
|
+
});
|
|
4141
|
+
}
|
|
3631
4142
|
const drawOpts = Object.assign({
|
|
3632
4143
|
loader,
|
|
3633
4144
|
calculator,
|
|
@@ -4153,8 +4664,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4153
4664
|
constructor(opts) {
|
|
4154
4665
|
__privateAdd(this, _Board_instances);
|
|
4155
4666
|
__privateAdd(this, _opts3);
|
|
4156
|
-
__privateAdd(this, _middlewareMap, /* @__PURE__ */ new
|
|
4157
|
-
|
|
4667
|
+
__privateAdd(this, _middlewareMap, /* @__PURE__ */ new Map());
|
|
4668
|
+
// #middlewares: BoardMiddleware[] = [];
|
|
4158
4669
|
__privateAdd(this, _activeMiddlewareObjs, []);
|
|
4159
4670
|
__privateAdd(this, _watcher);
|
|
4160
4671
|
__privateAdd(this, _renderer);
|
|
@@ -4214,8 +4725,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4214
4725
|
getRenderer() {
|
|
4215
4726
|
return __privateGet(this, _renderer);
|
|
4216
4727
|
}
|
|
4217
|
-
setData(data
|
|
4218
|
-
const { modifiedOptions } = opts || {};
|
|
4728
|
+
setData(data) {
|
|
4219
4729
|
const sharer = __privateGet(this, _sharer);
|
|
4220
4730
|
__privateGet(this, _sharer).setActiveStorage("data", data);
|
|
4221
4731
|
const viewSizeInfo = sharer.getActiveViewSizeInfo();
|
|
@@ -4225,17 +4735,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4225
4735
|
viewHeight: viewSizeInfo.height,
|
|
4226
4736
|
extend: true
|
|
4227
4737
|
});
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
});
|
|
4233
|
-
} else {
|
|
4234
|
-
__privateGet(this, _viewer).resetVirtualFlatItemMap(data, {
|
|
4235
|
-
viewSizeInfo,
|
|
4236
|
-
viewScaleInfo
|
|
4237
|
-
});
|
|
4238
|
-
}
|
|
4738
|
+
__privateGet(this, _viewer).resetVirtualFlatItemMap(data, {
|
|
4739
|
+
viewSizeInfo,
|
|
4740
|
+
viewScaleInfo
|
|
4741
|
+
});
|
|
4239
4742
|
__privateGet(this, _viewer).drawFrame();
|
|
4240
4743
|
const newViewSizeInfo = {
|
|
4241
4744
|
...viewSizeInfo,
|
|
@@ -4252,13 +4755,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4252
4755
|
var _a, _b, _c;
|
|
4253
4756
|
if (__privateGet(this, _middlewareMap).has(middleware)) {
|
|
4254
4757
|
const item = __privateGet(this, _middlewareMap).get(middleware);
|
|
4255
|
-
if (item) {
|
|
4256
|
-
(_b = (_a = item.middlewareObject).use) == null ? void 0 : _b.call(_a);
|
|
4758
|
+
if (item && item.status !== "enable") {
|
|
4257
4759
|
item.status = "enable";
|
|
4258
|
-
|
|
4760
|
+
(_b = (_a = item.middlewareObject).use) == null ? void 0 : _b.call(_a);
|
|
4259
4761
|
__privateMethod(this, _Board_instances, resetActiveMiddlewareObjs_fn).call(this);
|
|
4260
|
-
return;
|
|
4261
4762
|
}
|
|
4763
|
+
return;
|
|
4262
4764
|
}
|
|
4263
4765
|
const { boardContent, container } = __privateGet(this, _opts3);
|
|
4264
4766
|
const sharer = __privateGet(this, _sharer);
|
|
@@ -4270,8 +4772,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4270
4772
|
config
|
|
4271
4773
|
);
|
|
4272
4774
|
(_c = obj.use) == null ? void 0 : _c.call(obj);
|
|
4273
|
-
__privateGet(this, _middlewares).push(middleware);
|
|
4274
|
-
__privateGet(this, _activeMiddlewareObjs).push(obj);
|
|
4275
4775
|
__privateGet(this, _middlewareMap).set(middleware, {
|
|
4276
4776
|
status: "enable",
|
|
4277
4777
|
middlewareObject: obj,
|
|
@@ -4281,11 +4781,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4281
4781
|
}
|
|
4282
4782
|
disuse(middleware) {
|
|
4283
4783
|
var _a, _b;
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4784
|
+
if (__privateGet(this, _middlewareMap).has(middleware)) {
|
|
4785
|
+
const item = __privateGet(this, _middlewareMap).get(middleware);
|
|
4786
|
+
if (item) {
|
|
4787
|
+
(_b = (_a = item.middlewareObject).disuse) == null ? void 0 : _b.call(_a);
|
|
4788
|
+
item.status = "disable";
|
|
4789
|
+
}
|
|
4790
|
+
__privateGet(this, _middlewareMap).delete(middleware);
|
|
4289
4791
|
__privateMethod(this, _Board_instances, resetActiveMiddlewareObjs_fn).call(this);
|
|
4290
4792
|
}
|
|
4291
4793
|
}
|
|
@@ -4350,7 +4852,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4350
4852
|
}
|
|
4351
4853
|
_opts3 = new WeakMap();
|
|
4352
4854
|
_middlewareMap = new WeakMap();
|
|
4353
|
-
_middlewares = new WeakMap();
|
|
4354
4855
|
_activeMiddlewareObjs = new WeakMap();
|
|
4355
4856
|
_watcher = new WeakMap();
|
|
4356
4857
|
_renderer = new WeakMap();
|
|
@@ -4530,13 +5031,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4530
5031
|
};
|
|
4531
5032
|
resetActiveMiddlewareObjs_fn = function() {
|
|
4532
5033
|
const activeMiddlewareObjs = [];
|
|
4533
|
-
const
|
|
4534
|
-
__privateGet(this, _middlewares).forEach((middleware) => {
|
|
4535
|
-
const item = middlewareMap.get(middleware);
|
|
5034
|
+
for (const [_, item] of __privateGet(this, _middlewareMap)) {
|
|
4536
5035
|
if ((item == null ? void 0 : item.status) === "enable" && (item == null ? void 0 : item.middlewareObject)) {
|
|
4537
5036
|
activeMiddlewareObjs.push(item.middlewareObject);
|
|
4538
5037
|
}
|
|
4539
|
-
}
|
|
5038
|
+
}
|
|
4540
5039
|
__privateSet(this, _activeMiddlewareObjs, activeMiddlewareObjs);
|
|
4541
5040
|
};
|
|
4542
5041
|
const CURSOR = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjIuMyAoTWFjaW50b3NoKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjMtMDktMTdUMTY6MDc6MjYrMDg6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIzLTA5LTE3VDE2OjEyOjUwKzA4OjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDIzLTA5LTE3VDE2OjEyOjUwKzA4OjAwIiBkYzpmb3JtYXQ9ImltYWdlL3BuZyIgcGhvdG9zaG9wOkNvbG9yTW9kZT0iMyIgcGhvdG9zaG9wOklDQ1Byb2ZpbGU9InNSR0IgSUVDNjE5NjYtMi4xIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjliMGM0MzI2LWU4ZTQtNDlkNy04MmUzLTgxODkwYTE2ZmU1YSIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjMzOGFhZDBmLWZkZjMtODE0MS1iMTZmLWNiZWIzNTQyYTJhMCIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjUwODAxNzc1LWZlNGEtNDQyMy05NDQ3LThkYWRhNzZhYTllOSI+IDx4bXBNTTpIaXN0b3J5PiA8cmRmOlNlcT4gPHJkZjpsaSBzdEV2dDphY3Rpb249ImNyZWF0ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6NTA4MDE3NzUtZmU0YS00NDIzLTk0NDctOGRhZGE3NmFhOWU5IiBzdEV2dDp3aGVuPSIyMDIzLTA5LTE3VDE2OjA3OjI2KzA4OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjIuMyAoTWFjaW50b3NoKSIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6OWIwYzQzMjYtZThlNC00OWQ3LTgyZTMtODE4OTBhMTZmZTVhIiBzdEV2dDp3aGVuPSIyMDIzLTA5LTE3VDE2OjEyOjUwKzA4OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjIuMyAoTWFjaW50b3NoKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7W6XrzAAAGLklEQVRYhb2Xf2iUdRzHX/txtfXLplZ6Wblm6fzRmG6r7Uou1AxKRjQKYUqgaLBACFogppcK1h8aLRkMSYaJIA5hYMomZpskEfPOufCaDpZ6t7rbre263U3vzn3643meu+eu3XNzvz7w4bbdc/e89nl/Pu/v50HUCAQCx1tbW0uAx4CHgSwggxkKERkziUQif2mQ0WjU53a7vwSeBB4BTEDmTICmBBwYGDivVlDjlFAo9KvT6dwIPAHkANkq6MwDXr169bCISENDg9TX14s+BgcHf2hubi5mBmRPCXj06NFPREQ6OjoEkPLycrl06VIMMhKJeFwu1xdMs+wpAYuLi9eIiIyOjkpeXp4AAsj27dvF7/fHQIPB4C9dXV0fME2ypwQEXvX7/bdFRNauXRsDBMRkMsnhw4cTZB8YGGhsamp6hSmW3Qhw1Y0bN86LiNTW1iYAallWViZtbW162ftcLtdO/i/7tAAWtba2ficicvLkyTEBtdy6dasMDg7GQIeHh9s7OzvfBx5nkrIbAS7du3fvxyIiPT09hoBa1tXVJcv+fWNj4zLgUeAhJiC7EeDLwOsiMioisnDhwnFBrlixQi5evKiX/c6tW7c+R5E9lweU3QjwReDV/v7+bhGRqqqqcQFquWnTJvH5fHrZLzocjkoSZU9bTSPA54GV165daxYROXDgwAMBannw4MFk2RsaGhqWME7ZjQDNwIrTp09/JSLS0tIyIUBACgoK5MKFCzHIcDj85+3btz8FZpFGdiPAZ4DCmpqaTSIiPp9vwoBaVlVVidfr1ct+/sqVK+9iILsR4FzgJcASDoeHRUSKioomDQnI/v37E2T3+Xz1hw4dWjSW7EaAeUA+UNbX12cXEdmyZcuUAAJiNpvlzJkzetl73G53rVrN2EmUCjATuA9EgYjL5eoGKCkpGatNHijmz5/Pxo0b2blzJ2azOfZ3k8lUYDabv45Go/Y7d+6sIY0VZQOjGqDT6bxeWlrKqlWrJgRlsVhYv349FRUVWCwWcnJyEt4PBoOuoaEhu9frvdzR0fHTtm3buolvRpLqe3OBp4EllZWV74mIRKNRyc3NTSvf7Nmzpbq6Wk6cOCFut1uSY2RkJOB0Ou3Nzc3Ha2trPwPWAGXAEuBZFFPPAbKMevBhYA6wCKgIBoP9IiKrV682hLPZbP8DEpH7vb29N1paWn602WwHFyxYsAX4EKgE3gIsQBFQgOIeT6j3z0wFqEkc60OPx9Odn58/t6SkhPb29jFLbrVa2bNnDwBer7fv5s2bPQ6Ho7upqcnZ1tbmASJq3gPC6utdYESXYfWeo6mkBaUHRQ/odrv/yM/Pt5SWlqb8kAbncDh+W7lyZYN683u6DOvAwipsOOnniA4wZf9lqhdoVYzY7fbrQMpBsdlsWK1WRkZGAtXV1d8D/wA+wKNLr5o+YEC9ZggIAEHiFbyfDhCUCcoFngIWFxYWrtMaat68eQl9V15eHmu2+vr6OuAd4A2gGFgMLERp/mdQ+noWyuadi9Jr2aQ4k42GBPXDs1Ga97WhoaFbIiIbNmxIANTWq87Ozp9VuApgGfACihPkoRjwI+p3mlSgtA9ZRkYNYwwKJBr2rl27sFqthEKhwZqamqOAX5f/AsPE5btLvM/GJWO6yFb/82eBonPnztWJiJw9e1YAWb58eUzaI0eOfAO8CbwCPIfiZZN+eEoncSaKLPOApbt3794uIuL1ehOktdvtF4C3gRKURXcOSn9lTRRsvIAZKI4+l/gjQFREZMeOHSIiEggE+tetW/cRitkuRhmERxnnxjxZQFDWnzzURwCv1+vUHxHHjh37lri0C1Am9KGpgDMC1G8SQnxxCHs8Hqf2RldX10+bN28+i+JjwyT62KSaP13oAfWTHO7t7f0dIBQK/b1v375GlEnVjPYuyoQaHlNTDahVMALca29vdwBcvnz5+KlTp26OATft1UuODBS7yEOxj0K/329HOSWWopjxlE1tchhtM7FriPfgXSDDbrfXo0gbJr4QzIi0WiRPYBbKZJrUV23b0dYn7XSYcsBkS9EiO/k6lApq1cwiPjzaAM1Y9cYC1G6uAWrPCtrvMwoHqU02Q5caIEzj1KaS+D+vIjxtLug31gAAAABJRU5ErkJggg==";
|
|
@@ -4709,6 +5208,32 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4709
5208
|
}
|
|
4710
5209
|
return key2;
|
|
4711
5210
|
};
|
|
5211
|
+
function getModifyElementRecord(opts) {
|
|
5212
|
+
const { modifiedElement, beforeElement } = opts;
|
|
5213
|
+
const { uuid, ...restElement } = modifiedElement;
|
|
5214
|
+
const after = toFlattenElement(restElement);
|
|
5215
|
+
let before = {};
|
|
5216
|
+
Object.keys(after).forEach((key2) => {
|
|
5217
|
+
let val = get(beforeElement, key2);
|
|
5218
|
+
if (val === void 0 && /(borderRadius|borderWidth)\[[0-9]{1,}\]$/.test(key2)) {
|
|
5219
|
+
key2 = key2.replace(/\[[0-9]{1,}\]$/, "");
|
|
5220
|
+
val = get(beforeElement, key2);
|
|
5221
|
+
}
|
|
5222
|
+
before[key2] = val;
|
|
5223
|
+
});
|
|
5224
|
+
before = toFlattenElement(before);
|
|
5225
|
+
const record = {
|
|
5226
|
+
type: "modifyElement",
|
|
5227
|
+
time: Date.now(),
|
|
5228
|
+
content: {
|
|
5229
|
+
method: "modifyElement",
|
|
5230
|
+
uuid,
|
|
5231
|
+
before,
|
|
5232
|
+
after
|
|
5233
|
+
}
|
|
5234
|
+
};
|
|
5235
|
+
return record;
|
|
5236
|
+
}
|
|
4712
5237
|
const key$3 = "SELECT";
|
|
4713
5238
|
const keyActionType = Symbol(`${key$3}_actionType`);
|
|
4714
5239
|
const keyResizeType = Symbol(`${key$3}_resizeType`);
|
|
@@ -4756,7 +5281,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4756
5281
|
ctx.lineTo(vertexes[0].x, vertexes[0].y);
|
|
4757
5282
|
ctx.closePath();
|
|
4758
5283
|
ctx.stroke();
|
|
4759
|
-
ctx.fill();
|
|
5284
|
+
ctx.fill("nonzero");
|
|
4760
5285
|
}
|
|
4761
5286
|
function drawLine(ctx, start, end, opts) {
|
|
4762
5287
|
const { borderColor: borderColor2, borderWidth: borderWidth2, lineDash } = opts;
|
|
@@ -4781,7 +5306,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4781
5306
|
ctx.fillStyle = background2;
|
|
4782
5307
|
ctx.circle(center.x, center.y, a, b, 0, 0, 2 * Math.PI);
|
|
4783
5308
|
ctx.closePath();
|
|
4784
|
-
ctx.fill();
|
|
5309
|
+
ctx.fill("nonzero");
|
|
4785
5310
|
}
|
|
4786
5311
|
}
|
|
4787
5312
|
function drawCrossVertexes(ctx, vertexes, opts) {
|
|
@@ -4878,7 +5403,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4878
5403
|
const { devicePixelRatio = 1 } = viewSizeInfo;
|
|
4879
5404
|
const { activeColor: activeColor2 } = style;
|
|
4880
5405
|
const { elementWrapper, topLeft, topRight, bottomLeft, bottomRight, rotate } = controller;
|
|
4881
|
-
const wrapperOpts = {
|
|
5406
|
+
const wrapperOpts = {
|
|
5407
|
+
borderColor: activeColor2,
|
|
5408
|
+
borderWidth: selectWrapperBorderWidth,
|
|
5409
|
+
background: "transparent",
|
|
5410
|
+
lineDash: []
|
|
5411
|
+
};
|
|
4882
5412
|
const ctrlOpts = { ...wrapperOpts, borderWidth: resizeControllerBorderWidth, background: "#FFFFFF" };
|
|
4883
5413
|
drawVertexes(ctx, calcViewVertexes(elementWrapper, opts), wrapperOpts);
|
|
4884
5414
|
if (!hideControllers) {
|
|
@@ -4887,7 +5417,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4887
5417
|
drawVertexes(ctx, calcViewVertexes(bottomLeft.vertexes, opts), ctrlOpts);
|
|
4888
5418
|
drawVertexes(ctx, calcViewVertexes(bottomRight.vertexes, opts), ctrlOpts);
|
|
4889
5419
|
if (((_a = element == null ? void 0 : element.operations) == null ? void 0 : _a.rotatable) !== false) {
|
|
4890
|
-
drawCircleController(ctx, calcViewPointSize(rotate.center, opts), {
|
|
5420
|
+
drawCircleController(ctx, calcViewPointSize(rotate.center, opts), {
|
|
5421
|
+
...ctrlOpts,
|
|
5422
|
+
size: rotate.size
|
|
5423
|
+
});
|
|
4891
5424
|
const rotateCenter = calcViewPointSize(rotate.center, opts);
|
|
4892
5425
|
ctx.drawImage(
|
|
4893
5426
|
rotateControllerPattern.canvas,
|
|
@@ -4917,7 +5450,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4917
5450
|
ctx.lineTo(start.x, end.y);
|
|
4918
5451
|
ctx.closePath();
|
|
4919
5452
|
ctx.stroke();
|
|
4920
|
-
ctx.fill();
|
|
5453
|
+
ctx.fill("nonzero");
|
|
4921
5454
|
}
|
|
4922
5455
|
function drawListArea(ctx, opts) {
|
|
4923
5456
|
const { areaSize, style } = opts;
|
|
@@ -4934,14 +5467,19 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4934
5467
|
ctx.lineTo(x2, y2 + h2);
|
|
4935
5468
|
ctx.closePath();
|
|
4936
5469
|
ctx.stroke();
|
|
4937
|
-
ctx.fill();
|
|
5470
|
+
ctx.fill("nonzero");
|
|
4938
5471
|
}
|
|
4939
5472
|
function drawGroupQueueVertexesWrappers(ctx, vertexesList, opts) {
|
|
4940
5473
|
const { style } = opts;
|
|
4941
5474
|
const { activeColor: activeColor2 } = style;
|
|
4942
5475
|
for (let i = 0; i < vertexesList.length; i++) {
|
|
4943
5476
|
const vertexes = vertexesList[i];
|
|
4944
|
-
const wrapperOpts = {
|
|
5477
|
+
const wrapperOpts = {
|
|
5478
|
+
borderColor: activeColor2,
|
|
5479
|
+
borderWidth: selectWrapperBorderWidth,
|
|
5480
|
+
background: "transparent",
|
|
5481
|
+
lineDash: [4, 4]
|
|
5482
|
+
};
|
|
4945
5483
|
drawVertexes(ctx, calcViewVertexes(vertexes, opts), wrapperOpts);
|
|
4946
5484
|
}
|
|
4947
5485
|
}
|
|
@@ -6044,7 +6582,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6044
6582
|
ctx.lineTo(boxVertexes[2].x, boxVertexes[2].y);
|
|
6045
6583
|
ctx.lineTo(boxVertexes[3].x, boxVertexes[3].y);
|
|
6046
6584
|
ctx.closePath();
|
|
6047
|
-
ctx.fill();
|
|
6585
|
+
ctx.fill("nonzero");
|
|
6048
6586
|
ctx.strokeStyle = activeColor2;
|
|
6049
6587
|
ctx.lineWidth = 2;
|
|
6050
6588
|
ctx.beginPath();
|
|
@@ -6073,9 +6611,24 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6073
6611
|
const { controller, style } = opts;
|
|
6074
6612
|
const { topLeft, topRight, bottomLeft, bottomRight, topMiddle, rightMiddle, bottomMiddle, leftMiddle } = controller;
|
|
6075
6613
|
drawControllerLine(ctx, { start: topLeft.center, end: topRight.center, centerVertexes: topMiddle.vertexes, style });
|
|
6076
|
-
drawControllerLine(ctx, {
|
|
6077
|
-
|
|
6078
|
-
|
|
6614
|
+
drawControllerLine(ctx, {
|
|
6615
|
+
start: topRight.center,
|
|
6616
|
+
end: bottomRight.center,
|
|
6617
|
+
centerVertexes: rightMiddle.vertexes,
|
|
6618
|
+
style
|
|
6619
|
+
});
|
|
6620
|
+
drawControllerLine(ctx, {
|
|
6621
|
+
start: bottomRight.center,
|
|
6622
|
+
end: bottomLeft.center,
|
|
6623
|
+
centerVertexes: bottomMiddle.vertexes,
|
|
6624
|
+
style
|
|
6625
|
+
});
|
|
6626
|
+
drawControllerLine(ctx, {
|
|
6627
|
+
start: bottomLeft.center,
|
|
6628
|
+
end: topLeft.center,
|
|
6629
|
+
centerVertexes: leftMiddle.vertexes,
|
|
6630
|
+
style
|
|
6631
|
+
});
|
|
6079
6632
|
drawControllerBox(ctx, topLeft.vertexes, style);
|
|
6080
6633
|
drawControllerBox(ctx, topRight.vertexes, style);
|
|
6081
6634
|
drawControllerBox(ctx, bottomRight.vertexes, style);
|
|
@@ -6107,6 +6660,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6107
6660
|
let prevPoint = null;
|
|
6108
6661
|
let prevIsHoverContent = null;
|
|
6109
6662
|
let prevIsSelected = null;
|
|
6663
|
+
let pointStartLayoutSize = null;
|
|
6110
6664
|
const clear = () => {
|
|
6111
6665
|
prevPoint = null;
|
|
6112
6666
|
sharer.setSharedStorage(keyLayoutActionType, null);
|
|
@@ -6272,6 +6826,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6272
6826
|
}
|
|
6273
6827
|
sharer.setSharedStorage(keyLayoutIsSelected, false);
|
|
6274
6828
|
}
|
|
6829
|
+
const data = sharer.getActiveStorage("data");
|
|
6830
|
+
if (data == null ? void 0 : data.layout) {
|
|
6831
|
+
pointStartLayoutSize = getElementSize(data.layout);
|
|
6832
|
+
} else {
|
|
6833
|
+
pointStartLayoutSize = null;
|
|
6834
|
+
}
|
|
6275
6835
|
resetController();
|
|
6276
6836
|
const layoutControlType = resetControlType(e);
|
|
6277
6837
|
prevPoint = e.point;
|
|
@@ -6381,11 +6941,25 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6381
6941
|
const layoutControlType = sharer.getSharedStorage(keyLayoutControlType);
|
|
6382
6942
|
const data = sharer.getActiveStorage("data");
|
|
6383
6943
|
if (data && layoutActionType === "resize" && layoutControlType) {
|
|
6944
|
+
let modifyRecord = void 0;
|
|
6945
|
+
if (pointStartLayoutSize) {
|
|
6946
|
+
modifyRecord = {
|
|
6947
|
+
type: "modifyLayout",
|
|
6948
|
+
time: Date.now(),
|
|
6949
|
+
content: {
|
|
6950
|
+
method: "modifyLayout",
|
|
6951
|
+
before: toFlattenLayout(pointStartLayoutSize),
|
|
6952
|
+
after: toFlattenLayout(getElementSize(data.layout))
|
|
6953
|
+
}
|
|
6954
|
+
};
|
|
6955
|
+
}
|
|
6384
6956
|
eventHub.trigger(coreEventKeys.CHANGE, {
|
|
6385
6957
|
type: "dragLayout",
|
|
6386
|
-
data
|
|
6958
|
+
data,
|
|
6959
|
+
modifyRecord
|
|
6387
6960
|
});
|
|
6388
6961
|
}
|
|
6962
|
+
pointStartLayoutSize = null;
|
|
6389
6963
|
sharer.setSharedStorage(keyLayoutActionType, null);
|
|
6390
6964
|
sharer.setSharedStorage(keyLayoutControlType, null);
|
|
6391
6965
|
if (sharer.getSharedStorage(keyLayoutIsHoverController) === true) {
|
|
@@ -6655,7 +7229,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6655
7229
|
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
6656
7230
|
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
6657
7231
|
ctx.closePath();
|
|
6658
|
-
ctx.fill();
|
|
7232
|
+
ctx.fill("nonzero");
|
|
6659
7233
|
ctx.fillStyle = textColor2;
|
|
6660
7234
|
ctx.textBaseline = "top";
|
|
6661
7235
|
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
@@ -6692,7 +7266,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6692
7266
|
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
6693
7267
|
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
6694
7268
|
ctx.closePath();
|
|
6695
|
-
ctx.fill();
|
|
7269
|
+
ctx.fill("nonzero");
|
|
6696
7270
|
ctx.fillStyle = textColor2;
|
|
6697
7271
|
ctx.textBaseline = "top";
|
|
6698
7272
|
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
@@ -6729,7 +7303,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6729
7303
|
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
6730
7304
|
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
6731
7305
|
ctx.closePath();
|
|
6732
|
-
ctx.fill();
|
|
7306
|
+
ctx.fill("nonzero");
|
|
6733
7307
|
ctx.fillStyle = textColor2;
|
|
6734
7308
|
ctx.textBaseline = "top";
|
|
6735
7309
|
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
@@ -6879,6 +7453,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6879
7453
|
const { viewer, sharer, boardContent, calculator, eventHub } = opts;
|
|
6880
7454
|
const { overlayContext } = boardContent;
|
|
6881
7455
|
let prevPoint = null;
|
|
7456
|
+
let pointStartElementSizeList = [];
|
|
6882
7457
|
let moveOriginalStartPoint = null;
|
|
6883
7458
|
let moveOriginalStartElementSize = null;
|
|
6884
7459
|
let inBusyMode = null;
|
|
@@ -7035,6 +7610,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7035
7610
|
eventHub.off(coreEventKeys.CLEAR_SELECT, selectClearCallback);
|
|
7036
7611
|
eventHub.off(coreEventKeys.SELECT_IN_GROUP, selectInGroupCallback);
|
|
7037
7612
|
eventHub.off(coreEventKeys.SNAP_TO_GRID, setSnapToSnapCallback);
|
|
7613
|
+
clear();
|
|
7614
|
+
innerConfig = null;
|
|
7038
7615
|
},
|
|
7039
7616
|
resetConfig(config2) {
|
|
7040
7617
|
innerConfig = { ...innerConfig, ...config2 };
|
|
@@ -7156,6 +7733,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7156
7733
|
} else if (target2.type === "over-element" && ((_e = target2 == null ? void 0 : target2.elements) == null ? void 0 : _e.length) === 1) {
|
|
7157
7734
|
updateSelectedElementList([target2.elements[0]], { triggerEvent: true });
|
|
7158
7735
|
sharer.setSharedStorage(keyActionType, "drag");
|
|
7736
|
+
pointStartElementSizeList = [{ ...getElementSize(target2 == null ? void 0 : target2.elements[0]), uuid: target2 == null ? void 0 : target2.elements[0].uuid }];
|
|
7159
7737
|
} else if ((_f = target2.type) == null ? void 0 : _f.startsWith("resize-")) {
|
|
7160
7738
|
sharer.setSharedStorage(keyResizeType, target2.type);
|
|
7161
7739
|
sharer.setSharedStorage(keyActionType, "resize");
|
|
@@ -7192,6 +7770,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7192
7770
|
} else if (target.type === "over-element" && ((_k = target == null ? void 0 : target.elements) == null ? void 0 : _k.length) === 1) {
|
|
7193
7771
|
updateSelectedElementList([target.elements[0]], { triggerEvent: true });
|
|
7194
7772
|
sharer.setSharedStorage(keyActionType, "drag");
|
|
7773
|
+
pointStartElementSizeList = [{ ...getElementSize(target == null ? void 0 : target.elements[0]), uuid: target == null ? void 0 : target.elements[0].uuid }];
|
|
7195
7774
|
} else if ((_l = target.type) == null ? void 0 : _l.startsWith("resize-")) {
|
|
7196
7775
|
sharer.setSharedStorage(keyResizeType, target.type);
|
|
7197
7776
|
sharer.setSharedStorage(keyActionType, "resize");
|
|
@@ -7251,7 +7830,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7251
7830
|
elems[0].y = calculator.toGridNum(moveOriginalStartElementSize.y + totalMoveY);
|
|
7252
7831
|
updateSelectedElementList([elems[0]]);
|
|
7253
7832
|
calculator.modifyVirtualFlatItemMap(data, {
|
|
7254
|
-
|
|
7833
|
+
modifyInfo: {
|
|
7255
7834
|
type: "updateElement",
|
|
7256
7835
|
content: {
|
|
7257
7836
|
element: elems[0],
|
|
@@ -7275,7 +7854,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7275
7854
|
elem.x = calculator.toGridNum(elem.x + moveX);
|
|
7276
7855
|
elem.y = calculator.toGridNum(elem.y + moveY);
|
|
7277
7856
|
calculator.modifyVirtualFlatItemMap(data, {
|
|
7278
|
-
|
|
7857
|
+
modifyInfo: {
|
|
7279
7858
|
type: "updateElement",
|
|
7280
7859
|
content: {
|
|
7281
7860
|
element: elem,
|
|
@@ -7349,7 +7928,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7349
7928
|
}
|
|
7350
7929
|
updateSelectedElementList([elems[0]]);
|
|
7351
7930
|
calculator.modifyVirtualFlatItemMap(data, {
|
|
7352
|
-
|
|
7931
|
+
modifyInfo: {
|
|
7353
7932
|
type: "updateElement",
|
|
7354
7933
|
content: {
|
|
7355
7934
|
element: elems[0],
|
|
@@ -7438,7 +8017,37 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7438
8017
|
if (data && ["drag", "drag-list", "drag-list-end", "resize"].includes(actionType)) {
|
|
7439
8018
|
let type = "dragElement";
|
|
7440
8019
|
if (hasChangedData) {
|
|
7441
|
-
|
|
8020
|
+
const startSize = pointStartElementSizeList[0];
|
|
8021
|
+
let modifyRecord = void 0;
|
|
8022
|
+
if (selectedElements.length === 1) {
|
|
8023
|
+
modifyRecord = {
|
|
8024
|
+
type: "dragElement",
|
|
8025
|
+
time: 0,
|
|
8026
|
+
content: {
|
|
8027
|
+
method: "modifyElement",
|
|
8028
|
+
uuid: startSize.uuid,
|
|
8029
|
+
before: toFlattenElement(startSize),
|
|
8030
|
+
after: toFlattenElement(getElementSize(selectedElements[0]))
|
|
8031
|
+
}
|
|
8032
|
+
};
|
|
8033
|
+
} else if (selectedElements.length > 1) {
|
|
8034
|
+
modifyRecord = {
|
|
8035
|
+
type: "dragElements",
|
|
8036
|
+
time: 0,
|
|
8037
|
+
content: {
|
|
8038
|
+
method: "modifyElements",
|
|
8039
|
+
before: pointStartElementSizeList.map((item) => ({
|
|
8040
|
+
...toFlattenElement(item),
|
|
8041
|
+
uuid: item.uuid
|
|
8042
|
+
})),
|
|
8043
|
+
after: selectedElements.map((item) => ({
|
|
8044
|
+
...toFlattenElement(getElementSize(item)),
|
|
8045
|
+
uuid: item.uuid
|
|
8046
|
+
}))
|
|
8047
|
+
}
|
|
8048
|
+
};
|
|
8049
|
+
}
|
|
8050
|
+
eventHub.trigger(coreEventKeys.CHANGE, { data, type, selectedElements, hoverElement, modifyRecord });
|
|
7442
8051
|
hasChangedData = false;
|
|
7443
8052
|
}
|
|
7444
8053
|
}
|
|
@@ -7830,7 +8439,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7830
8439
|
ctx.arcTo(x2, y2, x2 + w2, y2, r);
|
|
7831
8440
|
ctx.closePath();
|
|
7832
8441
|
ctx.fillStyle = background2;
|
|
7833
|
-
ctx.fill();
|
|
8442
|
+
ctx.fill("nonzero");
|
|
7834
8443
|
ctx.beginPath();
|
|
7835
8444
|
ctx.lineWidth = 1;
|
|
7836
8445
|
ctx.strokeStyle = borderColor2;
|
|
@@ -8004,7 +8613,14 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8004
8613
|
}
|
|
8005
8614
|
},
|
|
8006
8615
|
beforeDrawFrame({ snapshot }) {
|
|
8007
|
-
const {
|
|
8616
|
+
const {
|
|
8617
|
+
thumbBackground,
|
|
8618
|
+
thumbBorderColor,
|
|
8619
|
+
hoverThumbBackground,
|
|
8620
|
+
hoverThumbBorderColor,
|
|
8621
|
+
activeThumbBackground,
|
|
8622
|
+
activeThumbBorderColor
|
|
8623
|
+
} = innerConfig;
|
|
8008
8624
|
const style = {
|
|
8009
8625
|
thumbBackground,
|
|
8010
8626
|
thumbBorderColor,
|
|
@@ -8056,7 +8672,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8056
8672
|
const textColor = "#00000080";
|
|
8057
8673
|
const gridColor = "#AAAAAA20";
|
|
8058
8674
|
const gridPrimaryColor = "#AAAAAA40";
|
|
8059
|
-
const selectedAreaColor = "#
|
|
8675
|
+
const selectedAreaColor = "#19609780";
|
|
8060
8676
|
const defaultStyle = {
|
|
8061
8677
|
background,
|
|
8062
8678
|
borderColor,
|
|
@@ -8225,7 +8841,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8225
8841
|
ctx.lineTo(basePosition, basePosition);
|
|
8226
8842
|
ctx.closePath();
|
|
8227
8843
|
ctx.fillStyle = background2;
|
|
8228
|
-
ctx.fill();
|
|
8844
|
+
ctx.fill("nonzero");
|
|
8229
8845
|
ctx.lineWidth = lineSize;
|
|
8230
8846
|
ctx.setLineDash([]);
|
|
8231
8847
|
ctx.strokeStyle = borderColor2;
|
|
@@ -8307,7 +8923,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8307
8923
|
ctx.lineTo(xAreaStart, rulerSize);
|
|
8308
8924
|
ctx.fillStyle = selectedAreaColor2;
|
|
8309
8925
|
ctx.closePath();
|
|
8310
|
-
ctx.fill();
|
|
8926
|
+
ctx.fill("nonzero");
|
|
8311
8927
|
ctx.beginPath();
|
|
8312
8928
|
ctx.moveTo(0, yAreaStart);
|
|
8313
8929
|
ctx.lineTo(rulerSize, yAreaStart);
|
|
@@ -8315,7 +8931,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8315
8931
|
ctx.lineTo(0, yAreaEnd);
|
|
8316
8932
|
ctx.fillStyle = selectedAreaColor2;
|
|
8317
8933
|
ctx.closePath();
|
|
8318
|
-
ctx.fill();
|
|
8934
|
+
ctx.fill("nonzero");
|
|
8319
8935
|
}
|
|
8320
8936
|
}
|
|
8321
8937
|
const MiddlewareRuler = (opts, config) => {
|
|
@@ -8363,8 +8979,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8363
8979
|
if (show === true) {
|
|
8364
8980
|
const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
|
|
8365
8981
|
const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
|
|
8366
|
-
drawScrollerSelectedArea(overlayContext, { snapshot, calculator, style });
|
|
8367
8982
|
drawRulerBackground(overlayContext, { viewSizeInfo, style });
|
|
8983
|
+
drawScrollerSelectedArea(overlayContext, { snapshot, calculator, style });
|
|
8368
8984
|
const { list: xList, rulerUnit } = calcXRulerScaleList({ viewScaleInfo, viewSizeInfo });
|
|
8369
8985
|
drawXRuler(overlayContext, { scaleList: xList, style });
|
|
8370
8986
|
const { list: yList } = calcYRulerScaleList({ viewScaleInfo, viewSizeInfo });
|
|
@@ -8384,15 +9000,16 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8384
9000
|
};
|
|
8385
9001
|
const defaultElementDetail = getDefaultElementDetailConfig();
|
|
8386
9002
|
const MiddlewareTextEditor = (opts) => {
|
|
8387
|
-
const { eventHub, boardContent, viewer, sharer } = opts;
|
|
9003
|
+
const { eventHub, boardContent, viewer, sharer, calculator } = opts;
|
|
8388
9004
|
const canvas = boardContent.boardContext.canvas;
|
|
8389
|
-
const textarea = document.createElement("div");
|
|
8390
|
-
textarea.setAttribute("contenteditable", "true");
|
|
8391
|
-
const canvasWrapper = document.createElement("div");
|
|
8392
9005
|
const container = opts.container || document.body;
|
|
8393
|
-
|
|
9006
|
+
let textarea = document.createElement("div");
|
|
9007
|
+
textarea.setAttribute("contenteditable", "true");
|
|
9008
|
+
let canvasWrapper = document.createElement("div");
|
|
9009
|
+
let mask = document.createElement("div");
|
|
8394
9010
|
let activeElem = null;
|
|
8395
9011
|
let activePosition = [];
|
|
9012
|
+
let originText = "";
|
|
8396
9013
|
const id = `idraw-middleware-text-editor-${Math.random().toString(26).substring(2)}`;
|
|
8397
9014
|
mask.setAttribute("id", id);
|
|
8398
9015
|
canvasWrapper.appendChild(textarea);
|
|
@@ -8409,12 +9026,14 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8409
9026
|
resetCanvasWrapper();
|
|
8410
9027
|
resetTextArea(e);
|
|
8411
9028
|
mask.style.display = "block";
|
|
9029
|
+
originText = "";
|
|
8412
9030
|
if (activeElem == null ? void 0 : activeElem.uuid) {
|
|
8413
9031
|
sharer.setActiveOverrideElemenentMap({
|
|
8414
9032
|
[activeElem.uuid]: {
|
|
8415
9033
|
operations: { invisible: true }
|
|
8416
9034
|
}
|
|
8417
9035
|
});
|
|
9036
|
+
originText = activeElem.detail.text || "";
|
|
8418
9037
|
viewer.drawFrame();
|
|
8419
9038
|
}
|
|
8420
9039
|
};
|
|
@@ -8538,13 +9157,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8538
9157
|
canvasWrapper.style.width = `${width}px`;
|
|
8539
9158
|
canvasWrapper.style.height = `${height}px`;
|
|
8540
9159
|
};
|
|
8541
|
-
|
|
9160
|
+
const maskClickEvent = () => {
|
|
8542
9161
|
hideTextArea();
|
|
8543
|
-
}
|
|
8544
|
-
|
|
9162
|
+
};
|
|
9163
|
+
const textareaClickEvent = (e) => {
|
|
8545
9164
|
e.stopPropagation();
|
|
8546
|
-
}
|
|
8547
|
-
|
|
9165
|
+
};
|
|
9166
|
+
const textareaInputEvent = () => {
|
|
8548
9167
|
if (activeElem && activePosition) {
|
|
8549
9168
|
activeElem.detail.text = textarea.innerText || "";
|
|
8550
9169
|
eventHub.trigger(coreEventKeys.TEXT_CHANGE, {
|
|
@@ -8556,11 +9175,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8556
9175
|
},
|
|
8557
9176
|
position: [...activePosition || []]
|
|
8558
9177
|
});
|
|
9178
|
+
calculator.modifyText(activeElem);
|
|
8559
9179
|
viewer.drawFrame();
|
|
8560
9180
|
}
|
|
8561
|
-
}
|
|
8562
|
-
|
|
9181
|
+
};
|
|
9182
|
+
const textareaBlurEvent = () => {
|
|
8563
9183
|
if (activeElem && activePosition) {
|
|
9184
|
+
activeElem.detail.text = textarea.innerText || "";
|
|
8564
9185
|
eventHub.trigger(coreEventKeys.TEXT_CHANGE, {
|
|
8565
9186
|
element: {
|
|
8566
9187
|
uuid: activeElem.uuid,
|
|
@@ -8570,22 +9191,66 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8570
9191
|
},
|
|
8571
9192
|
position: [...activePosition]
|
|
8572
9193
|
});
|
|
9194
|
+
const data = sharer.getActiveStorage("data") || { elements: [] };
|
|
9195
|
+
const updateContent = {
|
|
9196
|
+
detail: {
|
|
9197
|
+
text: activeElem.detail.text
|
|
9198
|
+
}
|
|
9199
|
+
};
|
|
9200
|
+
updateElementInList(activeElem.uuid, updateContent, data.elements);
|
|
9201
|
+
eventHub.trigger(coreEventKeys.CHANGE, {
|
|
9202
|
+
selectedElements: [
|
|
9203
|
+
{
|
|
9204
|
+
...activeElem,
|
|
9205
|
+
detail: {
|
|
9206
|
+
...activeElem.detail,
|
|
9207
|
+
...updateContent.detail
|
|
9208
|
+
}
|
|
9209
|
+
}
|
|
9210
|
+
],
|
|
9211
|
+
data,
|
|
9212
|
+
type: "modifyElement",
|
|
9213
|
+
modifyRecord: {
|
|
9214
|
+
type: "modifyElement",
|
|
9215
|
+
time: Date.now(),
|
|
9216
|
+
content: {
|
|
9217
|
+
method: "modifyElement",
|
|
9218
|
+
uuid: activeElem.uuid,
|
|
9219
|
+
before: {
|
|
9220
|
+
"detail.text": originText
|
|
9221
|
+
},
|
|
9222
|
+
after: {
|
|
9223
|
+
"detail.text": activeElem.detail.text
|
|
9224
|
+
}
|
|
9225
|
+
}
|
|
9226
|
+
}
|
|
9227
|
+
});
|
|
9228
|
+
calculator.modifyText(activeElem);
|
|
9229
|
+
viewer.drawFrame();
|
|
8573
9230
|
}
|
|
8574
9231
|
hideTextArea();
|
|
8575
|
-
}
|
|
8576
|
-
|
|
9232
|
+
};
|
|
9233
|
+
const textareaKeyDownEvent = (e) => {
|
|
8577
9234
|
e.stopPropagation();
|
|
8578
|
-
}
|
|
8579
|
-
|
|
9235
|
+
};
|
|
9236
|
+
const textareaKeyPressEvent = (e) => {
|
|
8580
9237
|
e.stopPropagation();
|
|
8581
|
-
}
|
|
8582
|
-
|
|
9238
|
+
};
|
|
9239
|
+
const textareaKeyUpEvent = (e) => {
|
|
8583
9240
|
e.stopPropagation();
|
|
8584
|
-
}
|
|
8585
|
-
|
|
9241
|
+
};
|
|
9242
|
+
const textareaWheelEvent = (e) => {
|
|
8586
9243
|
e.stopPropagation();
|
|
8587
9244
|
e.preventDefault();
|
|
8588
|
-
}
|
|
9245
|
+
};
|
|
9246
|
+
mask.addEventListener("click", maskClickEvent);
|
|
9247
|
+
textarea.addEventListener("click", textareaClickEvent);
|
|
9248
|
+
textarea.addEventListener("input", textareaInputEvent);
|
|
9249
|
+
textarea.addEventListener("blur", textareaBlurEvent);
|
|
9250
|
+
textarea.addEventListener("keydown", textareaKeyDownEvent);
|
|
9251
|
+
textarea.addEventListener("keypress", textareaKeyPressEvent);
|
|
9252
|
+
textarea.addEventListener("keyup", textareaKeyUpEvent);
|
|
9253
|
+
textarea.addEventListener("wheel", textareaWheelEvent);
|
|
8589
9254
|
const textEditCallback = (e) => {
|
|
8590
9255
|
var _a;
|
|
8591
9256
|
if ((e == null ? void 0 : e.position) && (e == null ? void 0 : e.element) && ((_a = e == null ? void 0 : e.element) == null ? void 0 : _a.type) === "text") {
|
|
@@ -8601,6 +9266,26 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8601
9266
|
},
|
|
8602
9267
|
disuse() {
|
|
8603
9268
|
eventHub.off(coreEventKeys.TEXT_EDIT, textEditCallback);
|
|
9269
|
+
mask.removeEventListener("click", maskClickEvent);
|
|
9270
|
+
textarea.removeEventListener("click", textareaClickEvent);
|
|
9271
|
+
textarea.removeEventListener("input", textareaInputEvent);
|
|
9272
|
+
textarea.removeEventListener("blur", textareaBlurEvent);
|
|
9273
|
+
textarea.removeEventListener("keydown", textareaKeyDownEvent);
|
|
9274
|
+
textarea.removeEventListener("keypress", textareaKeyPressEvent);
|
|
9275
|
+
textarea.removeEventListener("keyup", textareaKeyUpEvent);
|
|
9276
|
+
textarea.removeEventListener("wheel", textareaWheelEvent);
|
|
9277
|
+
canvasWrapper.removeChild(textarea);
|
|
9278
|
+
mask.removeChild(canvasWrapper);
|
|
9279
|
+
container.removeChild(mask);
|
|
9280
|
+
textarea.remove();
|
|
9281
|
+
canvasWrapper.remove();
|
|
9282
|
+
mask = null;
|
|
9283
|
+
textarea = null;
|
|
9284
|
+
canvasWrapper = null;
|
|
9285
|
+
mask = null;
|
|
9286
|
+
activeElem = null;
|
|
9287
|
+
activePosition = null;
|
|
9288
|
+
originText = null;
|
|
8604
9289
|
}
|
|
8605
9290
|
};
|
|
8606
9291
|
};
|
|
@@ -8657,23 +9342,22 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8657
9342
|
const { left, top, width, height } = clientRect;
|
|
8658
9343
|
return { left, top, width, height };
|
|
8659
9344
|
};
|
|
8660
|
-
|
|
8661
|
-
contextMenuPointer.setAttribute("id", id);
|
|
8662
|
-
contextMenuPointer.style.position = "fixed";
|
|
8663
|
-
contextMenuPointer.style.top = "0";
|
|
8664
|
-
contextMenuPointer.style.bottom = "unset";
|
|
8665
|
-
contextMenuPointer.style.left = "0";
|
|
8666
|
-
contextMenuPointer.style.right = "unset";
|
|
8667
|
-
container.appendChild(contextMenuPointer);
|
|
9345
|
+
let contextMenuPointer = document.createElement("div");
|
|
8668
9346
|
return {
|
|
8669
9347
|
name: "@middleware/pointer",
|
|
8670
9348
|
use() {
|
|
9349
|
+
contextMenuPointer.setAttribute("id", id);
|
|
9350
|
+
contextMenuPointer.style.position = "fixed";
|
|
9351
|
+
contextMenuPointer.style.top = "0";
|
|
9352
|
+
contextMenuPointer.style.bottom = "unset";
|
|
9353
|
+
contextMenuPointer.style.left = "0";
|
|
9354
|
+
contextMenuPointer.style.right = "unset";
|
|
9355
|
+
container.appendChild(contextMenuPointer);
|
|
8671
9356
|
},
|
|
8672
9357
|
disuse() {
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
pointEnd() {
|
|
9358
|
+
container.removeChild(contextMenuPointer);
|
|
9359
|
+
contextMenuPointer.remove();
|
|
9360
|
+
contextMenuPointer = null;
|
|
8677
9361
|
},
|
|
8678
9362
|
contextMenu(e) {
|
|
8679
9363
|
const { point } = e;
|
|
@@ -8735,9 +9419,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8735
9419
|
resetMiddlewareConfig(middleware, config) {
|
|
8736
9420
|
__privateGet(this, _board).resetMiddlewareConfig(middleware, config);
|
|
8737
9421
|
}
|
|
8738
|
-
setData(data
|
|
9422
|
+
setData(data) {
|
|
8739
9423
|
validateElements((data == null ? void 0 : data.elements) || []);
|
|
8740
|
-
__privateGet(this, _board).setData(data
|
|
9424
|
+
__privateGet(this, _board).setData(data);
|
|
8741
9425
|
}
|
|
8742
9426
|
getData() {
|
|
8743
9427
|
return __privateGet(this, _board).getData();
|
|
@@ -8796,6 +9480,227 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8796
9480
|
offBoardWatcherEvents() {
|
|
8797
9481
|
__privateGet(this, _board).offWatcherEvents();
|
|
8798
9482
|
}
|
|
9483
|
+
createElement(type, element, opts) {
|
|
9484
|
+
const { viewScaleInfo, viewSizeInfo } = this.getViewInfo();
|
|
9485
|
+
return createElement(
|
|
9486
|
+
type,
|
|
9487
|
+
element || {},
|
|
9488
|
+
(opts == null ? void 0 : opts.viewCenter) === true ? {
|
|
9489
|
+
viewScaleInfo,
|
|
9490
|
+
viewSizeInfo
|
|
9491
|
+
} : void 0
|
|
9492
|
+
);
|
|
9493
|
+
}
|
|
9494
|
+
updateElement(element) {
|
|
9495
|
+
const data = this.getData() || { elements: [] };
|
|
9496
|
+
const uuid = element.uuid;
|
|
9497
|
+
const position = getElementPositionFromList(uuid, data.elements);
|
|
9498
|
+
const beforeElem = findElementFromListByPosition(position, data.elements);
|
|
9499
|
+
if (!beforeElem) {
|
|
9500
|
+
return null;
|
|
9501
|
+
}
|
|
9502
|
+
const before = toFlattenElement(beforeElem);
|
|
9503
|
+
const updatedElement = updateElementInListByPosition(position, element, data.elements, { strict: true });
|
|
9504
|
+
const after = toFlattenElement(updatedElement);
|
|
9505
|
+
this.setData(data);
|
|
9506
|
+
this.refresh();
|
|
9507
|
+
const modifyRecord = {
|
|
9508
|
+
type: "updateElement",
|
|
9509
|
+
time: Date.now(),
|
|
9510
|
+
content: { method: "updateElement", uuid, before, after }
|
|
9511
|
+
};
|
|
9512
|
+
return modifyRecord;
|
|
9513
|
+
}
|
|
9514
|
+
modifyElement(element) {
|
|
9515
|
+
const { uuid, ...restElement } = element;
|
|
9516
|
+
const data = this.getData() || { elements: [] };
|
|
9517
|
+
const position = getElementPositionFromList(uuid, data.elements);
|
|
9518
|
+
const beforeElem = findElementFromListByPosition(position, data.elements);
|
|
9519
|
+
if (!beforeElem) {
|
|
9520
|
+
return null;
|
|
9521
|
+
}
|
|
9522
|
+
const modifyRecord = getModifyElementRecord({
|
|
9523
|
+
modifiedElement: element,
|
|
9524
|
+
beforeElement: beforeElem
|
|
9525
|
+
});
|
|
9526
|
+
updateElementInListByPosition(position, restElement, data.elements);
|
|
9527
|
+
this.setData(data);
|
|
9528
|
+
this.refresh();
|
|
9529
|
+
return modifyRecord;
|
|
9530
|
+
}
|
|
9531
|
+
modifyElements(elements) {
|
|
9532
|
+
const data = this.getData() || { elements: [] };
|
|
9533
|
+
let modifyRecord = null;
|
|
9534
|
+
const before = [];
|
|
9535
|
+
const after = [];
|
|
9536
|
+
elements.forEach((element) => {
|
|
9537
|
+
const { uuid, ...restElement } = element;
|
|
9538
|
+
const position = getElementPositionFromList(uuid, data.elements);
|
|
9539
|
+
const beforeElem = findElementFromListByPosition(position, data.elements);
|
|
9540
|
+
if (!beforeElem) {
|
|
9541
|
+
return null;
|
|
9542
|
+
}
|
|
9543
|
+
const tempRecord = getModifyElementRecord({
|
|
9544
|
+
modifiedElement: element,
|
|
9545
|
+
beforeElement: beforeElem
|
|
9546
|
+
});
|
|
9547
|
+
if (tempRecord.content) {
|
|
9548
|
+
before.push({
|
|
9549
|
+
...tempRecord.content.before,
|
|
9550
|
+
uuid
|
|
9551
|
+
});
|
|
9552
|
+
after.push({
|
|
9553
|
+
...tempRecord.content.after,
|
|
9554
|
+
uuid
|
|
9555
|
+
});
|
|
9556
|
+
}
|
|
9557
|
+
updateElementInListByPosition(position, restElement, data.elements);
|
|
9558
|
+
});
|
|
9559
|
+
modifyRecord = {
|
|
9560
|
+
type: "modifyElements",
|
|
9561
|
+
time: Date.now(),
|
|
9562
|
+
content: {
|
|
9563
|
+
method: "modifyElements",
|
|
9564
|
+
before,
|
|
9565
|
+
after
|
|
9566
|
+
}
|
|
9567
|
+
};
|
|
9568
|
+
this.setData(data);
|
|
9569
|
+
this.refresh();
|
|
9570
|
+
return modifyRecord;
|
|
9571
|
+
}
|
|
9572
|
+
addElement(element, opts) {
|
|
9573
|
+
var _a;
|
|
9574
|
+
const data = this.getData() || { elements: [] };
|
|
9575
|
+
if (!opts || !((_a = opts == null ? void 0 : opts.position) == null ? void 0 : _a.length)) {
|
|
9576
|
+
data.elements.push(element);
|
|
9577
|
+
} else if (opts == null ? void 0 : opts.position) {
|
|
9578
|
+
const position2 = [...(opts == null ? void 0 : opts.position) || []];
|
|
9579
|
+
insertElementToListByPosition(element, position2, data.elements);
|
|
9580
|
+
}
|
|
9581
|
+
const position = getElementPositionFromList(element.uuid, data.elements);
|
|
9582
|
+
const modifyRecord = {
|
|
9583
|
+
type: "addElement",
|
|
9584
|
+
time: Date.now(),
|
|
9585
|
+
content: { method: "addElement", uuid: element.uuid, position, element: deepClone(element) }
|
|
9586
|
+
};
|
|
9587
|
+
this.setData(data);
|
|
9588
|
+
this.refresh();
|
|
9589
|
+
return modifyRecord;
|
|
9590
|
+
}
|
|
9591
|
+
deleteElement(uuid) {
|
|
9592
|
+
const data = this.getData() || { elements: [] };
|
|
9593
|
+
const position = getElementPositionFromList(uuid, data.elements);
|
|
9594
|
+
const element = findElementFromListByPosition(position, data.elements);
|
|
9595
|
+
const modifyRecord = {
|
|
9596
|
+
type: "deleteElement",
|
|
9597
|
+
time: Date.now(),
|
|
9598
|
+
content: { method: "deleteElement", uuid, position, element: element ? deepClone(element) : null }
|
|
9599
|
+
};
|
|
9600
|
+
deleteElementInList(uuid, data.elements);
|
|
9601
|
+
this.setData(data);
|
|
9602
|
+
this.refresh();
|
|
9603
|
+
return modifyRecord;
|
|
9604
|
+
}
|
|
9605
|
+
moveElement(uuid, to) {
|
|
9606
|
+
const data = this.getData() || { elements: [] };
|
|
9607
|
+
const from = getElementPositionFromList(uuid, data.elements);
|
|
9608
|
+
const modifyRecord = {
|
|
9609
|
+
type: "moveElement",
|
|
9610
|
+
time: Date.now(),
|
|
9611
|
+
content: { method: "moveElement", uuid, from: [...from], to: [...to] }
|
|
9612
|
+
};
|
|
9613
|
+
const { elements: list } = moveElementPosition(data.elements, { from, to });
|
|
9614
|
+
data.elements = list;
|
|
9615
|
+
this.setData(data);
|
|
9616
|
+
this.refresh();
|
|
9617
|
+
return modifyRecord;
|
|
9618
|
+
}
|
|
9619
|
+
modifyLayout(layout) {
|
|
9620
|
+
const data = this.getData() || { elements: [] };
|
|
9621
|
+
const modifyRecord = {
|
|
9622
|
+
type: "modifyLayout",
|
|
9623
|
+
time: Date.now(),
|
|
9624
|
+
content: {
|
|
9625
|
+
method: "modifyLayout",
|
|
9626
|
+
before: null,
|
|
9627
|
+
after: null
|
|
9628
|
+
}
|
|
9629
|
+
};
|
|
9630
|
+
if (layout === null) {
|
|
9631
|
+
if (data.layout) {
|
|
9632
|
+
modifyRecord.content.before = toFlattenLayout(data.layout);
|
|
9633
|
+
delete data["layout"];
|
|
9634
|
+
this.setData(data);
|
|
9635
|
+
this.refresh();
|
|
9636
|
+
return modifyRecord;
|
|
9637
|
+
} else {
|
|
9638
|
+
return modifyRecord;
|
|
9639
|
+
}
|
|
9640
|
+
}
|
|
9641
|
+
const beforeLayout = data.layout;
|
|
9642
|
+
let before = {};
|
|
9643
|
+
const after = toFlattenLayout(layout);
|
|
9644
|
+
if (data.layout) {
|
|
9645
|
+
Object.keys(after).forEach((key2) => {
|
|
9646
|
+
let val = get(beforeLayout, key2);
|
|
9647
|
+
if (val === void 0 && /(borderRadius|borderWidth)\[[0-9]{1,}\]$/.test(key2)) {
|
|
9648
|
+
key2 = key2.replace(/\[[0-9]{1,}\]$/, "");
|
|
9649
|
+
val = get(beforeLayout, key2);
|
|
9650
|
+
}
|
|
9651
|
+
before[key2] = val;
|
|
9652
|
+
});
|
|
9653
|
+
before = toFlattenLayout(before);
|
|
9654
|
+
modifyRecord.content.before = before;
|
|
9655
|
+
} else {
|
|
9656
|
+
data.layout = {};
|
|
9657
|
+
}
|
|
9658
|
+
modifyRecord.content.after = after;
|
|
9659
|
+
mergeLayout(data.layout, layout);
|
|
9660
|
+
this.setData(data);
|
|
9661
|
+
this.refresh();
|
|
9662
|
+
return modifyRecord;
|
|
9663
|
+
}
|
|
9664
|
+
modifyGlobal(global) {
|
|
9665
|
+
const data = this.getData() || { elements: [] };
|
|
9666
|
+
const modifyRecord = {
|
|
9667
|
+
type: "modifyGlobal",
|
|
9668
|
+
time: Date.now(),
|
|
9669
|
+
content: {
|
|
9670
|
+
method: "modifyGlobal",
|
|
9671
|
+
before: null,
|
|
9672
|
+
after: null
|
|
9673
|
+
}
|
|
9674
|
+
};
|
|
9675
|
+
if (global === null) {
|
|
9676
|
+
if (data.global) {
|
|
9677
|
+
modifyRecord.content.before = toFlattenGlobal(data.global);
|
|
9678
|
+
delete data["global"];
|
|
9679
|
+
this.setData(data);
|
|
9680
|
+
this.refresh();
|
|
9681
|
+
return modifyRecord;
|
|
9682
|
+
} else {
|
|
9683
|
+
return modifyRecord;
|
|
9684
|
+
}
|
|
9685
|
+
}
|
|
9686
|
+
const beforeGlobal = data.global;
|
|
9687
|
+
let before = {};
|
|
9688
|
+
const after = toFlattenGlobal(global);
|
|
9689
|
+
if (data.global) {
|
|
9690
|
+
Object.keys(after).forEach((key2) => {
|
|
9691
|
+
before[key2] = get(beforeGlobal, key2);
|
|
9692
|
+
});
|
|
9693
|
+
before = toFlattenGlobal(before);
|
|
9694
|
+
modifyRecord.content.before = before;
|
|
9695
|
+
} else {
|
|
9696
|
+
data.global = {};
|
|
9697
|
+
}
|
|
9698
|
+
modifyRecord.content.after = after;
|
|
9699
|
+
mergeGlobal(data.global, global);
|
|
9700
|
+
this.setData(data);
|
|
9701
|
+
this.refresh();
|
|
9702
|
+
return modifyRecord;
|
|
9703
|
+
}
|
|
8799
9704
|
}
|
|
8800
9705
|
_board = new WeakMap();
|
|
8801
9706
|
_canvas = new WeakMap();
|