@idraw/core 0.4.0-beta.16 → 0.4.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.d.ts +5 -2
- package/dist/esm/index.js +3 -2
- package/dist/esm/middleware/info/draw-info.d.ts +31 -0
- package/dist/esm/middleware/info/draw-info.js +110 -0
- package/dist/esm/middleware/info/index.d.ts +3 -0
- package/dist/esm/middleware/info/index.js +110 -0
- package/dist/esm/middleware/info/types.d.ts +3 -0
- package/dist/esm/middleware/info/types.js +1 -0
- package/dist/esm/middleware/ruler/index.d.ts +2 -1
- package/dist/esm/middleware/ruler/index.js +3 -2
- package/dist/esm/middleware/ruler/types.d.ts +3 -0
- package/dist/esm/middleware/ruler/types.js +1 -0
- package/dist/esm/middleware/ruler/util.d.ts +6 -1
- package/dist/esm/middleware/ruler/util.js +55 -1
- package/dist/esm/middleware/scroller/index.d.ts +2 -1
- package/dist/esm/middleware/scroller/types.d.ts +9 -0
- package/dist/esm/middleware/scroller/types.js +1 -0
- package/dist/esm/middleware/scroller/util.js +1 -1
- package/dist/esm/middleware/selector/config.d.ts +4 -0
- package/dist/esm/middleware/selector/config.js +4 -0
- package/dist/esm/middleware/selector/draw-auxiliary.d.ts +4 -4
- package/dist/esm/middleware/selector/draw-auxiliary.js +26 -11
- package/dist/esm/middleware/selector/draw-reference.d.ts +5 -0
- package/dist/esm/middleware/selector/draw-reference.js +31 -0
- package/dist/esm/middleware/selector/draw-wrapper.d.ts +2 -2
- package/dist/esm/middleware/selector/draw-wrapper.js +2 -3
- package/dist/esm/middleware/selector/index.d.ts +3 -0
- package/dist/esm/middleware/selector/index.js +104 -16
- package/dist/esm/middleware/selector/reference.d.ts +13 -0
- package/dist/esm/middleware/selector/reference.js +273 -0
- package/dist/esm/middleware/selector/types.d.ts +5 -3
- package/dist/esm/middleware/selector/types.js +1 -1
- package/dist/esm/middleware/selector/util.js +12 -13
- package/dist/index.global.js +1120 -124
- package/dist/index.global.min.js +1 -1
- package/package.json +5 -5
- package/dist/esm/middleware/selector/auxiliary.d.ts +0 -5
- package/dist/esm/middleware/selector/auxiliary.js +0 -10
package/dist/index.global.js
CHANGED
|
@@ -316,7 +316,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
316
316
|
function textAlign(value) {
|
|
317
317
|
return ["center", "left", "right"].includes(value);
|
|
318
318
|
}
|
|
319
|
-
function fontFamily$
|
|
319
|
+
function fontFamily$2(value) {
|
|
320
320
|
return typeof value === "string" && value.length > 0;
|
|
321
321
|
}
|
|
322
322
|
function fontWeight$1(value) {
|
|
@@ -345,7 +345,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
345
345
|
fontSize: fontSize$1,
|
|
346
346
|
lineHeight,
|
|
347
347
|
textAlign,
|
|
348
|
-
fontFamily: fontFamily$
|
|
348
|
+
fontFamily: fontFamily$2,
|
|
349
349
|
fontWeight: fontWeight$1,
|
|
350
350
|
strokeWidth
|
|
351
351
|
};
|
|
@@ -839,8 +839,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
839
839
|
get(name) {
|
|
840
840
|
return __classPrivateFieldGet$7(this, _Store_temp, "f")[name];
|
|
841
841
|
}
|
|
842
|
-
getSnapshot() {
|
|
843
|
-
|
|
842
|
+
getSnapshot(opts) {
|
|
843
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.deepClone) === true) {
|
|
844
|
+
return deepClone(__classPrivateFieldGet$7(this, _Store_temp, "f"));
|
|
845
|
+
}
|
|
846
|
+
return Object.assign({}, __classPrivateFieldGet$7(this, _Store_temp, "f"));
|
|
844
847
|
}
|
|
845
848
|
clear() {
|
|
846
849
|
__classPrivateFieldSet$7(this, _Store_temp, __classPrivateFieldGet$7(this, _Store_instances, "m", _Store_createTempStorage).call(this), "f");
|
|
@@ -1188,6 +1191,24 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1188
1191
|
_scan(uuid, elements);
|
|
1189
1192
|
return groupQueue;
|
|
1190
1193
|
}
|
|
1194
|
+
function getGroupQueueByElementPosition(elements, position) {
|
|
1195
|
+
var _a;
|
|
1196
|
+
const groupQueue = [];
|
|
1197
|
+
let currentElements = elements;
|
|
1198
|
+
if (position.length > 1) {
|
|
1199
|
+
for (let i = 0; i < position.length - 1; i++) {
|
|
1200
|
+
const index = position[i];
|
|
1201
|
+
const group = currentElements[index];
|
|
1202
|
+
if ((group === null || group === void 0 ? void 0 : group.type) === "group" && Array.isArray((_a = group === null || group === void 0 ? void 0 : group.detail) === null || _a === void 0 ? void 0 : _a.children)) {
|
|
1203
|
+
groupQueue.push(group);
|
|
1204
|
+
currentElements = group.detail.children;
|
|
1205
|
+
} else {
|
|
1206
|
+
return null;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
return groupQueue;
|
|
1211
|
+
}
|
|
1191
1212
|
function findElementsFromListByPositions(positions, list) {
|
|
1192
1213
|
const elements = [];
|
|
1193
1214
|
positions.forEach((pos) => {
|
|
@@ -1240,17 +1261,6 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1240
1261
|
_loop(elements);
|
|
1241
1262
|
return result;
|
|
1242
1263
|
}
|
|
1243
|
-
function checkRectIntersect(rect1, rect2) {
|
|
1244
|
-
const react1MinX = rect1.x;
|
|
1245
|
-
const react1MinY = rect1.y;
|
|
1246
|
-
const react1MaxX = rect1.x + rect1.w;
|
|
1247
|
-
const react1MaxY = rect1.y + rect1.h;
|
|
1248
|
-
const react2MinX = rect2.x;
|
|
1249
|
-
const react2MinY = rect2.y;
|
|
1250
|
-
const react2MaxX = rect2.x + rect2.w;
|
|
1251
|
-
const react2MaxY = rect2.y + rect2.h;
|
|
1252
|
-
return react1MinX <= react2MaxX && react1MaxX >= react2MinX && react1MinY <= react2MaxY && react1MaxY >= react2MinY;
|
|
1253
|
-
}
|
|
1254
1264
|
function getElementVertexes(elemSize) {
|
|
1255
1265
|
const { x: x2, y: y2, h: h2, w: w2 } = elemSize;
|
|
1256
1266
|
return [
|
|
@@ -1491,19 +1501,152 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1491
1501
|
}
|
|
1492
1502
|
return result;
|
|
1493
1503
|
}
|
|
1494
|
-
function
|
|
1495
|
-
const {
|
|
1504
|
+
function calcElementOriginRectInfo(elemSize, opts) {
|
|
1505
|
+
const { groupQueue } = opts;
|
|
1506
|
+
const vertexes = calcElementVertexesInGroup(elemSize, { groupQueue });
|
|
1507
|
+
const top = getCenterFromTwoPoints(vertexes[0], vertexes[1]);
|
|
1508
|
+
const right = getCenterFromTwoPoints(vertexes[1], vertexes[2]);
|
|
1509
|
+
const bottom = getCenterFromTwoPoints(vertexes[2], vertexes[3]);
|
|
1510
|
+
const left = getCenterFromTwoPoints(vertexes[3], vertexes[0]);
|
|
1511
|
+
const topLeft = vertexes[0];
|
|
1512
|
+
const topRight = vertexes[1];
|
|
1513
|
+
const bottomRight = vertexes[2];
|
|
1514
|
+
const bottomLeft = vertexes[3];
|
|
1515
|
+
const maxX = Math.max(topLeft.x, topRight.x, bottomRight.x, bottomLeft.x);
|
|
1516
|
+
const maxY = Math.max(topLeft.y, topRight.y, bottomRight.y, bottomLeft.y);
|
|
1517
|
+
const minX = Math.min(topLeft.x, topRight.x, bottomRight.x, bottomLeft.x);
|
|
1518
|
+
const minY = Math.min(topLeft.y, topRight.y, bottomRight.y, bottomLeft.y);
|
|
1519
|
+
const center = {
|
|
1520
|
+
x: (maxX + minX) / 2,
|
|
1521
|
+
y: (maxY + minY) / 2
|
|
1522
|
+
};
|
|
1523
|
+
const rectInfo = {
|
|
1524
|
+
center,
|
|
1525
|
+
topLeft,
|
|
1526
|
+
topRight,
|
|
1527
|
+
bottomLeft,
|
|
1528
|
+
bottomRight,
|
|
1529
|
+
top,
|
|
1530
|
+
right,
|
|
1531
|
+
left,
|
|
1532
|
+
bottom
|
|
1533
|
+
};
|
|
1534
|
+
return rectInfo;
|
|
1535
|
+
}
|
|
1536
|
+
function originRectInfoToRangeRectInfo(originRectInfo) {
|
|
1537
|
+
const rangeMaxX = Math.max(originRectInfo.topLeft.x, originRectInfo.topRight.x, originRectInfo.bottomRight.x, originRectInfo.bottomLeft.x);
|
|
1538
|
+
const rangeMaxY = Math.max(originRectInfo.topLeft.y, originRectInfo.topRight.y, originRectInfo.bottomRight.y, originRectInfo.bottomLeft.y);
|
|
1539
|
+
const rangeMinX = Math.min(originRectInfo.topLeft.x, originRectInfo.topRight.x, originRectInfo.bottomRight.x, originRectInfo.bottomLeft.x);
|
|
1540
|
+
const rangeMinY = Math.min(originRectInfo.topLeft.y, originRectInfo.topRight.y, originRectInfo.bottomRight.y, originRectInfo.bottomLeft.y);
|
|
1541
|
+
const rangeCenter = { x: originRectInfo.center.x, y: originRectInfo.center.y };
|
|
1542
|
+
const rangeTopLeft = { x: rangeMinX, y: rangeMinY };
|
|
1543
|
+
const rangeTopRight = { x: rangeMaxX, y: rangeMinY };
|
|
1544
|
+
const rangeBottomRight = { x: rangeMaxX, y: rangeMaxY };
|
|
1545
|
+
const rangeBottomLeft = { x: rangeMinX, y: rangeMaxY };
|
|
1546
|
+
const rangeTop = getCenterFromTwoPoints(rangeTopLeft, rangeTopRight);
|
|
1547
|
+
const rangeBottom = getCenterFromTwoPoints(rangeBottomLeft, rangeBottomRight);
|
|
1548
|
+
const rangeLeft = getCenterFromTwoPoints(rangeTopLeft, rangeBottomLeft);
|
|
1549
|
+
const rangeRight = getCenterFromTwoPoints(rangeTopRight, rangeBottomRight);
|
|
1550
|
+
const rangeRectInfo = {
|
|
1551
|
+
center: rangeCenter,
|
|
1552
|
+
topLeft: rangeTopLeft,
|
|
1553
|
+
topRight: rangeTopRight,
|
|
1554
|
+
bottomLeft: rangeBottomLeft,
|
|
1555
|
+
bottomRight: rangeBottomRight,
|
|
1556
|
+
top: rangeTop,
|
|
1557
|
+
right: rangeRight,
|
|
1558
|
+
left: rangeLeft,
|
|
1559
|
+
bottom: rangeBottom
|
|
1560
|
+
};
|
|
1561
|
+
return rangeRectInfo;
|
|
1562
|
+
}
|
|
1563
|
+
function sortElementsViewVisiableInfoMap(elements, opts) {
|
|
1564
|
+
const visibleInfoMap = {};
|
|
1565
|
+
const currentPosition = [];
|
|
1566
|
+
const _walk = (elem) => {
|
|
1567
|
+
const baseInfo = {
|
|
1568
|
+
isVisibleInView: true,
|
|
1569
|
+
isGroup: elem.type === "group",
|
|
1570
|
+
position: [...currentPosition]
|
|
1571
|
+
};
|
|
1572
|
+
let originRectInfo = null;
|
|
1573
|
+
const groupQueue = getGroupQueueByElementPosition(elements, currentPosition);
|
|
1574
|
+
originRectInfo = calcElementOriginRectInfo(elem, {
|
|
1575
|
+
groupQueue: groupQueue || []
|
|
1576
|
+
});
|
|
1577
|
+
visibleInfoMap[elem.uuid] = Object.assign(Object.assign({}, baseInfo), {
|
|
1578
|
+
originRectInfo,
|
|
1579
|
+
rangeRectInfo: is.angle(elem.angle) ? originRectInfoToRangeRectInfo(originRectInfo) : originRectInfo
|
|
1580
|
+
});
|
|
1581
|
+
if (elem.type === "group") {
|
|
1582
|
+
elem.detail.children.forEach((ele, i) => {
|
|
1583
|
+
currentPosition.push(i);
|
|
1584
|
+
_walk(ele);
|
|
1585
|
+
currentPosition.pop();
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
elements.forEach((elem, index) => {
|
|
1590
|
+
currentPosition.push(index);
|
|
1591
|
+
_walk(elem);
|
|
1592
|
+
currentPosition.pop();
|
|
1593
|
+
});
|
|
1594
|
+
return updateViewVisibleInfoMapStatus(visibleInfoMap, opts);
|
|
1595
|
+
}
|
|
1596
|
+
function isRangeRectInfoCollide(info1, info2) {
|
|
1597
|
+
const rect1MinX = Math.min(info1.topLeft.x, info1.topRight.x, info1.bottomLeft.x, info1.bottomRight.x);
|
|
1598
|
+
const rect1MaxX = Math.max(info1.topLeft.x, info1.topRight.x, info1.bottomLeft.x, info1.bottomRight.x);
|
|
1599
|
+
const rect1MinY = Math.min(info1.topLeft.y, info1.topRight.y, info1.bottomLeft.y, info1.bottomRight.y);
|
|
1600
|
+
const rect1MaxY = Math.max(info1.topLeft.y, info1.topRight.y, info1.bottomLeft.y, info1.bottomRight.y);
|
|
1601
|
+
const rect2MinX = Math.min(info2.topLeft.x, info2.topRight.x, info2.bottomLeft.x, info2.bottomRight.x);
|
|
1602
|
+
const rect2MaxX = Math.max(info2.topLeft.x, info2.topRight.x, info2.bottomLeft.x, info2.bottomRight.x);
|
|
1603
|
+
const rect2MinY = Math.min(info2.topLeft.y, info2.topRight.y, info2.bottomLeft.y, info2.bottomRight.y);
|
|
1604
|
+
const rect2MaxY = Math.max(info2.topLeft.y, info2.topRight.y, info2.bottomLeft.y, info2.bottomRight.y);
|
|
1605
|
+
if (rect1MinX <= rect2MaxX && rect1MaxX >= rect2MinX && rect1MinY <= rect2MaxY && rect1MaxY >= rect2MinY || rect2MaxX <= rect1MaxY && rect2MaxX >= rect1MaxY && rect2MaxX <= rect1MaxY && rect2MaxX >= rect1MaxY) {
|
|
1606
|
+
return true;
|
|
1607
|
+
}
|
|
1608
|
+
return false;
|
|
1609
|
+
}
|
|
1610
|
+
function updateViewVisibleInfoMapStatus(viewVisibleInfoMap, opts) {
|
|
1611
|
+
const canvasRectInfo = calcVisibleOriginCanvasRectInfo(opts);
|
|
1612
|
+
let visibleCount = 0;
|
|
1613
|
+
let invisibleCount = 0;
|
|
1614
|
+
Object.keys(viewVisibleInfoMap).forEach((uuid) => {
|
|
1615
|
+
const info = viewVisibleInfoMap[uuid];
|
|
1616
|
+
info.isVisibleInView = isRangeRectInfoCollide(info.rangeRectInfo, canvasRectInfo);
|
|
1617
|
+
info.isVisibleInView ? visibleCount++ : invisibleCount++;
|
|
1618
|
+
});
|
|
1619
|
+
return { viewVisibleInfoMap, visibleCount, invisibleCount };
|
|
1620
|
+
}
|
|
1621
|
+
function calcVisibleOriginCanvasRectInfo(opts) {
|
|
1622
|
+
const { viewScaleInfo, viewSizeInfo } = opts;
|
|
1623
|
+
const { scale, offsetTop, offsetLeft } = viewScaleInfo;
|
|
1496
1624
|
const { width, height } = viewSizeInfo;
|
|
1497
|
-
const
|
|
1498
|
-
const
|
|
1499
|
-
const
|
|
1500
|
-
const
|
|
1501
|
-
const
|
|
1502
|
-
const
|
|
1503
|
-
const
|
|
1504
|
-
const
|
|
1505
|
-
const
|
|
1506
|
-
|
|
1625
|
+
const x2 = 0 - offsetLeft / scale;
|
|
1626
|
+
const y2 = 0 - offsetTop / scale;
|
|
1627
|
+
const w2 = width / scale;
|
|
1628
|
+
const h2 = height / scale;
|
|
1629
|
+
const center = calcElementCenter({ x: x2, y: y2, w: w2, h: h2 });
|
|
1630
|
+
const topLeft = { x: x2, y: y2 };
|
|
1631
|
+
const topRight = { x: x2 + w2, y: y2 };
|
|
1632
|
+
const bottomLeft = { x: x2, y: y2 + h2 };
|
|
1633
|
+
const bottomRight = { x: x2 + w2, y: y2 + h2 };
|
|
1634
|
+
const left = { x: x2, y: center.y };
|
|
1635
|
+
const top = { x: center.x, y: y2 };
|
|
1636
|
+
const right = { x: x2 + w2, y: center.y };
|
|
1637
|
+
const bottom = { x: center.x, y: y2 + h2 };
|
|
1638
|
+
const rectInfo = {
|
|
1639
|
+
center,
|
|
1640
|
+
topLeft,
|
|
1641
|
+
topRight,
|
|
1642
|
+
bottomLeft,
|
|
1643
|
+
bottomRight,
|
|
1644
|
+
left,
|
|
1645
|
+
top,
|
|
1646
|
+
right,
|
|
1647
|
+
bottom
|
|
1648
|
+
};
|
|
1649
|
+
return rectInfo;
|
|
1507
1650
|
}
|
|
1508
1651
|
function createControllerElementSizeFromCenter(center, opts) {
|
|
1509
1652
|
const { x: x2, y: y2 } = center;
|
|
@@ -2143,7 +2286,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2143
2286
|
}
|
|
2144
2287
|
function drawCircle(ctx, elem, opts) {
|
|
2145
2288
|
const { detail, angle: angle2 } = elem;
|
|
2146
|
-
const {
|
|
2289
|
+
const { viewScaleInfo, viewSizeInfo, parentOpacity } = opts;
|
|
2147
2290
|
const { background: background2 = "#000000", borderColor: borderColor2 = "#000000", boxSizing, borderWidth: borderWidth2 = 0 } = detail;
|
|
2148
2291
|
let bw = 0;
|
|
2149
2292
|
if (typeof borderWidth2 === "number" && borderWidth2 > 0) {
|
|
@@ -2152,7 +2295,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2152
2295
|
bw = borderWidth2[0];
|
|
2153
2296
|
}
|
|
2154
2297
|
bw = bw * viewScaleInfo.scale;
|
|
2155
|
-
const { x: x2, y: y2, w: w2, h: h2 } = (
|
|
2298
|
+
const { x: x2, y: y2, w: w2, h: h2 } = calcViewElementSize({ x: elem.x, y: elem.y, w: elem.w, h: elem.h }, { viewScaleInfo, viewSizeInfo }) || elem;
|
|
2156
2299
|
const viewElem = Object.assign(Object.assign({}, elem), { x: x2, y: y2, w: w2, h: h2, angle: angle2 });
|
|
2157
2300
|
rotateElement$1(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
2158
2301
|
drawBoxShadow(ctx, viewElem, {
|
|
@@ -2205,8 +2348,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2205
2348
|
});
|
|
2206
2349
|
}
|
|
2207
2350
|
function drawRect(ctx, elem, opts) {
|
|
2208
|
-
const {
|
|
2209
|
-
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = (
|
|
2351
|
+
const { viewScaleInfo, viewSizeInfo, parentOpacity } = opts;
|
|
2352
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calcViewElementSize(elem, { viewScaleInfo, viewSizeInfo }) || elem;
|
|
2210
2353
|
const viewElem = Object.assign(Object.assign({}, elem), { x: x2, y: y2, w: w2, h: h2, angle: angle2 });
|
|
2211
2354
|
rotateElement$1(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
2212
2355
|
drawBoxShadow(ctx, viewElem, {
|
|
@@ -2228,8 +2371,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2228
2371
|
}
|
|
2229
2372
|
function drawImage(ctx, elem, opts) {
|
|
2230
2373
|
const content = opts.loader.getContent(elem);
|
|
2231
|
-
const {
|
|
2232
|
-
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = (
|
|
2374
|
+
const { viewScaleInfo, viewSizeInfo, parentOpacity } = opts;
|
|
2375
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calcViewElementSize(elem, { viewScaleInfo, viewSizeInfo }) || elem;
|
|
2233
2376
|
const viewElem = Object.assign(Object.assign({}, elem), { x: x2, y: y2, w: w2, h: h2, angle: angle2 });
|
|
2234
2377
|
rotateElement$1(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
2235
2378
|
drawBoxShadow(ctx, viewElem, {
|
|
@@ -2275,8 +2418,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2275
2418
|
}
|
|
2276
2419
|
function drawSVG(ctx, elem, opts) {
|
|
2277
2420
|
const content = opts.loader.getContent(elem);
|
|
2278
|
-
const {
|
|
2279
|
-
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = (
|
|
2421
|
+
const { viewScaleInfo, viewSizeInfo, parentOpacity } = opts;
|
|
2422
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calcViewElementSize(elem, { viewScaleInfo, viewSizeInfo }) || elem;
|
|
2280
2423
|
rotateElement$1(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
2281
2424
|
if (!content && !opts.loader.isDestroyed()) {
|
|
2282
2425
|
opts.loader.load(elem, opts.elementAssets || {});
|
|
@@ -2290,8 +2433,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2290
2433
|
}
|
|
2291
2434
|
function drawHTML(ctx, elem, opts) {
|
|
2292
2435
|
const content = opts.loader.getContent(elem);
|
|
2293
|
-
const {
|
|
2294
|
-
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = (
|
|
2436
|
+
const { viewScaleInfo, viewSizeInfo, parentOpacity } = opts;
|
|
2437
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calcViewElementSize(elem, { viewScaleInfo, viewSizeInfo }) || elem;
|
|
2295
2438
|
rotateElement$1(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
2296
2439
|
if (!content && !opts.loader.isDestroyed()) {
|
|
2297
2440
|
opts.loader.load(elem, opts.elementAssets || {});
|
|
@@ -2305,8 +2448,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2305
2448
|
}
|
|
2306
2449
|
const detailConfig = getDefaultElementDetailConfig();
|
|
2307
2450
|
function drawText(ctx, elem, opts) {
|
|
2308
|
-
const {
|
|
2309
|
-
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = (
|
|
2451
|
+
const { viewScaleInfo, viewSizeInfo, parentOpacity } = opts;
|
|
2452
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calcViewElementSize(elem, { viewScaleInfo, viewSizeInfo }) || elem;
|
|
2310
2453
|
const viewElem = Object.assign(Object.assign({}, elem), { x: x2, y: y2, w: w2, h: h2, angle: angle2 });
|
|
2311
2454
|
rotateElement$1(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
2312
2455
|
drawBox(ctx, viewElem, {
|
|
@@ -2409,8 +2552,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2409
2552
|
function drawPath(ctx, elem, opts) {
|
|
2410
2553
|
const { detail } = elem;
|
|
2411
2554
|
const { originX, originY, originW, originH } = detail;
|
|
2412
|
-
const {
|
|
2413
|
-
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = (
|
|
2555
|
+
const { viewScaleInfo, viewSizeInfo, parentOpacity } = opts;
|
|
2556
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calcViewElementSize(elem, { viewScaleInfo, viewSizeInfo }) || elem;
|
|
2414
2557
|
const scaleW = w2 / originW;
|
|
2415
2558
|
const scaleH = h2 / originH;
|
|
2416
2559
|
const viewOriginX = originX * scaleW;
|
|
@@ -2508,8 +2651,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2508
2651
|
}
|
|
2509
2652
|
}
|
|
2510
2653
|
function drawGroup(ctx, elem, opts) {
|
|
2511
|
-
const {
|
|
2512
|
-
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = (
|
|
2654
|
+
const { viewScaleInfo, viewSizeInfo, parentOpacity } = opts;
|
|
2655
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calcViewElementSize({ x: elem.x, y: elem.y, w: elem.w, h: elem.h, angle: elem.angle }, { viewScaleInfo, viewSizeInfo }) || elem;
|
|
2513
2656
|
const viewElem = Object.assign(Object.assign({}, elem), { x: x2, y: y2, w: w2, h: h2, angle: angle2 });
|
|
2514
2657
|
rotateElement$1(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
2515
2658
|
ctx.globalAlpha = getOpacity(elem) * parentOpacity;
|
|
@@ -2550,7 +2693,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2550
2693
|
h: elem.h || parentSize.h,
|
|
2551
2694
|
angle: elem.angle
|
|
2552
2695
|
};
|
|
2553
|
-
const { calculator
|
|
2696
|
+
const { calculator } = opts;
|
|
2554
2697
|
for (let i = 0; i < elem.detail.children.length; i++) {
|
|
2555
2698
|
let child = elem.detail.children[i];
|
|
2556
2699
|
child = Object.assign(Object.assign({}, child), {
|
|
@@ -2558,7 +2701,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2558
2701
|
y: newParentSize.y + child.y
|
|
2559
2702
|
});
|
|
2560
2703
|
if (opts.forceDrawAll !== true) {
|
|
2561
|
-
if (!(
|
|
2704
|
+
if (!(calculator === null || calculator === void 0 ? void 0 : calculator.needRender(child))) {
|
|
2562
2705
|
continue;
|
|
2563
2706
|
}
|
|
2564
2707
|
}
|
|
@@ -2590,7 +2733,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2590
2733
|
detail: Object.assign(Object.assign({}, defaultDetail), element === null || element === void 0 ? void 0 : element.detail)
|
|
2591
2734
|
});
|
|
2592
2735
|
if (opts.forceDrawAll !== true) {
|
|
2593
|
-
if (!((_a = opts.calculator) === null || _a === void 0 ? void 0 : _a.
|
|
2736
|
+
if (!((_a = opts.calculator) === null || _a === void 0 ? void 0 : _a.needRender(elem))) {
|
|
2594
2737
|
continue;
|
|
2595
2738
|
}
|
|
2596
2739
|
}
|
|
@@ -2603,27 +2746,47 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2603
2746
|
}
|
|
2604
2747
|
}
|
|
2605
2748
|
}
|
|
2606
|
-
function
|
|
2607
|
-
const {
|
|
2608
|
-
const elem = Object.assign({ uuid: "
|
|
2609
|
-
const { x: x2, y: y2, w: w2, h: h2 } = (
|
|
2749
|
+
function drawLayout(ctx, layout, opts, renderContent) {
|
|
2750
|
+
const { viewScaleInfo, viewSizeInfo, parentOpacity } = opts;
|
|
2751
|
+
const elem = Object.assign({ uuid: "layout", type: "group", x: 0, y: 0 }, layout);
|
|
2752
|
+
const { x: x2, y: y2, w: w2, h: h2 } = calcViewElementSize(elem, { viewScaleInfo, viewSizeInfo }) || elem;
|
|
2610
2753
|
const angle2 = 0;
|
|
2611
2754
|
const viewElem = Object.assign(Object.assign({}, elem), { x: x2, y: y2, w: w2, h: h2, angle: angle2 });
|
|
2755
|
+
ctx.globalAlpha = 1;
|
|
2612
2756
|
drawBoxShadow(ctx, viewElem, {
|
|
2613
2757
|
viewScaleInfo,
|
|
2614
2758
|
viewSizeInfo,
|
|
2615
2759
|
renderContent: () => {
|
|
2616
|
-
|
|
2617
|
-
originElem: elem,
|
|
2618
|
-
calcElemSize: { x: x2, y: y2, w: w2, h: h2, angle: angle2 },
|
|
2619
|
-
viewScaleInfo,
|
|
2620
|
-
viewSizeInfo,
|
|
2621
|
-
parentOpacity,
|
|
2622
|
-
renderContent: () => {
|
|
2623
|
-
}
|
|
2624
|
-
});
|
|
2760
|
+
drawBoxBackground(ctx, viewElem, { viewScaleInfo, viewSizeInfo });
|
|
2625
2761
|
}
|
|
2626
2762
|
});
|
|
2763
|
+
if (layout.detail.overflow === "hidden") {
|
|
2764
|
+
const { viewScaleInfo: viewScaleInfo2, viewSizeInfo: viewSizeInfo2 } = opts;
|
|
2765
|
+
const elem2 = Object.assign({ uuid: "layout", type: "group", x: 0, y: 0 }, layout);
|
|
2766
|
+
const viewElemSize = calcViewElementSize(elem2, { viewScaleInfo: viewScaleInfo2, viewSizeInfo: viewSizeInfo2 }) || elem2;
|
|
2767
|
+
const viewElem2 = Object.assign(Object.assign({}, elem2), viewElemSize);
|
|
2768
|
+
const { x: x3, y: y3, w: w3, h: h3, radiusList } = calcViewBoxSize(viewElem2, {
|
|
2769
|
+
viewScaleInfo: viewScaleInfo2,
|
|
2770
|
+
viewSizeInfo: viewSizeInfo2
|
|
2771
|
+
});
|
|
2772
|
+
ctx.save();
|
|
2773
|
+
ctx.fillStyle = "transparent";
|
|
2774
|
+
ctx.beginPath();
|
|
2775
|
+
ctx.moveTo(x3 + radiusList[0], y3);
|
|
2776
|
+
ctx.arcTo(x3 + w3, y3, x3 + w3, y3 + h3, radiusList[1]);
|
|
2777
|
+
ctx.arcTo(x3 + w3, y3 + h3, x3, y3 + h3, radiusList[2]);
|
|
2778
|
+
ctx.arcTo(x3, y3 + h3, x3, y3, radiusList[3]);
|
|
2779
|
+
ctx.arcTo(x3, y3, x3 + w3, y3, radiusList[0]);
|
|
2780
|
+
ctx.closePath();
|
|
2781
|
+
ctx.fill();
|
|
2782
|
+
ctx.clip();
|
|
2783
|
+
}
|
|
2784
|
+
renderContent(ctx);
|
|
2785
|
+
if (layout.detail.overflow === "hidden") {
|
|
2786
|
+
ctx.restore();
|
|
2787
|
+
}
|
|
2788
|
+
drawBoxBorder(ctx, viewElem, { viewScaleInfo, viewSizeInfo });
|
|
2789
|
+
ctx.globalAlpha = parentOpacity;
|
|
2627
2790
|
}
|
|
2628
2791
|
var __awaiter = function(thisArg, _arguments, P, generator) {
|
|
2629
2792
|
function adopt(value) {
|
|
@@ -2900,21 +3063,20 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2900
3063
|
w: opts.viewSizeInfo.width,
|
|
2901
3064
|
h: opts.viewSizeInfo.height
|
|
2902
3065
|
};
|
|
2903
|
-
|
|
2904
|
-
drawUnderlay(viewContext, data.underlay, Object.assign({
|
|
2905
|
-
loader,
|
|
2906
|
-
calculator,
|
|
2907
|
-
parentElementSize,
|
|
2908
|
-
parentOpacity: 1
|
|
2909
|
-
}, opts));
|
|
2910
|
-
}
|
|
2911
|
-
drawElementList(viewContext, data, Object.assign({
|
|
3066
|
+
const drawOpts = Object.assign({
|
|
2912
3067
|
loader,
|
|
2913
3068
|
calculator,
|
|
2914
3069
|
parentElementSize,
|
|
2915
3070
|
elementAssets: data.assets,
|
|
2916
3071
|
parentOpacity: 1
|
|
2917
|
-
}, opts)
|
|
3072
|
+
}, opts);
|
|
3073
|
+
if (data.layout) {
|
|
3074
|
+
drawLayout(viewContext, data.layout, drawOpts, () => {
|
|
3075
|
+
drawElementList(viewContext, data, drawOpts);
|
|
3076
|
+
});
|
|
3077
|
+
} else {
|
|
3078
|
+
drawElementList(viewContext, data, drawOpts);
|
|
3079
|
+
}
|
|
2918
3080
|
}
|
|
2919
3081
|
scale(num) {
|
|
2920
3082
|
const { sharer } = __classPrivateFieldGet$5(this, _Renderer_opts, "f");
|
|
@@ -2976,20 +3138,36 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2976
3138
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
2977
3139
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2978
3140
|
};
|
|
2979
|
-
var _Calculator_opts;
|
|
3141
|
+
var _Calculator_opts, _Calculator_store;
|
|
2980
3142
|
class Calculator {
|
|
2981
3143
|
constructor(opts) {
|
|
2982
3144
|
_Calculator_opts.set(this, void 0);
|
|
3145
|
+
_Calculator_store.set(this, void 0);
|
|
2983
3146
|
__classPrivateFieldSet$4(this, _Calculator_opts, opts, "f");
|
|
3147
|
+
__classPrivateFieldSet$4(this, _Calculator_store, new Store({
|
|
3148
|
+
defaultStorage: {
|
|
3149
|
+
viewVisibleInfoMap: {},
|
|
3150
|
+
visibleCount: 0,
|
|
3151
|
+
invisibleCount: 0
|
|
3152
|
+
}
|
|
3153
|
+
}), "f");
|
|
3154
|
+
}
|
|
3155
|
+
toGridNum(num, opts) {
|
|
3156
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.ignore) === true) {
|
|
3157
|
+
return num;
|
|
3158
|
+
}
|
|
3159
|
+
return Math.round(num);
|
|
2984
3160
|
}
|
|
2985
3161
|
destroy() {
|
|
2986
3162
|
__classPrivateFieldSet$4(this, _Calculator_opts, null, "f");
|
|
2987
3163
|
}
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
3164
|
+
needRender(elem) {
|
|
3165
|
+
const viewVisibleInfoMap = __classPrivateFieldGet$4(this, _Calculator_store, "f").get("viewVisibleInfoMap");
|
|
3166
|
+
const info = viewVisibleInfoMap[elem.uuid];
|
|
3167
|
+
if (!info) {
|
|
3168
|
+
return true;
|
|
3169
|
+
}
|
|
3170
|
+
return info.isVisibleInView;
|
|
2993
3171
|
}
|
|
2994
3172
|
isPointInElement(p, elem, viewScaleInfo, viewSizeInfo) {
|
|
2995
3173
|
const context2d = __classPrivateFieldGet$4(this, _Calculator_opts, "f").viewContext;
|
|
@@ -3004,8 +3182,103 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3004
3182
|
const context2d = __classPrivateFieldGet$4(this, _Calculator_opts, "f").viewContext;
|
|
3005
3183
|
return getViewPointAtElement(p, Object.assign(Object.assign({}, opts), { context2d }));
|
|
3006
3184
|
}
|
|
3185
|
+
resetViewVisibleInfoMap(data, opts) {
|
|
3186
|
+
if (data) {
|
|
3187
|
+
const { viewVisibleInfoMap, invisibleCount, visibleCount } = sortElementsViewVisiableInfoMap(data.elements, opts);
|
|
3188
|
+
__classPrivateFieldGet$4(this, _Calculator_store, "f").set("viewVisibleInfoMap", viewVisibleInfoMap);
|
|
3189
|
+
__classPrivateFieldGet$4(this, _Calculator_store, "f").set("invisibleCount", invisibleCount);
|
|
3190
|
+
__classPrivateFieldGet$4(this, _Calculator_store, "f").set("visibleCount", visibleCount);
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
updateVisiableStatus(opts) {
|
|
3194
|
+
const { viewVisibleInfoMap, invisibleCount, visibleCount } = updateViewVisibleInfoMapStatus(__classPrivateFieldGet$4(this, _Calculator_store, "f").get("viewVisibleInfoMap"), opts);
|
|
3195
|
+
__classPrivateFieldGet$4(this, _Calculator_store, "f").set("viewVisibleInfoMap", viewVisibleInfoMap);
|
|
3196
|
+
__classPrivateFieldGet$4(this, _Calculator_store, "f").set("invisibleCount", invisibleCount);
|
|
3197
|
+
__classPrivateFieldGet$4(this, _Calculator_store, "f").set("visibleCount", visibleCount);
|
|
3198
|
+
}
|
|
3199
|
+
calcViewRectInfoFromOrigin(uuid, opts) {
|
|
3200
|
+
const infoData = __classPrivateFieldGet$4(this, _Calculator_store, "f").get("viewVisibleInfoMap")[uuid];
|
|
3201
|
+
if (!(infoData === null || infoData === void 0 ? void 0 : infoData.originRectInfo)) {
|
|
3202
|
+
return null;
|
|
3203
|
+
}
|
|
3204
|
+
const { checkVisible, viewScaleInfo, viewSizeInfo } = opts;
|
|
3205
|
+
const { center, left, right, bottom, top, topLeft, topRight, bottomLeft, bottomRight } = infoData.originRectInfo;
|
|
3206
|
+
if (checkVisible === true && infoData.isVisibleInView === false) {
|
|
3207
|
+
return null;
|
|
3208
|
+
}
|
|
3209
|
+
const calcOpts = { viewScaleInfo, viewSizeInfo };
|
|
3210
|
+
const viewRectInfo = {
|
|
3211
|
+
center: calcViewPointSize(center, calcOpts),
|
|
3212
|
+
left: calcViewPointSize(left, calcOpts),
|
|
3213
|
+
right: calcViewPointSize(right, calcOpts),
|
|
3214
|
+
bottom: calcViewPointSize(bottom, calcOpts),
|
|
3215
|
+
top: calcViewPointSize(top, calcOpts),
|
|
3216
|
+
topLeft: calcViewPointSize(topLeft, calcOpts),
|
|
3217
|
+
topRight: calcViewPointSize(topRight, calcOpts),
|
|
3218
|
+
bottomLeft: calcViewPointSize(bottomLeft, calcOpts),
|
|
3219
|
+
bottomRight: calcViewPointSize(bottomRight, calcOpts)
|
|
3220
|
+
};
|
|
3221
|
+
return viewRectInfo;
|
|
3222
|
+
}
|
|
3223
|
+
calcViewRectInfoFromRange(uuid, opts) {
|
|
3224
|
+
const infoData = __classPrivateFieldGet$4(this, _Calculator_store, "f").get("viewVisibleInfoMap")[uuid];
|
|
3225
|
+
if (!(infoData === null || infoData === void 0 ? void 0 : infoData.originRectInfo)) {
|
|
3226
|
+
return null;
|
|
3227
|
+
}
|
|
3228
|
+
const { checkVisible, viewScaleInfo, viewSizeInfo } = opts;
|
|
3229
|
+
const { center, left, right, bottom, top, topLeft, topRight, bottomLeft, bottomRight } = infoData.rangeRectInfo;
|
|
3230
|
+
if (checkVisible === true && infoData.isVisibleInView === false) {
|
|
3231
|
+
return null;
|
|
3232
|
+
}
|
|
3233
|
+
const calcOpts = { viewScaleInfo, viewSizeInfo };
|
|
3234
|
+
const viewRectInfo = {
|
|
3235
|
+
center: calcViewPointSize(center, calcOpts),
|
|
3236
|
+
left: calcViewPointSize(left, calcOpts),
|
|
3237
|
+
right: calcViewPointSize(right, calcOpts),
|
|
3238
|
+
bottom: calcViewPointSize(bottom, calcOpts),
|
|
3239
|
+
top: calcViewPointSize(top, calcOpts),
|
|
3240
|
+
topLeft: calcViewPointSize(topLeft, calcOpts),
|
|
3241
|
+
topRight: calcViewPointSize(topRight, calcOpts),
|
|
3242
|
+
bottomLeft: calcViewPointSize(bottomLeft, calcOpts),
|
|
3243
|
+
bottomRight: calcViewPointSize(bottomRight, calcOpts)
|
|
3244
|
+
};
|
|
3245
|
+
return viewRectInfo;
|
|
3246
|
+
}
|
|
3247
|
+
modifyViewVisibleInfoMap(data, opts) {
|
|
3248
|
+
const { modifyOptions, viewScaleInfo, viewSizeInfo } = opts;
|
|
3249
|
+
const { type, content } = modifyOptions;
|
|
3250
|
+
const list = data.elements;
|
|
3251
|
+
const viewVisibleInfoMap = __classPrivateFieldGet$4(this, _Calculator_store, "f").get("viewVisibleInfoMap");
|
|
3252
|
+
if (type === "deleteElement") {
|
|
3253
|
+
const { element } = content;
|
|
3254
|
+
delete viewVisibleInfoMap[element.uuid];
|
|
3255
|
+
} else if (type === "addElement" || type === "updateElement") {
|
|
3256
|
+
const { position } = content;
|
|
3257
|
+
const element = findElementFromListByPosition(position, data.elements);
|
|
3258
|
+
const groupQueue = getGroupQueueByElementPosition(list, position);
|
|
3259
|
+
if (element) {
|
|
3260
|
+
const originRectInfo = calcElementOriginRectInfo(element, {
|
|
3261
|
+
groupQueue: groupQueue || []
|
|
3262
|
+
});
|
|
3263
|
+
const newViewVisibleInfo = {
|
|
3264
|
+
originRectInfo,
|
|
3265
|
+
rangeRectInfo: is.angle(element.angle) ? originRectInfoToRangeRectInfo(originRectInfo) : originRectInfo,
|
|
3266
|
+
isVisibleInView: true,
|
|
3267
|
+
isGroup: (element === null || element === void 0 ? void 0 : element.type) === "group",
|
|
3268
|
+
position: [...position]
|
|
3269
|
+
};
|
|
3270
|
+
viewVisibleInfoMap[element.uuid] = newViewVisibleInfo;
|
|
3271
|
+
if (type === "updateElement") {
|
|
3272
|
+
this.updateVisiableStatus({ viewScaleInfo, viewSizeInfo });
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
} else if (type === "moveElement") {
|
|
3276
|
+
this.resetViewVisibleInfoMap(data, { viewScaleInfo, viewSizeInfo });
|
|
3277
|
+
}
|
|
3278
|
+
__classPrivateFieldGet$4(this, _Calculator_store, "f").set("viewVisibleInfoMap", viewVisibleInfoMap);
|
|
3279
|
+
}
|
|
3007
3280
|
}
|
|
3008
|
-
_Calculator_opts = /* @__PURE__ */ new WeakMap();
|
|
3281
|
+
_Calculator_opts = /* @__PURE__ */ new WeakMap(), _Calculator_store = /* @__PURE__ */ new WeakMap();
|
|
3009
3282
|
var __classPrivateFieldSet$3 = function(receiver, state, value, kind, f) {
|
|
3010
3283
|
if (kind === "m")
|
|
3011
3284
|
throw new TypeError("Private method is not writable");
|
|
@@ -3245,8 +3518,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3245
3518
|
setActiveStorage(key2, storage) {
|
|
3246
3519
|
return __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").set(key2, storage);
|
|
3247
3520
|
}
|
|
3248
|
-
getActiveStoreSnapshot() {
|
|
3249
|
-
return __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").getSnapshot();
|
|
3521
|
+
getActiveStoreSnapshot(opts) {
|
|
3522
|
+
return __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").getSnapshot(opts);
|
|
3250
3523
|
}
|
|
3251
3524
|
getSharedStorage(key2) {
|
|
3252
3525
|
return __classPrivateFieldGet$2(this, _Sharer_sharedStore, "f").get(key2);
|
|
@@ -3254,8 +3527,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3254
3527
|
setSharedStorage(key2, storage) {
|
|
3255
3528
|
return __classPrivateFieldGet$2(this, _Sharer_sharedStore, "f").set(key2, storage);
|
|
3256
3529
|
}
|
|
3257
|
-
getSharedStoreSnapshot() {
|
|
3258
|
-
return __classPrivateFieldGet$2(this, _Sharer_sharedStore, "f").getSnapshot();
|
|
3530
|
+
getSharedStoreSnapshot(opts) {
|
|
3531
|
+
return __classPrivateFieldGet$2(this, _Sharer_sharedStore, "f").getSnapshot(opts);
|
|
3259
3532
|
}
|
|
3260
3533
|
getActiveViewScaleInfo() {
|
|
3261
3534
|
const viewScaleInfo = {
|
|
@@ -3322,6 +3595,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3322
3595
|
__classPrivateFieldSet$1(this, _Viewer_opts, opts, "f");
|
|
3323
3596
|
__classPrivateFieldGet$1(this, _Viewer_instances, "m", _Viewer_init).call(this);
|
|
3324
3597
|
}
|
|
3598
|
+
resetViewVisibleInfoMap(data, opts) {
|
|
3599
|
+
if (data) {
|
|
3600
|
+
__classPrivateFieldGet$1(this, _Viewer_opts, "f").calculator.resetViewVisibleInfoMap(data, opts);
|
|
3601
|
+
}
|
|
3602
|
+
}
|
|
3325
3603
|
drawFrame() {
|
|
3326
3604
|
const { sharer } = __classPrivateFieldGet$1(this, _Viewer_opts, "f");
|
|
3327
3605
|
const activeStore = sharer.getActiveStoreSnapshot();
|
|
@@ -3333,7 +3611,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3333
3611
|
__classPrivateFieldGet$1(this, _Viewer_instances, "m", _Viewer_drawAnimationFrame).call(this);
|
|
3334
3612
|
}
|
|
3335
3613
|
scale(opts) {
|
|
3336
|
-
const { scale, point } = opts;
|
|
3614
|
+
const { scale, point, ignoreUpdateVisibleStatus } = opts;
|
|
3337
3615
|
const { sharer } = __classPrivateFieldGet$1(this, _Viewer_opts, "f");
|
|
3338
3616
|
const { moveX, moveY } = viewScale({
|
|
3339
3617
|
scale,
|
|
@@ -3342,12 +3620,18 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3342
3620
|
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
3343
3621
|
});
|
|
3344
3622
|
sharer.setActiveStorage("scale", scale);
|
|
3623
|
+
if (!ignoreUpdateVisibleStatus) {
|
|
3624
|
+
__classPrivateFieldGet$1(this, _Viewer_opts, "f").calculator.updateVisiableStatus({
|
|
3625
|
+
viewScaleInfo: sharer.getActiveViewScaleInfo(),
|
|
3626
|
+
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
3627
|
+
});
|
|
3628
|
+
}
|
|
3345
3629
|
return { moveX, moveY };
|
|
3346
3630
|
}
|
|
3347
3631
|
scroll(opts) {
|
|
3348
3632
|
const { sharer } = __classPrivateFieldGet$1(this, _Viewer_opts, "f");
|
|
3349
3633
|
const prevViewScaleInfo = sharer.getActiveViewScaleInfo();
|
|
3350
|
-
const { moveX, moveY } = opts;
|
|
3634
|
+
const { moveX, moveY, ignoreUpdateVisibleStatus } = opts;
|
|
3351
3635
|
const viewSizeInfo = sharer.getActiveViewSizeInfo();
|
|
3352
3636
|
const viewScaleInfo = viewScroll({
|
|
3353
3637
|
moveX,
|
|
@@ -3356,6 +3640,12 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3356
3640
|
viewSizeInfo
|
|
3357
3641
|
});
|
|
3358
3642
|
sharer.setActiveViewScaleInfo(viewScaleInfo);
|
|
3643
|
+
if (!ignoreUpdateVisibleStatus) {
|
|
3644
|
+
__classPrivateFieldGet$1(this, _Viewer_opts, "f").calculator.updateVisiableStatus({
|
|
3645
|
+
viewScaleInfo: sharer.getActiveViewScaleInfo(),
|
|
3646
|
+
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
3647
|
+
});
|
|
3648
|
+
}
|
|
3359
3649
|
return viewScaleInfo;
|
|
3360
3650
|
}
|
|
3361
3651
|
updateViewScaleInfo(opts) {
|
|
@@ -3364,9 +3654,13 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3364
3654
|
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
3365
3655
|
});
|
|
3366
3656
|
sharer.setActiveViewScaleInfo(viewScaleInfo);
|
|
3657
|
+
__classPrivateFieldGet$1(this, _Viewer_opts, "f").calculator.updateVisiableStatus({
|
|
3658
|
+
viewScaleInfo: sharer.getActiveViewScaleInfo(),
|
|
3659
|
+
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
3660
|
+
});
|
|
3367
3661
|
return viewScaleInfo;
|
|
3368
3662
|
}
|
|
3369
|
-
resize(viewSize = {}) {
|
|
3663
|
+
resize(viewSize = {}, opts) {
|
|
3370
3664
|
const { sharer } = __classPrivateFieldGet$1(this, _Viewer_opts, "f");
|
|
3371
3665
|
const originViewSize = sharer.getActiveViewSizeInfo();
|
|
3372
3666
|
const newViewSize = Object.assign(Object.assign({}, originViewSize), viewSize);
|
|
@@ -3383,6 +3677,12 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3383
3677
|
viewContext.canvas.width = width * devicePixelRatio;
|
|
3384
3678
|
viewContext.canvas.height = height * devicePixelRatio;
|
|
3385
3679
|
sharer.setActiveViewSizeInfo(newViewSize);
|
|
3680
|
+
if (!(opts === null || opts === void 0 ? void 0 : opts.ignoreUpdateVisibleStatus)) {
|
|
3681
|
+
__classPrivateFieldGet$1(this, _Viewer_opts, "f").calculator.updateVisiableStatus({
|
|
3682
|
+
viewScaleInfo: sharer.getActiveViewScaleInfo(),
|
|
3683
|
+
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
3684
|
+
});
|
|
3685
|
+
}
|
|
3386
3686
|
return newViewSize;
|
|
3387
3687
|
}
|
|
3388
3688
|
}
|
|
@@ -3517,15 +3817,28 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3517
3817
|
getRenderer() {
|
|
3518
3818
|
return __classPrivateFieldGet(this, _Board_renderer, "f");
|
|
3519
3819
|
}
|
|
3520
|
-
setData(data) {
|
|
3820
|
+
setData(data, opts) {
|
|
3821
|
+
const { modifiedOptions } = opts || {};
|
|
3521
3822
|
const sharer = __classPrivateFieldGet(this, _Board_sharer, "f");
|
|
3522
3823
|
__classPrivateFieldGet(this, _Board_sharer, "f").setActiveStorage("data", data);
|
|
3523
3824
|
const viewSizeInfo = sharer.getActiveViewSizeInfo();
|
|
3825
|
+
const viewScaleInfo = sharer.getActiveViewScaleInfo();
|
|
3524
3826
|
const newViewContextSize = calcElementsContextSize(data.elements, {
|
|
3525
3827
|
viewWidth: viewSizeInfo.width,
|
|
3526
3828
|
viewHeight: viewSizeInfo.height,
|
|
3527
3829
|
extend: true
|
|
3528
3830
|
});
|
|
3831
|
+
if (modifiedOptions) {
|
|
3832
|
+
__classPrivateFieldGet(this, _Board_viewer, "f").resetViewVisibleInfoMap(data, {
|
|
3833
|
+
viewSizeInfo,
|
|
3834
|
+
viewScaleInfo
|
|
3835
|
+
});
|
|
3836
|
+
} else {
|
|
3837
|
+
__classPrivateFieldGet(this, _Board_viewer, "f").resetViewVisibleInfoMap(data, {
|
|
3838
|
+
viewSizeInfo,
|
|
3839
|
+
viewScaleInfo
|
|
3840
|
+
});
|
|
3841
|
+
}
|
|
3529
3842
|
__classPrivateFieldGet(this, _Board_viewer, "f").drawFrame();
|
|
3530
3843
|
const newViewSizeInfo = Object.assign(Object.assign({}, viewSizeInfo), newViewContextSize);
|
|
3531
3844
|
__classPrivateFieldGet(this, _Board_sharer, "f").setActiveViewSizeInfo(newViewSizeInfo);
|
|
@@ -3574,17 +3887,22 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3574
3887
|
}
|
|
3575
3888
|
scale(opts) {
|
|
3576
3889
|
const viewer = __classPrivateFieldGet(this, _Board_viewer, "f");
|
|
3577
|
-
const {
|
|
3578
|
-
|
|
3890
|
+
const { ignoreUpdateVisibleStatus } = opts;
|
|
3891
|
+
const { moveX, moveY } = viewer.scale(Object.assign(Object.assign({}, opts), {
|
|
3892
|
+
ignoreUpdateVisibleStatus: true
|
|
3893
|
+
}));
|
|
3894
|
+
viewer.scroll({ moveX, moveY, ignoreUpdateVisibleStatus });
|
|
3579
3895
|
}
|
|
3580
3896
|
scroll(opts) {
|
|
3581
|
-
|
|
3897
|
+
const result = __classPrivateFieldGet(this, _Board_viewer, "f").scroll(opts);
|
|
3898
|
+
return result;
|
|
3582
3899
|
}
|
|
3583
3900
|
updateViewScaleInfo(opts) {
|
|
3584
|
-
|
|
3901
|
+
const result = __classPrivateFieldGet(this, _Board_viewer, "f").updateViewScaleInfo(opts);
|
|
3902
|
+
return result;
|
|
3585
3903
|
}
|
|
3586
|
-
resize(newViewSize) {
|
|
3587
|
-
const viewSize = __classPrivateFieldGet(this, _Board_viewer, "f").resize(newViewSize);
|
|
3904
|
+
resize(newViewSize, opts) {
|
|
3905
|
+
const viewSize = __classPrivateFieldGet(this, _Board_viewer, "f").resize(newViewSize, opts);
|
|
3588
3906
|
const { width, height, devicePixelRatio } = newViewSize;
|
|
3589
3907
|
const { boardContent } = __classPrivateFieldGet(this, _Board_opts, "f");
|
|
3590
3908
|
boardContent.viewContext.$resize({ width, height, devicePixelRatio });
|
|
@@ -3912,6 +4230,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3912
4230
|
const keySelectedElementList = Symbol(`${key$2}_selectedElementList`);
|
|
3913
4231
|
const keySelectedElementListVertexes = Symbol(`${key$2}_selectedElementListVertexes`);
|
|
3914
4232
|
const keySelectedElementController = Symbol(`${key$2}_selectedElementController`);
|
|
4233
|
+
const keySelectedElementPosition = Symbol(`${key$2}_selectedElementPosition`);
|
|
4234
|
+
const keySelectedReferenceXLines = Symbol(`${key$2}_selectedReferenceXLines`);
|
|
4235
|
+
const keySelectedReferenceYLines = Symbol(`${key$2}_selectedReferenceYLines`);
|
|
3915
4236
|
const keyGroupQueue = Symbol(`${key$2}_groupQueue`);
|
|
3916
4237
|
const keyGroupQueueVertexesList = Symbol(`${key$2}_groupQueueVertexesList`);
|
|
3917
4238
|
const keyIsMoving = Symbol(`${key$2}_isMoving`);
|
|
@@ -3921,6 +4242,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3921
4242
|
const wrapperColor = "#1973ba";
|
|
3922
4243
|
const lockColor = "#5b5959b5";
|
|
3923
4244
|
const controllerSize = 10;
|
|
4245
|
+
const referenceColor = "#f7276e";
|
|
3924
4246
|
function drawVertexes(ctx, vertexes, opts) {
|
|
3925
4247
|
const { borderColor: borderColor2, borderWidth: borderWidth2, background: background2, lineDash } = opts;
|
|
3926
4248
|
ctx.setLineDash([]);
|
|
@@ -3991,6 +4313,36 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3991
4313
|
ctx.closePath();
|
|
3992
4314
|
ctx.stroke();
|
|
3993
4315
|
}
|
|
4316
|
+
function drawCrossByCenter(ctx, center, opts) {
|
|
4317
|
+
const { size, borderColor: borderColor2, borderWidth: borderWidth2, lineDash } = opts;
|
|
4318
|
+
const minX = center.x - size / 2;
|
|
4319
|
+
const maxX = center.x + size / 2;
|
|
4320
|
+
const minY = center.y - size / 2;
|
|
4321
|
+
const maxY = center.y + size / 2;
|
|
4322
|
+
const vertexes = [
|
|
4323
|
+
{
|
|
4324
|
+
x: minX,
|
|
4325
|
+
y: minY
|
|
4326
|
+
},
|
|
4327
|
+
{
|
|
4328
|
+
x: maxX,
|
|
4329
|
+
y: minY
|
|
4330
|
+
},
|
|
4331
|
+
{
|
|
4332
|
+
x: maxX,
|
|
4333
|
+
y: maxY
|
|
4334
|
+
},
|
|
4335
|
+
{
|
|
4336
|
+
x: minX,
|
|
4337
|
+
y: maxY
|
|
4338
|
+
}
|
|
4339
|
+
];
|
|
4340
|
+
drawCrossVertexes(ctx, vertexes, {
|
|
4341
|
+
borderColor: borderColor2,
|
|
4342
|
+
borderWidth: borderWidth2,
|
|
4343
|
+
lineDash
|
|
4344
|
+
});
|
|
4345
|
+
}
|
|
3994
4346
|
function drawHoverVertexesWrapper(ctx, vertexes, opts) {
|
|
3995
4347
|
if (!vertexes) {
|
|
3996
4348
|
return;
|
|
@@ -4022,7 +4374,10 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4022
4374
|
if (!controller) {
|
|
4023
4375
|
return;
|
|
4024
4376
|
}
|
|
4025
|
-
const {
|
|
4377
|
+
const {
|
|
4378
|
+
hideControllers
|
|
4379
|
+
// calculator, element, viewScaleInfo, viewSizeInfo
|
|
4380
|
+
} = opts;
|
|
4026
4381
|
const { elementWrapper, topLeft, topRight, bottomLeft, bottomRight, top, rotate } = controller;
|
|
4027
4382
|
const wrapperOpts = { borderColor: wrapperColor, borderWidth: selectWrapperBorderWidth, background: "transparent", lineDash: [] };
|
|
4028
4383
|
const ctrlOpts = { ...wrapperOpts, borderWidth: resizeControllerBorderWidth, background: "#FFFFFF" };
|
|
@@ -4074,6 +4429,35 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4074
4429
|
drawVertexes(ctx, calcViewVertexes(vertexes, opts), wrapperOpts);
|
|
4075
4430
|
}
|
|
4076
4431
|
}
|
|
4432
|
+
function drawReferenceLines(ctx, opts) {
|
|
4433
|
+
const { xLines, yLines } = opts;
|
|
4434
|
+
const lineOpts = {
|
|
4435
|
+
borderColor: referenceColor,
|
|
4436
|
+
borderWidth: 1,
|
|
4437
|
+
lineDash: []
|
|
4438
|
+
};
|
|
4439
|
+
const crossOpts = { ...lineOpts, size: 6 };
|
|
4440
|
+
if (xLines) {
|
|
4441
|
+
xLines.forEach((line) => {
|
|
4442
|
+
line.forEach((p, pIdx) => {
|
|
4443
|
+
drawCrossByCenter(ctx, p, crossOpts);
|
|
4444
|
+
if (line[pIdx + 1]) {
|
|
4445
|
+
drawLine(ctx, line[pIdx], line[pIdx + 1], lineOpts);
|
|
4446
|
+
}
|
|
4447
|
+
});
|
|
4448
|
+
});
|
|
4449
|
+
}
|
|
4450
|
+
if (yLines) {
|
|
4451
|
+
yLines.forEach((line) => {
|
|
4452
|
+
line.forEach((p, pIdx) => {
|
|
4453
|
+
drawCrossByCenter(ctx, p, crossOpts);
|
|
4454
|
+
if (line[pIdx + 1]) {
|
|
4455
|
+
drawLine(ctx, line[pIdx], line[pIdx + 1], lineOpts);
|
|
4456
|
+
}
|
|
4457
|
+
});
|
|
4458
|
+
});
|
|
4459
|
+
}
|
|
4460
|
+
}
|
|
4077
4461
|
function parseRadian(angle2) {
|
|
4078
4462
|
return angle2 * Math.PI / 180;
|
|
4079
4463
|
}
|
|
@@ -4084,11 +4468,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4084
4468
|
return moveDirect > 0 ? Math.abs(moveDist) : 0 - Math.abs(moveDist);
|
|
4085
4469
|
}
|
|
4086
4470
|
function isPointInViewActiveVertexes(p, opts) {
|
|
4087
|
-
const { ctx, viewScaleInfo,
|
|
4088
|
-
const v0 = calcViewPointSize(vertexes[0], { viewScaleInfo
|
|
4089
|
-
const v1 = calcViewPointSize(vertexes[1], { viewScaleInfo
|
|
4090
|
-
const v2 = calcViewPointSize(vertexes[2], { viewScaleInfo
|
|
4091
|
-
const v3 = calcViewPointSize(vertexes[3], { viewScaleInfo
|
|
4471
|
+
const { ctx, viewScaleInfo, vertexes } = opts;
|
|
4472
|
+
const v0 = calcViewPointSize(vertexes[0], { viewScaleInfo });
|
|
4473
|
+
const v1 = calcViewPointSize(vertexes[1], { viewScaleInfo });
|
|
4474
|
+
const v2 = calcViewPointSize(vertexes[2], { viewScaleInfo });
|
|
4475
|
+
const v3 = calcViewPointSize(vertexes[3], { viewScaleInfo });
|
|
4092
4476
|
ctx.beginPath();
|
|
4093
4477
|
ctx.moveTo(v0.x, v0.y);
|
|
4094
4478
|
ctx.lineTo(v1.x, v1.y);
|
|
@@ -4707,10 +5091,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4707
5091
|
}
|
|
4708
5092
|
function rotateElement(elem, opts) {
|
|
4709
5093
|
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 = 0 } = elem;
|
|
4710
|
-
const { center, start, end, viewScaleInfo
|
|
5094
|
+
const { center, start, end, viewScaleInfo } = opts;
|
|
4711
5095
|
const elemCenter = calcViewPointSize(center, {
|
|
4712
|
-
viewScaleInfo
|
|
4713
|
-
viewSizeInfo
|
|
5096
|
+
viewScaleInfo
|
|
4714
5097
|
});
|
|
4715
5098
|
const startAngle = limitAngle(angle2);
|
|
4716
5099
|
const changedRadian = calcRadian(elemCenter, start, end);
|
|
@@ -4728,7 +5111,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4728
5111
|
const indexes = [];
|
|
4729
5112
|
const uuids = [];
|
|
4730
5113
|
const elements = [];
|
|
4731
|
-
const {
|
|
5114
|
+
const { viewScaleInfo, viewSizeInfo, start, end } = opts;
|
|
4732
5115
|
if (!(Array.isArray(data.elements) && start && end)) {
|
|
4733
5116
|
return { indexes, uuids, elements };
|
|
4734
5117
|
}
|
|
@@ -4741,7 +5124,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4741
5124
|
if (((_a = elem == null ? void 0 : elem.operations) == null ? void 0 : _a.lock) === true) {
|
|
4742
5125
|
continue;
|
|
4743
5126
|
}
|
|
4744
|
-
const elemSize =
|
|
5127
|
+
const elemSize = calcViewElementSize(elem, { viewScaleInfo, viewSizeInfo });
|
|
4745
5128
|
const center = calcElementCenter(elemSize);
|
|
4746
5129
|
if (center.x >= startX && center.x <= endX && center.y >= startY && center.y <= endY) {
|
|
4747
5130
|
indexes.push(idx);
|
|
@@ -4768,14 +5151,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4768
5151
|
return null;
|
|
4769
5152
|
}
|
|
4770
5153
|
const area = { x: 0, y: 0, w: 0, h: 0 };
|
|
4771
|
-
const {
|
|
5154
|
+
const { viewScaleInfo, viewSizeInfo } = opts;
|
|
4772
5155
|
let prevElemSize = null;
|
|
4773
5156
|
for (let i = 0; i < elements.length; i++) {
|
|
4774
5157
|
const elem = elements[i];
|
|
4775
5158
|
if ((_a = elem == null ? void 0 : elem.operations) == null ? void 0 : _a.invisible) {
|
|
4776
5159
|
continue;
|
|
4777
5160
|
}
|
|
4778
|
-
const elemSize =
|
|
5161
|
+
const elemSize = calcViewElementSize(elem, { viewScaleInfo, viewSizeInfo });
|
|
4779
5162
|
if (elemSize.angle && (elemSize.angle > 0 || elemSize.angle < 0)) {
|
|
4780
5163
|
const ves = rotateElementVertexes(elemSize);
|
|
4781
5164
|
if (ves.length === 4) {
|
|
@@ -4843,6 +5226,264 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4843
5226
|
moveY
|
|
4844
5227
|
};
|
|
4845
5228
|
}
|
|
5229
|
+
const unitSize = 2;
|
|
5230
|
+
function getViewBoxInfo(rectInfo) {
|
|
5231
|
+
const boxInfo = {
|
|
5232
|
+
minX: rectInfo.topLeft.x,
|
|
5233
|
+
minY: rectInfo.topLeft.y,
|
|
5234
|
+
maxX: rectInfo.bottomRight.x,
|
|
5235
|
+
maxY: rectInfo.bottomRight.y,
|
|
5236
|
+
midX: rectInfo.center.x,
|
|
5237
|
+
midY: rectInfo.center.y
|
|
5238
|
+
};
|
|
5239
|
+
return boxInfo;
|
|
5240
|
+
}
|
|
5241
|
+
const getClosestNumInSortedKeys = (sortedKeys, target) => {
|
|
5242
|
+
if (sortedKeys.length === 0) {
|
|
5243
|
+
throw null;
|
|
5244
|
+
}
|
|
5245
|
+
if (sortedKeys.length === 1) {
|
|
5246
|
+
return sortedKeys[0];
|
|
5247
|
+
}
|
|
5248
|
+
let left = 0;
|
|
5249
|
+
let right = sortedKeys.length - 1;
|
|
5250
|
+
while (left <= right) {
|
|
5251
|
+
const mid = Math.floor((left + right) / 2);
|
|
5252
|
+
if (sortedKeys[mid] === target) {
|
|
5253
|
+
return sortedKeys[mid];
|
|
5254
|
+
} else if (sortedKeys[mid] < target) {
|
|
5255
|
+
left = mid + 1;
|
|
5256
|
+
} else {
|
|
5257
|
+
right = mid - 1;
|
|
5258
|
+
}
|
|
5259
|
+
}
|
|
5260
|
+
if (left >= sortedKeys.length) {
|
|
5261
|
+
return sortedKeys[right];
|
|
5262
|
+
}
|
|
5263
|
+
if (right < 0) {
|
|
5264
|
+
return sortedKeys[left];
|
|
5265
|
+
}
|
|
5266
|
+
return Math.abs(sortedKeys[right] - target) <= Math.abs(sortedKeys[left] - target) ? sortedKeys[right] : sortedKeys[left];
|
|
5267
|
+
};
|
|
5268
|
+
const isEqualNum = (a, b) => Math.abs(a - b) < 1e-5;
|
|
5269
|
+
function calcReferenceInfo(uuid, opts) {
|
|
5270
|
+
var _a, _b;
|
|
5271
|
+
const { data, groupQueue, calculator, viewScaleInfo, viewSizeInfo } = opts;
|
|
5272
|
+
let targetElements = data.elements || [];
|
|
5273
|
+
if ((groupQueue == null ? void 0 : groupQueue.length) > 0) {
|
|
5274
|
+
targetElements = ((_b = (_a = groupQueue[groupQueue.length - 1]) == null ? void 0 : _a.detail) == null ? void 0 : _b.children) || [];
|
|
5275
|
+
}
|
|
5276
|
+
const siblingViewRectInfoList = [];
|
|
5277
|
+
targetElements.forEach((elem) => {
|
|
5278
|
+
if (elem.uuid !== uuid) {
|
|
5279
|
+
const info = calculator.calcViewRectInfoFromRange(elem.uuid, { checkVisible: true, viewScaleInfo, viewSizeInfo });
|
|
5280
|
+
if (info) {
|
|
5281
|
+
siblingViewRectInfoList.push(info);
|
|
5282
|
+
}
|
|
5283
|
+
}
|
|
5284
|
+
});
|
|
5285
|
+
const targetRectInfo = calculator.calcViewRectInfoFromRange(uuid, { viewScaleInfo, viewSizeInfo });
|
|
5286
|
+
if (!targetRectInfo) {
|
|
5287
|
+
return null;
|
|
5288
|
+
}
|
|
5289
|
+
const vRefLineDotMap = {};
|
|
5290
|
+
const hRefLineDotMap = {};
|
|
5291
|
+
const vHelperLineDotMapList = [];
|
|
5292
|
+
const hHelperLineDotMapList = [];
|
|
5293
|
+
let sortedRefXKeys = [];
|
|
5294
|
+
let sortedRefYKeys = [];
|
|
5295
|
+
const targetBox = getViewBoxInfo(targetRectInfo);
|
|
5296
|
+
siblingViewRectInfoList.forEach((info) => {
|
|
5297
|
+
const box = getViewBoxInfo(info);
|
|
5298
|
+
if (!vRefLineDotMap[box.minX]) {
|
|
5299
|
+
vRefLineDotMap[box.minX] = [];
|
|
5300
|
+
}
|
|
5301
|
+
if (!vRefLineDotMap[box.midX]) {
|
|
5302
|
+
vRefLineDotMap[box.midX] = [];
|
|
5303
|
+
}
|
|
5304
|
+
if (!vRefLineDotMap[box.maxX]) {
|
|
5305
|
+
vRefLineDotMap[box.maxX] = [];
|
|
5306
|
+
}
|
|
5307
|
+
if (!hRefLineDotMap[box.minY]) {
|
|
5308
|
+
hRefLineDotMap[box.minY] = [];
|
|
5309
|
+
}
|
|
5310
|
+
if (!hRefLineDotMap[box.midY]) {
|
|
5311
|
+
hRefLineDotMap[box.midY] = [];
|
|
5312
|
+
}
|
|
5313
|
+
if (!hRefLineDotMap[box.maxY]) {
|
|
5314
|
+
hRefLineDotMap[box.maxY] = [];
|
|
5315
|
+
}
|
|
5316
|
+
vRefLineDotMap[box.minX] = [box.minY, box.midY, box.maxY];
|
|
5317
|
+
vRefLineDotMap[box.midX] = [box.minY, box.midY, box.maxY];
|
|
5318
|
+
vRefLineDotMap[box.maxX] = [box.minY, box.midY, box.maxY];
|
|
5319
|
+
sortedRefXKeys.push(box.minX);
|
|
5320
|
+
sortedRefXKeys.push(box.midX);
|
|
5321
|
+
sortedRefXKeys.push(box.maxX);
|
|
5322
|
+
hRefLineDotMap[box.minY] = [box.minX, box.midX, box.maxX];
|
|
5323
|
+
hRefLineDotMap[box.midY] = [box.minX, box.midX, box.maxX];
|
|
5324
|
+
hRefLineDotMap[box.maxY] = [box.minX, box.midX, box.maxX];
|
|
5325
|
+
sortedRefYKeys.push(box.minY);
|
|
5326
|
+
sortedRefYKeys.push(box.midY);
|
|
5327
|
+
sortedRefYKeys.push(box.maxY);
|
|
5328
|
+
});
|
|
5329
|
+
sortedRefXKeys = sortedRefXKeys.sort((a, b) => a - b);
|
|
5330
|
+
sortedRefYKeys = sortedRefYKeys.sort((a, b) => a - b);
|
|
5331
|
+
let offsetX = null;
|
|
5332
|
+
let offsetY = null;
|
|
5333
|
+
let closestMinX = null;
|
|
5334
|
+
let closestMidX = null;
|
|
5335
|
+
let closestMaxX = null;
|
|
5336
|
+
let closestMinY = null;
|
|
5337
|
+
let closestMidY = null;
|
|
5338
|
+
let closestMaxY = null;
|
|
5339
|
+
if (sortedRefXKeys.length > 0) {
|
|
5340
|
+
closestMinX = getClosestNumInSortedKeys(sortedRefXKeys, targetBox.minX);
|
|
5341
|
+
closestMidX = getClosestNumInSortedKeys(sortedRefXKeys, targetBox.midX);
|
|
5342
|
+
closestMaxX = getClosestNumInSortedKeys(sortedRefXKeys, targetBox.maxX);
|
|
5343
|
+
const distMinX = Math.abs(closestMinX - targetBox.minX);
|
|
5344
|
+
const distMidX = Math.abs(closestMidX - targetBox.midX);
|
|
5345
|
+
const distMaxX = Math.abs(closestMaxX - targetBox.maxX);
|
|
5346
|
+
const closestXDist = Math.min(distMinX, distMidX, distMaxX);
|
|
5347
|
+
if (closestXDist <= unitSize / viewScaleInfo.scale) {
|
|
5348
|
+
if (isEqualNum(closestXDist, distMinX)) {
|
|
5349
|
+
offsetX = closestMinX - targetBox.minX;
|
|
5350
|
+
} else if (isEqualNum(closestXDist, distMidX)) {
|
|
5351
|
+
offsetX = closestMidX - targetBox.midX;
|
|
5352
|
+
} else if (isEqualNum(closestXDist, distMaxX)) {
|
|
5353
|
+
offsetX = closestMaxX - targetBox.maxX;
|
|
5354
|
+
}
|
|
5355
|
+
}
|
|
5356
|
+
}
|
|
5357
|
+
if (sortedRefYKeys.length > 0) {
|
|
5358
|
+
closestMinY = getClosestNumInSortedKeys(sortedRefYKeys, targetBox.minY);
|
|
5359
|
+
closestMidY = getClosestNumInSortedKeys(sortedRefYKeys, targetBox.midY);
|
|
5360
|
+
closestMaxY = getClosestNumInSortedKeys(sortedRefYKeys, targetBox.maxY);
|
|
5361
|
+
const distMinY = Math.abs(closestMinY - targetBox.minY);
|
|
5362
|
+
const distMidY = Math.abs(closestMidY - targetBox.midY);
|
|
5363
|
+
const distMaxY = Math.abs(closestMaxY - targetBox.maxY);
|
|
5364
|
+
const closestYDist = Math.min(distMinY, distMidY, distMaxY);
|
|
5365
|
+
if (closestYDist <= unitSize / viewScaleInfo.scale) {
|
|
5366
|
+
if (isEqualNum(closestYDist, distMinY)) {
|
|
5367
|
+
offsetY = closestMinY - targetBox.minY;
|
|
5368
|
+
} else if (isEqualNum(closestYDist, distMidY)) {
|
|
5369
|
+
offsetY = closestMidY - targetBox.midY;
|
|
5370
|
+
} else if (isEqualNum(closestYDist, distMaxY)) {
|
|
5371
|
+
offsetY = closestMaxY - targetBox.maxY;
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
}
|
|
5375
|
+
const newTargetBox = { ...targetBox };
|
|
5376
|
+
if (offsetX !== null) {
|
|
5377
|
+
newTargetBox.minX += offsetX;
|
|
5378
|
+
newTargetBox.midX += offsetX;
|
|
5379
|
+
newTargetBox.maxX += offsetX;
|
|
5380
|
+
}
|
|
5381
|
+
if (offsetY !== null) {
|
|
5382
|
+
newTargetBox.minY += offsetY;
|
|
5383
|
+
newTargetBox.midY += offsetY;
|
|
5384
|
+
newTargetBox.maxY += offsetY;
|
|
5385
|
+
}
|
|
5386
|
+
if (is.x(offsetX) && offsetX !== null && closestMinX !== null && closestMidX !== null && closestMaxX !== null) {
|
|
5387
|
+
if (isEqualNum(offsetX, closestMinX - targetBox.minX)) {
|
|
5388
|
+
const vLine = {
|
|
5389
|
+
x: closestMinX,
|
|
5390
|
+
yList: []
|
|
5391
|
+
};
|
|
5392
|
+
vLine.yList.push(newTargetBox.minY);
|
|
5393
|
+
vLine.yList.push(newTargetBox.midY);
|
|
5394
|
+
vLine.yList.push(newTargetBox.maxY);
|
|
5395
|
+
vLine.yList.push(...(hRefLineDotMap == null ? void 0 : hRefLineDotMap[closestMinX]) || []);
|
|
5396
|
+
vHelperLineDotMapList.push(vLine);
|
|
5397
|
+
}
|
|
5398
|
+
if (isEqualNum(offsetX, closestMidX - targetBox.minX)) {
|
|
5399
|
+
const vLine = {
|
|
5400
|
+
x: closestMidX,
|
|
5401
|
+
yList: []
|
|
5402
|
+
};
|
|
5403
|
+
vLine.yList.push(newTargetBox.minY);
|
|
5404
|
+
vLine.yList.push(newTargetBox.midY);
|
|
5405
|
+
vLine.yList.push(newTargetBox.maxY);
|
|
5406
|
+
vLine.yList.push(...(hRefLineDotMap == null ? void 0 : hRefLineDotMap[closestMidX]) || []);
|
|
5407
|
+
vHelperLineDotMapList.push(vLine);
|
|
5408
|
+
}
|
|
5409
|
+
if (isEqualNum(offsetX, closestMaxX - targetBox.minX)) {
|
|
5410
|
+
const vLine = {
|
|
5411
|
+
x: closestMaxX,
|
|
5412
|
+
yList: []
|
|
5413
|
+
};
|
|
5414
|
+
vLine.yList.push(newTargetBox.minY);
|
|
5415
|
+
vLine.yList.push(newTargetBox.midY);
|
|
5416
|
+
vLine.yList.push(newTargetBox.maxY);
|
|
5417
|
+
vLine.yList.push(...(hRefLineDotMap == null ? void 0 : hRefLineDotMap[closestMaxX]) || []);
|
|
5418
|
+
vHelperLineDotMapList.push(vLine);
|
|
5419
|
+
}
|
|
5420
|
+
}
|
|
5421
|
+
if (is.y(offsetY) && offsetY !== null && closestMinY !== null && closestMidY !== null && closestMaxY !== null) {
|
|
5422
|
+
if (isEqualNum(offsetY, closestMinY - targetBox.minY)) {
|
|
5423
|
+
const hLine = {
|
|
5424
|
+
y: closestMinY,
|
|
5425
|
+
xList: []
|
|
5426
|
+
};
|
|
5427
|
+
hLine.xList.push(newTargetBox.minX);
|
|
5428
|
+
hLine.xList.push(newTargetBox.midX);
|
|
5429
|
+
hLine.xList.push(newTargetBox.maxX);
|
|
5430
|
+
hLine.xList.push(...(vRefLineDotMap == null ? void 0 : vRefLineDotMap[closestMinY]) || []);
|
|
5431
|
+
hHelperLineDotMapList.push(hLine);
|
|
5432
|
+
}
|
|
5433
|
+
if (isEqualNum(offsetY, closestMidY - targetBox.midY)) {
|
|
5434
|
+
const hLine = {
|
|
5435
|
+
y: closestMidY,
|
|
5436
|
+
xList: []
|
|
5437
|
+
};
|
|
5438
|
+
hLine.xList.push(newTargetBox.minX);
|
|
5439
|
+
hLine.xList.push(newTargetBox.midX);
|
|
5440
|
+
hLine.xList.push(newTargetBox.maxX);
|
|
5441
|
+
hLine.xList.push(...(vRefLineDotMap == null ? void 0 : vRefLineDotMap[closestMinY]) || []);
|
|
5442
|
+
hHelperLineDotMapList.push(hLine);
|
|
5443
|
+
}
|
|
5444
|
+
if (isEqualNum(offsetY, closestMaxY - targetBox.maxY)) {
|
|
5445
|
+
const hLine = {
|
|
5446
|
+
y: closestMaxY,
|
|
5447
|
+
xList: []
|
|
5448
|
+
};
|
|
5449
|
+
hLine.xList.push(newTargetBox.minX);
|
|
5450
|
+
hLine.xList.push(newTargetBox.midX);
|
|
5451
|
+
hLine.xList.push(newTargetBox.maxX);
|
|
5452
|
+
hLine.xList.push(...(vRefLineDotMap == null ? void 0 : vRefLineDotMap[closestMaxY]) || []);
|
|
5453
|
+
hHelperLineDotMapList.push(hLine);
|
|
5454
|
+
}
|
|
5455
|
+
}
|
|
5456
|
+
const yLines = [];
|
|
5457
|
+
if ((vHelperLineDotMapList == null ? void 0 : vHelperLineDotMapList.length) > 0) {
|
|
5458
|
+
vHelperLineDotMapList.forEach((item, i) => {
|
|
5459
|
+
yLines.push([]);
|
|
5460
|
+
item.yList.forEach((y2) => {
|
|
5461
|
+
yLines[i].push({
|
|
5462
|
+
x: item.x,
|
|
5463
|
+
y: y2
|
|
5464
|
+
});
|
|
5465
|
+
});
|
|
5466
|
+
});
|
|
5467
|
+
}
|
|
5468
|
+
const xLines = [];
|
|
5469
|
+
if ((hHelperLineDotMapList == null ? void 0 : hHelperLineDotMapList.length) > 0) {
|
|
5470
|
+
hHelperLineDotMapList.forEach((item, i) => {
|
|
5471
|
+
xLines.push([]);
|
|
5472
|
+
item.xList.forEach((x2) => {
|
|
5473
|
+
xLines[i].push({
|
|
5474
|
+
x: x2,
|
|
5475
|
+
y: item.y
|
|
5476
|
+
});
|
|
5477
|
+
});
|
|
5478
|
+
});
|
|
5479
|
+
}
|
|
5480
|
+
return {
|
|
5481
|
+
offsetX,
|
|
5482
|
+
offsetY,
|
|
5483
|
+
yLines,
|
|
5484
|
+
xLines
|
|
5485
|
+
};
|
|
5486
|
+
}
|
|
4846
5487
|
const middlewareEventTextEdit = "@middleware/text-edit";
|
|
4847
5488
|
const middlewareEventTextChange = "@middleware/text-change";
|
|
4848
5489
|
const defaultElementDetail = getDefaultElementDetailConfig();
|
|
@@ -5089,6 +5730,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5089
5730
|
sharer.setSharedStorage(keyHoverElementVertexes, vertexes);
|
|
5090
5731
|
};
|
|
5091
5732
|
const updateSelectedElementList = (list, opts2) => {
|
|
5733
|
+
var _a;
|
|
5092
5734
|
sharer.setSharedStorage(keySelectedElementList, list);
|
|
5093
5735
|
if (list.length === 1) {
|
|
5094
5736
|
const controller = calcElementSizeController(list[0], {
|
|
@@ -5097,8 +5739,10 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5097
5739
|
viewScaleInfo: sharer.getActiveViewScaleInfo()
|
|
5098
5740
|
});
|
|
5099
5741
|
sharer.setSharedStorage(keySelectedElementController, controller);
|
|
5742
|
+
sharer.setSharedStorage(keySelectedElementPosition, getElementPositionFromList(list[0].uuid, ((_a = sharer.getActiveStorage("data")) == null ? void 0 : _a.elements) || []));
|
|
5100
5743
|
} else {
|
|
5101
5744
|
sharer.setSharedStorage(keySelectedElementController, null);
|
|
5745
|
+
sharer.setSharedStorage(keySelectedElementPosition, []);
|
|
5102
5746
|
}
|
|
5103
5747
|
if ((opts2 == null ? void 0 : opts2.triggerEvent) === true) {
|
|
5104
5748
|
eventHub.trigger(middlewareEventSelect, { uuids: list.map((elem) => elem.uuid) });
|
|
@@ -5114,7 +5758,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5114
5758
|
viewSizeInfo: sharer.getActiveViewSizeInfo(),
|
|
5115
5759
|
groupQueue: sharer.getSharedStorage(keyGroupQueue),
|
|
5116
5760
|
areaSize: null,
|
|
5117
|
-
selectedElementController: sharer.getSharedStorage(keySelectedElementController)
|
|
5761
|
+
selectedElementController: sharer.getSharedStorage(keySelectedElementController),
|
|
5762
|
+
selectedElementPosition: sharer.getSharedStorage(keySelectedElementPosition)
|
|
5118
5763
|
};
|
|
5119
5764
|
};
|
|
5120
5765
|
const clear = () => {
|
|
@@ -5129,6 +5774,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5129
5774
|
sharer.setSharedStorage(keySelectedElementList, []);
|
|
5130
5775
|
sharer.setSharedStorage(keySelectedElementListVertexes, null);
|
|
5131
5776
|
sharer.setSharedStorage(keySelectedElementController, null);
|
|
5777
|
+
sharer.setSharedStorage(keySelectedElementPosition, []);
|
|
5778
|
+
sharer.setSharedStorage(keySelectedReferenceXLines, []);
|
|
5779
|
+
sharer.setSharedStorage(keySelectedReferenceYLines, []);
|
|
5132
5780
|
sharer.setSharedStorage(keyIsMoving, null);
|
|
5133
5781
|
};
|
|
5134
5782
|
clear();
|
|
@@ -5318,6 +5966,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5318
5966
|
},
|
|
5319
5967
|
pointMove: (e) => {
|
|
5320
5968
|
var _a, _b, _c;
|
|
5969
|
+
sharer.setSharedStorage(keySelectedReferenceXLines, []);
|
|
5970
|
+
sharer.setSharedStorage(keySelectedReferenceYLines, []);
|
|
5321
5971
|
sharer.setSharedStorage(keyIsMoving, true);
|
|
5322
5972
|
const data = sharer.getActiveStorage("data");
|
|
5323
5973
|
const elems = getActiveElements();
|
|
@@ -5333,9 +5983,43 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5333
5983
|
inBusyMode = "drag";
|
|
5334
5984
|
if (data && (elems == null ? void 0 : elems.length) === 1 && start && end && ((_b = (_a = elems[0]) == null ? void 0 : _a.operations) == null ? void 0 : _b.lock) !== true) {
|
|
5335
5985
|
const { moveX, moveY } = calcMoveInGroup(start, end, groupQueue);
|
|
5336
|
-
|
|
5337
|
-
|
|
5986
|
+
let totalMoveX = calculator.toGridNum(moveX / scale);
|
|
5987
|
+
let totalMoveY = calculator.toGridNum(moveY / scale);
|
|
5988
|
+
const referenceInfo = calcReferenceInfo(elems[0].uuid, {
|
|
5989
|
+
calculator,
|
|
5990
|
+
data,
|
|
5991
|
+
groupQueue,
|
|
5992
|
+
viewScaleInfo,
|
|
5993
|
+
viewSizeInfo
|
|
5994
|
+
});
|
|
5995
|
+
try {
|
|
5996
|
+
if (referenceInfo) {
|
|
5997
|
+
if (is.x(referenceInfo.offsetX) && referenceInfo.offsetX !== null) {
|
|
5998
|
+
totalMoveX = calculator.toGridNum(totalMoveX + referenceInfo.offsetX);
|
|
5999
|
+
}
|
|
6000
|
+
if (is.y(referenceInfo.offsetY) && referenceInfo.offsetY !== null) {
|
|
6001
|
+
totalMoveY = calculator.toGridNum(totalMoveY + referenceInfo.offsetY);
|
|
6002
|
+
}
|
|
6003
|
+
sharer.setSharedStorage(keySelectedReferenceXLines, referenceInfo.xLines);
|
|
6004
|
+
sharer.setSharedStorage(keySelectedReferenceYLines, referenceInfo.yLines);
|
|
6005
|
+
}
|
|
6006
|
+
} catch (err) {
|
|
6007
|
+
console.error(err);
|
|
6008
|
+
}
|
|
6009
|
+
elems[0].x = calculator.toGridNum(elems[0].x + totalMoveX);
|
|
6010
|
+
elems[0].y = calculator.toGridNum(elems[0].y + totalMoveY);
|
|
5338
6011
|
updateSelectedElementList([elems[0]]);
|
|
6012
|
+
calculator.modifyViewVisibleInfoMap(data, {
|
|
6013
|
+
modifyOptions: {
|
|
6014
|
+
type: "updateElement",
|
|
6015
|
+
content: {
|
|
6016
|
+
element: elems[0],
|
|
6017
|
+
position: sharer.getSharedStorage(keySelectedElementPosition) || []
|
|
6018
|
+
}
|
|
6019
|
+
},
|
|
6020
|
+
viewSizeInfo,
|
|
6021
|
+
viewScaleInfo
|
|
6022
|
+
});
|
|
5339
6023
|
}
|
|
5340
6024
|
viewer.drawFrame();
|
|
5341
6025
|
} else if (actionType === "drag-list") {
|
|
@@ -5346,8 +6030,19 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5346
6030
|
elems.forEach((elem) => {
|
|
5347
6031
|
var _a2;
|
|
5348
6032
|
if (elem && ((_a2 = elem == null ? void 0 : elem.operations) == null ? void 0 : _a2.lock) !== true) {
|
|
5349
|
-
elem.x
|
|
5350
|
-
elem.y
|
|
6033
|
+
elem.x = calculator.toGridNum(elem.x + moveX);
|
|
6034
|
+
elem.y = calculator.toGridNum(elem.y + moveY);
|
|
6035
|
+
calculator.modifyViewVisibleInfoMap(data, {
|
|
6036
|
+
modifyOptions: {
|
|
6037
|
+
type: "updateElement",
|
|
6038
|
+
content: {
|
|
6039
|
+
element: elem,
|
|
6040
|
+
position: getElementPositionFromList(elem.uuid, data.elements) || []
|
|
6041
|
+
}
|
|
6042
|
+
},
|
|
6043
|
+
viewSizeInfo,
|
|
6044
|
+
viewScaleInfo
|
|
6045
|
+
});
|
|
5351
6046
|
}
|
|
5352
6047
|
});
|
|
5353
6048
|
sharer.setActiveStorage("data", data);
|
|
@@ -5391,22 +6086,34 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5391
6086
|
resizeType,
|
|
5392
6087
|
sharer
|
|
5393
6088
|
});
|
|
5394
|
-
elems[0].angle = resizedElemSize.angle;
|
|
6089
|
+
elems[0].angle = calculator.toGridNum(resizedElemSize.angle || 0);
|
|
5395
6090
|
} else {
|
|
5396
6091
|
const resizedElemSize = resizeElement(elems[0], { scale, start: resizeStart, end: resizeEnd, resizeType, sharer });
|
|
5397
|
-
elems[0].
|
|
5398
|
-
elems[0].
|
|
6092
|
+
const calcOpts = { ignore: !!elems[0].angle };
|
|
6093
|
+
elems[0].x = calculator.toGridNum(resizedElemSize.x, calcOpts);
|
|
6094
|
+
elems[0].y = calculator.toGridNum(resizedElemSize.y, calcOpts);
|
|
5399
6095
|
if (elems[0].type === "group" && ((_c = elems[0].operations) == null ? void 0 : _c.deepResize) === true) {
|
|
5400
6096
|
deepResizeGroupElement(elems[0], {
|
|
5401
|
-
w: resizedElemSize.w,
|
|
5402
|
-
h: resizedElemSize.h
|
|
6097
|
+
w: calculator.toGridNum(resizedElemSize.w, calcOpts),
|
|
6098
|
+
h: calculator.toGridNum(resizedElemSize.h, calcOpts)
|
|
5403
6099
|
});
|
|
5404
6100
|
} else {
|
|
5405
|
-
elems[0].w = resizedElemSize.w;
|
|
5406
|
-
elems[0].h = resizedElemSize.h;
|
|
6101
|
+
elems[0].w = calculator.toGridNum(resizedElemSize.w, calcOpts);
|
|
6102
|
+
elems[0].h = calculator.toGridNum(resizedElemSize.h, calcOpts);
|
|
5407
6103
|
}
|
|
5408
6104
|
}
|
|
5409
6105
|
updateSelectedElementList([elems[0]]);
|
|
6106
|
+
calculator.modifyViewVisibleInfoMap(data, {
|
|
6107
|
+
modifyOptions: {
|
|
6108
|
+
type: "updateElement",
|
|
6109
|
+
content: {
|
|
6110
|
+
element: elems[0],
|
|
6111
|
+
position: sharer.getSharedStorage(keySelectedElementPosition) || []
|
|
6112
|
+
}
|
|
6113
|
+
},
|
|
6114
|
+
viewSizeInfo,
|
|
6115
|
+
viewScaleInfo
|
|
6116
|
+
});
|
|
5410
6117
|
viewer.drawFrame();
|
|
5411
6118
|
}
|
|
5412
6119
|
} else if (actionType === "area") {
|
|
@@ -5418,6 +6125,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5418
6125
|
},
|
|
5419
6126
|
pointEnd(e) {
|
|
5420
6127
|
inBusyMode = null;
|
|
6128
|
+
sharer.setSharedStorage(keySelectedReferenceXLines, []);
|
|
6129
|
+
sharer.setSharedStorage(keySelectedReferenceYLines, []);
|
|
5421
6130
|
sharer.setSharedStorage(keyIsMoving, false);
|
|
5422
6131
|
const data = sharer.getActiveStorage("data");
|
|
5423
6132
|
const resizeType = sharer.getSharedStorage(keyResizeType);
|
|
@@ -5559,9 +6268,17 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5559
6268
|
drawSelectedElementControllersVertexes(helperContext, selectedElementController, {
|
|
5560
6269
|
...drawBaseOpts,
|
|
5561
6270
|
element: elem,
|
|
5562
|
-
|
|
6271
|
+
calculator,
|
|
5563
6272
|
hideControllers: !!isMoving && actionType === "drag"
|
|
5564
6273
|
});
|
|
6274
|
+
if (actionType === "drag") {
|
|
6275
|
+
const xLines = sharer2.getSharedStorage(keySelectedReferenceXLines);
|
|
6276
|
+
const yLines = sharer2.getSharedStorage(keySelectedReferenceYLines);
|
|
6277
|
+
drawReferenceLines(helperContext, {
|
|
6278
|
+
xLines,
|
|
6279
|
+
yLines
|
|
6280
|
+
});
|
|
6281
|
+
}
|
|
5565
6282
|
}
|
|
5566
6283
|
} else {
|
|
5567
6284
|
if (hoverElement && actionType !== "drag") {
|
|
@@ -5582,9 +6299,17 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5582
6299
|
drawSelectedElementControllersVertexes(helperContext, selectedElementController, {
|
|
5583
6300
|
...drawBaseOpts,
|
|
5584
6301
|
element: elem,
|
|
5585
|
-
|
|
6302
|
+
calculator,
|
|
5586
6303
|
hideControllers: !!isMoving && actionType === "drag"
|
|
5587
6304
|
});
|
|
6305
|
+
if (actionType === "drag") {
|
|
6306
|
+
const xLines = sharer2.getSharedStorage(keySelectedReferenceXLines);
|
|
6307
|
+
const yLines = sharer2.getSharedStorage(keySelectedReferenceYLines);
|
|
6308
|
+
drawReferenceLines(helperContext, {
|
|
6309
|
+
xLines,
|
|
6310
|
+
yLines
|
|
6311
|
+
});
|
|
6312
|
+
}
|
|
5588
6313
|
} else if (actionType === "area" && areaStart && areaEnd) {
|
|
5589
6314
|
drawArea(helperContext, { start: areaStart, end: areaEnd });
|
|
5590
6315
|
} else if (["drag-list", "drag-list-end"].includes(actionType)) {
|
|
@@ -5609,7 +6334,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5609
6334
|
const keyActiveThumbType = Symbol(`${key$1}_activeThumbType`);
|
|
5610
6335
|
const minScrollerWidth = 12;
|
|
5611
6336
|
const scrollerLineWidth = 16;
|
|
5612
|
-
const scrollerThumbAlpha = 0.
|
|
6337
|
+
const scrollerThumbAlpha = 0.3;
|
|
5613
6338
|
const scrollConfig = {
|
|
5614
6339
|
width: minScrollerWidth,
|
|
5615
6340
|
thumbColor: "#000000AA",
|
|
@@ -5919,12 +6644,13 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5919
6644
|
const borderColor = "#00000080";
|
|
5920
6645
|
const scaleColor = "#000000";
|
|
5921
6646
|
const textColor = "#00000080";
|
|
5922
|
-
const fontFamily = "monospace";
|
|
6647
|
+
const fontFamily$1 = "monospace";
|
|
5923
6648
|
const fontSize = 10;
|
|
5924
6649
|
const fontWeight = 100;
|
|
5925
6650
|
const gridColor = "#AAAAAA20";
|
|
5926
6651
|
const gridKeyColor = "#AAAAAA40";
|
|
5927
6652
|
const lineSize = 1;
|
|
6653
|
+
const selectedAreaColor = "#196097";
|
|
5928
6654
|
function calcRulerScaleList(opts) {
|
|
5929
6655
|
const { scale, viewLength, viewOffset } = opts;
|
|
5930
6656
|
const list = [];
|
|
@@ -6003,7 +6729,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6003
6729
|
ctx.$setFont({
|
|
6004
6730
|
fontWeight,
|
|
6005
6731
|
fontSize,
|
|
6006
|
-
fontFamily
|
|
6732
|
+
fontFamily: fontFamily$1
|
|
6007
6733
|
});
|
|
6008
6734
|
ctx.fillText(`${item.num}`, item.position + fontStart, fontStart);
|
|
6009
6735
|
}
|
|
@@ -6039,7 +6765,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6039
6765
|
ctx.$setFont({
|
|
6040
6766
|
fontWeight,
|
|
6041
6767
|
fontSize,
|
|
6042
|
-
fontFamily
|
|
6768
|
+
fontFamily: fontFamily$1
|
|
6043
6769
|
});
|
|
6044
6770
|
ctx.fillText(numText, fontStart + fontSize, item.position + fontStart);
|
|
6045
6771
|
});
|
|
@@ -6098,9 +6824,61 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6098
6824
|
ctx.stroke();
|
|
6099
6825
|
}
|
|
6100
6826
|
}
|
|
6827
|
+
function drawScrollerSelectedArea(ctx, opts) {
|
|
6828
|
+
const { snapshot, calculator } = opts;
|
|
6829
|
+
const { sharedStore } = snapshot;
|
|
6830
|
+
const selectedElementList = sharedStore[keySelectedElementList];
|
|
6831
|
+
const actionType = sharedStore[keyActionType];
|
|
6832
|
+
if (["select", "drag", "drag-list", "drag-list-end"].includes(actionType) && selectedElementList.length > 0) {
|
|
6833
|
+
const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
|
|
6834
|
+
const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
|
|
6835
|
+
const rangeRectInfoList = [];
|
|
6836
|
+
const xAreaStartList = [];
|
|
6837
|
+
const xAreaEndList = [];
|
|
6838
|
+
const yAreaStartList = [];
|
|
6839
|
+
const yAreaEndList = [];
|
|
6840
|
+
selectedElementList.forEach((elem) => {
|
|
6841
|
+
const rectInfo = calculator.calcViewRectInfoFromRange(elem.uuid, {
|
|
6842
|
+
viewScaleInfo,
|
|
6843
|
+
viewSizeInfo
|
|
6844
|
+
});
|
|
6845
|
+
if (rectInfo) {
|
|
6846
|
+
rangeRectInfoList.push(rectInfo);
|
|
6847
|
+
xAreaStartList.push(rectInfo.left.x);
|
|
6848
|
+
xAreaEndList.push(rectInfo.right.x);
|
|
6849
|
+
yAreaStartList.push(rectInfo.top.y);
|
|
6850
|
+
yAreaEndList.push(rectInfo.bottom.y);
|
|
6851
|
+
}
|
|
6852
|
+
});
|
|
6853
|
+
if (!(rangeRectInfoList.length > 0)) {
|
|
6854
|
+
return;
|
|
6855
|
+
}
|
|
6856
|
+
const xAreaStart = Math.min(...xAreaStartList);
|
|
6857
|
+
const xAreaEnd = Math.max(...xAreaEndList);
|
|
6858
|
+
const yAreaStart = Math.min(...yAreaStartList);
|
|
6859
|
+
const yAreaEnd = Math.max(...yAreaEndList);
|
|
6860
|
+
ctx.globalAlpha = 1;
|
|
6861
|
+
ctx.beginPath();
|
|
6862
|
+
ctx.moveTo(xAreaStart, 0);
|
|
6863
|
+
ctx.lineTo(xAreaEnd, 0);
|
|
6864
|
+
ctx.lineTo(xAreaEnd, rulerSize);
|
|
6865
|
+
ctx.lineTo(xAreaStart, rulerSize);
|
|
6866
|
+
ctx.fillStyle = selectedAreaColor;
|
|
6867
|
+
ctx.closePath();
|
|
6868
|
+
ctx.fill();
|
|
6869
|
+
ctx.beginPath();
|
|
6870
|
+
ctx.moveTo(0, yAreaStart);
|
|
6871
|
+
ctx.lineTo(rulerSize, yAreaStart);
|
|
6872
|
+
ctx.lineTo(rulerSize, yAreaEnd);
|
|
6873
|
+
ctx.lineTo(0, yAreaEnd);
|
|
6874
|
+
ctx.fillStyle = selectedAreaColor;
|
|
6875
|
+
ctx.closePath();
|
|
6876
|
+
ctx.fill();
|
|
6877
|
+
}
|
|
6878
|
+
}
|
|
6101
6879
|
const middlewareEventRuler = "@middleware/show-ruler";
|
|
6102
6880
|
const MiddlewareRuler = (opts) => {
|
|
6103
|
-
const { boardContent, viewer, eventHub } = opts;
|
|
6881
|
+
const { boardContent, viewer, eventHub, calculator } = opts;
|
|
6104
6882
|
const { helperContext, underContext } = boardContent;
|
|
6105
6883
|
let show = true;
|
|
6106
6884
|
let showGrid = true;
|
|
@@ -6127,6 +6905,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6127
6905
|
if (show === true) {
|
|
6128
6906
|
const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
|
|
6129
6907
|
const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
|
|
6908
|
+
drawScrollerSelectedArea(helperContext, { snapshot, calculator });
|
|
6130
6909
|
drawRulerBackground(helperContext, { viewScaleInfo, viewSizeInfo });
|
|
6131
6910
|
const xList = calcXRulerScaleList({ viewScaleInfo, viewSizeInfo });
|
|
6132
6911
|
drawXRuler(helperContext, { scaleList: xList });
|
|
@@ -6187,6 +6966,222 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6187
6966
|
}
|
|
6188
6967
|
};
|
|
6189
6968
|
};
|
|
6969
|
+
const fontFamily = "monospace";
|
|
6970
|
+
function drawSizeInfoText(ctx, opts) {
|
|
6971
|
+
const { point, rotateCenter, angle: angle2, text: text2, color: color2, background: background2, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
6972
|
+
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
6973
|
+
ctx.$setFont({
|
|
6974
|
+
fontWeight: "300",
|
|
6975
|
+
fontSize: fontSize2,
|
|
6976
|
+
fontFamily
|
|
6977
|
+
});
|
|
6978
|
+
const padding = (lineHeight2 - fontSize2) / 2;
|
|
6979
|
+
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
6980
|
+
const bgStart = {
|
|
6981
|
+
x: point.x - textWidth / 2 - padding,
|
|
6982
|
+
y: point.y
|
|
6983
|
+
};
|
|
6984
|
+
const bgEnd = {
|
|
6985
|
+
x: bgStart.x + textWidth + padding * 2,
|
|
6986
|
+
y: bgStart.y + fontSize2 + padding
|
|
6987
|
+
};
|
|
6988
|
+
const textStart = {
|
|
6989
|
+
x: point.x - textWidth / 2,
|
|
6990
|
+
y: point.y
|
|
6991
|
+
};
|
|
6992
|
+
ctx.setLineDash([]);
|
|
6993
|
+
ctx.fillStyle = background2;
|
|
6994
|
+
ctx.beginPath();
|
|
6995
|
+
ctx.moveTo(bgStart.x, bgStart.y);
|
|
6996
|
+
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
6997
|
+
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
6998
|
+
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
6999
|
+
ctx.closePath();
|
|
7000
|
+
ctx.fill();
|
|
7001
|
+
ctx.fillStyle = color2;
|
|
7002
|
+
ctx.textBaseline = "top";
|
|
7003
|
+
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
7004
|
+
});
|
|
7005
|
+
}
|
|
7006
|
+
function drawPositionInfoText(ctx, opts) {
|
|
7007
|
+
const { point, rotateCenter, angle: angle2, text: text2, color: color2, background: background2, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
7008
|
+
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
7009
|
+
ctx.$setFont({
|
|
7010
|
+
fontWeight: "300",
|
|
7011
|
+
fontSize: fontSize2,
|
|
7012
|
+
fontFamily
|
|
7013
|
+
});
|
|
7014
|
+
const padding = (lineHeight2 - fontSize2) / 2;
|
|
7015
|
+
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
7016
|
+
const bgStart = {
|
|
7017
|
+
x: point.x,
|
|
7018
|
+
y: point.y
|
|
7019
|
+
};
|
|
7020
|
+
const bgEnd = {
|
|
7021
|
+
x: bgStart.x + textWidth + padding * 2,
|
|
7022
|
+
y: bgStart.y + fontSize2 + padding
|
|
7023
|
+
};
|
|
7024
|
+
const textStart = {
|
|
7025
|
+
x: point.x + padding,
|
|
7026
|
+
y: point.y
|
|
7027
|
+
};
|
|
7028
|
+
ctx.setLineDash([]);
|
|
7029
|
+
ctx.fillStyle = background2;
|
|
7030
|
+
ctx.beginPath();
|
|
7031
|
+
ctx.moveTo(bgStart.x, bgStart.y);
|
|
7032
|
+
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
7033
|
+
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
7034
|
+
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
7035
|
+
ctx.closePath();
|
|
7036
|
+
ctx.fill();
|
|
7037
|
+
ctx.fillStyle = color2;
|
|
7038
|
+
ctx.textBaseline = "top";
|
|
7039
|
+
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
7040
|
+
});
|
|
7041
|
+
}
|
|
7042
|
+
function drawAngleInfoText(ctx, opts) {
|
|
7043
|
+
const { point, rotateCenter, angle: angle2, text: text2, color: color2, background: background2, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
7044
|
+
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
7045
|
+
ctx.$setFont({
|
|
7046
|
+
fontWeight: "300",
|
|
7047
|
+
fontSize: fontSize2,
|
|
7048
|
+
fontFamily
|
|
7049
|
+
});
|
|
7050
|
+
const padding = (lineHeight2 - fontSize2) / 2;
|
|
7051
|
+
const textWidth = ctx.$undoPixelRatio(ctx.measureText(text2).width);
|
|
7052
|
+
const bgStart = {
|
|
7053
|
+
x: point.x,
|
|
7054
|
+
y: point.y
|
|
7055
|
+
};
|
|
7056
|
+
const bgEnd = {
|
|
7057
|
+
x: bgStart.x + textWidth + padding * 2,
|
|
7058
|
+
y: bgStart.y + fontSize2 + padding
|
|
7059
|
+
};
|
|
7060
|
+
const textStart = {
|
|
7061
|
+
x: point.x + padding,
|
|
7062
|
+
y: point.y
|
|
7063
|
+
};
|
|
7064
|
+
ctx.setLineDash([]);
|
|
7065
|
+
ctx.fillStyle = background2;
|
|
7066
|
+
ctx.beginPath();
|
|
7067
|
+
ctx.moveTo(bgStart.x, bgStart.y);
|
|
7068
|
+
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
7069
|
+
ctx.lineTo(bgEnd.x, bgEnd.y);
|
|
7070
|
+
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
7071
|
+
ctx.closePath();
|
|
7072
|
+
ctx.fill();
|
|
7073
|
+
ctx.fillStyle = color2;
|
|
7074
|
+
ctx.textBaseline = "top";
|
|
7075
|
+
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
7076
|
+
});
|
|
7077
|
+
}
|
|
7078
|
+
const infoBackground = "#1973bac6";
|
|
7079
|
+
const infoTextColor = "#ffffff";
|
|
7080
|
+
const infoFontSize = 10;
|
|
7081
|
+
const infoLineHeight = 16;
|
|
7082
|
+
const MiddlewareInfo = (opts) => {
|
|
7083
|
+
const { boardContent, calculator } = opts;
|
|
7084
|
+
const { helperContext } = boardContent;
|
|
7085
|
+
return {
|
|
7086
|
+
name: "@middleware/info",
|
|
7087
|
+
beforeDrawFrame({ snapshot }) {
|
|
7088
|
+
const { sharedStore } = snapshot;
|
|
7089
|
+
const selectedElementList = sharedStore[keySelectedElementList];
|
|
7090
|
+
const actionType = sharedStore[keyActionType];
|
|
7091
|
+
const groupQueue = sharedStore[keyGroupQueue] || [];
|
|
7092
|
+
if (selectedElementList.length === 1) {
|
|
7093
|
+
const elem = selectedElementList[0];
|
|
7094
|
+
if (elem && ["select", "drag", "resize"].includes(actionType)) {
|
|
7095
|
+
const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
|
|
7096
|
+
const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
|
|
7097
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = elem;
|
|
7098
|
+
const totalGroupQueue = [
|
|
7099
|
+
...groupQueue,
|
|
7100
|
+
...[
|
|
7101
|
+
{
|
|
7102
|
+
uuid: createUUID(),
|
|
7103
|
+
x: x2,
|
|
7104
|
+
y: y2,
|
|
7105
|
+
w: w2,
|
|
7106
|
+
h: h2,
|
|
7107
|
+
angle: angle2,
|
|
7108
|
+
type: "group",
|
|
7109
|
+
detail: { children: [] }
|
|
7110
|
+
}
|
|
7111
|
+
]
|
|
7112
|
+
];
|
|
7113
|
+
const calcOpts = { viewScaleInfo, viewSizeInfo };
|
|
7114
|
+
const rangeRectInfo = calculator.calcViewRectInfoFromOrigin(elem.uuid, calcOpts);
|
|
7115
|
+
let totalAngle = 0;
|
|
7116
|
+
totalGroupQueue.forEach((group) => {
|
|
7117
|
+
totalAngle += group.angle || 0;
|
|
7118
|
+
});
|
|
7119
|
+
const totalRadian = parseAngleToRadian(limitAngle(0 - totalAngle));
|
|
7120
|
+
if (rangeRectInfo) {
|
|
7121
|
+
const elemCenter = rangeRectInfo == null ? void 0 : rangeRectInfo.center;
|
|
7122
|
+
const rectInfo = {
|
|
7123
|
+
topLeft: rotatePoint(elemCenter, rangeRectInfo.topLeft, totalRadian),
|
|
7124
|
+
topRight: rotatePoint(elemCenter, rangeRectInfo.topRight, totalRadian),
|
|
7125
|
+
bottomRight: rotatePoint(elemCenter, rangeRectInfo.bottomRight, totalRadian),
|
|
7126
|
+
bottomLeft: rotatePoint(elemCenter, rangeRectInfo.bottomLeft, totalRadian),
|
|
7127
|
+
center: rotatePoint(elemCenter, rangeRectInfo.center, totalRadian),
|
|
7128
|
+
top: rotatePoint(elemCenter, rangeRectInfo.top, totalRadian),
|
|
7129
|
+
right: rotatePoint(elemCenter, rangeRectInfo.right, totalRadian),
|
|
7130
|
+
bottom: rotatePoint(elemCenter, rangeRectInfo.bottom, totalRadian),
|
|
7131
|
+
left: rotatePoint(elemCenter, rangeRectInfo.left, totalRadian)
|
|
7132
|
+
};
|
|
7133
|
+
const x22 = formatNumber(elem.x, { decimalPlaces: 2 });
|
|
7134
|
+
const y22 = formatNumber(elem.y, { decimalPlaces: 2 });
|
|
7135
|
+
const w22 = formatNumber(elem.w, { decimalPlaces: 2 });
|
|
7136
|
+
const h22 = formatNumber(elem.h, { decimalPlaces: 2 });
|
|
7137
|
+
const xyText = `${formatNumber(x22, { decimalPlaces: 0 })},${formatNumber(y22, { decimalPlaces: 0 })}`;
|
|
7138
|
+
const whText = `${formatNumber(w22, { decimalPlaces: 0 })}x${formatNumber(h22, { decimalPlaces: 0 })}`;
|
|
7139
|
+
const angleText = `${formatNumber(elem.angle || 0, { decimalPlaces: 0 })}°`;
|
|
7140
|
+
drawSizeInfoText(helperContext, {
|
|
7141
|
+
point: {
|
|
7142
|
+
x: rectInfo.bottom.x,
|
|
7143
|
+
y: rectInfo.bottom.y + infoFontSize
|
|
7144
|
+
},
|
|
7145
|
+
rotateCenter: rectInfo.center,
|
|
7146
|
+
angle: totalAngle,
|
|
7147
|
+
text: whText,
|
|
7148
|
+
fontSize: infoFontSize,
|
|
7149
|
+
lineHeight: infoLineHeight,
|
|
7150
|
+
color: infoTextColor,
|
|
7151
|
+
background: infoBackground
|
|
7152
|
+
});
|
|
7153
|
+
drawPositionInfoText(helperContext, {
|
|
7154
|
+
point: {
|
|
7155
|
+
x: rectInfo.topLeft.x,
|
|
7156
|
+
y: rectInfo.topLeft.y - infoFontSize * 2
|
|
7157
|
+
},
|
|
7158
|
+
rotateCenter: rectInfo.center,
|
|
7159
|
+
angle: totalAngle,
|
|
7160
|
+
text: xyText,
|
|
7161
|
+
fontSize: infoFontSize,
|
|
7162
|
+
lineHeight: infoLineHeight,
|
|
7163
|
+
color: infoTextColor,
|
|
7164
|
+
background: infoBackground
|
|
7165
|
+
});
|
|
7166
|
+
drawAngleInfoText(helperContext, {
|
|
7167
|
+
point: {
|
|
7168
|
+
x: rectInfo.top.x + infoFontSize,
|
|
7169
|
+
y: rectInfo.top.y - infoFontSize * 2
|
|
7170
|
+
},
|
|
7171
|
+
rotateCenter: rectInfo.center,
|
|
7172
|
+
angle: totalAngle,
|
|
7173
|
+
text: angleText,
|
|
7174
|
+
fontSize: infoFontSize,
|
|
7175
|
+
lineHeight: infoLineHeight,
|
|
7176
|
+
color: infoTextColor,
|
|
7177
|
+
background: infoBackground
|
|
7178
|
+
});
|
|
7179
|
+
}
|
|
7180
|
+
}
|
|
7181
|
+
}
|
|
7182
|
+
}
|
|
7183
|
+
};
|
|
7184
|
+
};
|
|
6190
7185
|
class Core {
|
|
6191
7186
|
constructor(container, opts) {
|
|
6192
7187
|
__privateAdd(this, _initContainer);
|
|
@@ -6230,9 +7225,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6230
7225
|
disuse(middleware) {
|
|
6231
7226
|
__privateGet(this, _board).disuse(middleware);
|
|
6232
7227
|
}
|
|
6233
|
-
setData(data) {
|
|
7228
|
+
setData(data, opts) {
|
|
6234
7229
|
validateElements((data == null ? void 0 : data.elements) || []);
|
|
6235
|
-
__privateGet(this, _board).setData(data);
|
|
7230
|
+
__privateGet(this, _board).setData(data, opts);
|
|
6236
7231
|
}
|
|
6237
7232
|
getData() {
|
|
6238
7233
|
return __privateGet(this, _board).getData();
|
|
@@ -6302,6 +7297,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6302
7297
|
};
|
|
6303
7298
|
exports.Core = Core;
|
|
6304
7299
|
exports.MiddlewareDragger = MiddlewareDragger;
|
|
7300
|
+
exports.MiddlewareInfo = MiddlewareInfo;
|
|
6305
7301
|
exports.MiddlewareRuler = MiddlewareRuler;
|
|
6306
7302
|
exports.MiddlewareScaler = MiddlewareScaler;
|
|
6307
7303
|
exports.MiddlewareScroller = MiddlewareScroller;
|