@idraw/core 0.4.0-beta.31 → 0.4.0-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/middleware/info/index.js +4 -2
- package/dist/esm/middleware/info/types.d.ts +2 -2
- package/dist/esm/middleware/layout-selector/config.d.ts +2 -2
- package/dist/esm/middleware/layout-selector/config.js +3 -2
- package/dist/esm/middleware/layout-selector/index.d.ts +2 -2
- package/dist/esm/middleware/layout-selector/index.js +7 -4
- package/dist/esm/middleware/layout-selector/util.d.ts +3 -2
- package/dist/esm/middleware/layout-selector/util.js +19 -64
- package/dist/esm/middleware/selector/draw-wrapper.d.ts +3 -3
- package/dist/esm/middleware/selector/draw-wrapper.js +1 -1
- package/dist/esm/middleware/selector/index.js +60 -41
- package/dist/esm/middleware/selector/util.d.ts +2 -2
- package/dist/esm/middleware/selector/util.js +4 -4
- package/dist/index.global.js +102 -109
- package/dist/index.global.min.js +1 -1
- package/package.json +5 -5
package/dist/index.global.js
CHANGED
|
@@ -1209,6 +1209,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1209
1209
|
}
|
|
1210
1210
|
return groupQueue;
|
|
1211
1211
|
}
|
|
1212
|
+
function getElementSize(elem) {
|
|
1213
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = elem;
|
|
1214
|
+
const size = { x: x2, y: y2, w: w2, h: h2, angle: angle2 };
|
|
1215
|
+
return size;
|
|
1216
|
+
}
|
|
1212
1217
|
function findElementsFromListByPositions(positions, list) {
|
|
1213
1218
|
const elements = [];
|
|
1214
1219
|
positions.forEach((pos) => {
|
|
@@ -4603,7 +4608,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4603
4608
|
const activeAreaColor = "#1976d21c";
|
|
4604
4609
|
const lockedColor = "#5b5959b5";
|
|
4605
4610
|
const referenceColor = "#f7276e";
|
|
4606
|
-
const defaultStyle$
|
|
4611
|
+
const defaultStyle$3 = {
|
|
4607
4612
|
activeColor,
|
|
4608
4613
|
activeAreaColor,
|
|
4609
4614
|
lockedColor,
|
|
@@ -4722,7 +4727,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4722
4727
|
const wrapperOpts = { borderColor: activeColor2, borderWidth: 1, background: "transparent", lineDash: [] };
|
|
4723
4728
|
drawVertexes(ctx, calcViewVertexes(vertexes, opts), wrapperOpts);
|
|
4724
4729
|
}
|
|
4725
|
-
function
|
|
4730
|
+
function drawLockedVertexesWrapper(ctx, vertexes, opts) {
|
|
4726
4731
|
if (!vertexes) {
|
|
4727
4732
|
return;
|
|
4728
4733
|
}
|
|
@@ -5502,10 +5507,10 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5502
5507
|
const endY = Math.max(start.y, end.y);
|
|
5503
5508
|
for (let idx = 0; idx < data.elements.length; idx++) {
|
|
5504
5509
|
const elem = data.elements[idx];
|
|
5505
|
-
if (((_a = elem == null ? void 0 : elem.operations) == null ? void 0 : _a.
|
|
5510
|
+
if (((_a = elem == null ? void 0 : elem.operations) == null ? void 0 : _a.locked) === true) {
|
|
5506
5511
|
continue;
|
|
5507
5512
|
}
|
|
5508
|
-
const elemSize = calcViewElementSize(elem, { viewScaleInfo
|
|
5513
|
+
const elemSize = calcViewElementSize(elem, { viewScaleInfo });
|
|
5509
5514
|
const center = calcElementCenter(elemSize);
|
|
5510
5515
|
if (center.x >= startX && center.x <= endX && center.y >= startY && center.y <= endY) {
|
|
5511
5516
|
indexes.push(idx);
|
|
@@ -5532,14 +5537,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5532
5537
|
return null;
|
|
5533
5538
|
}
|
|
5534
5539
|
const area = { x: 0, y: 0, w: 0, h: 0 };
|
|
5535
|
-
const { viewScaleInfo
|
|
5540
|
+
const { viewScaleInfo } = opts;
|
|
5536
5541
|
let prevElemSize = null;
|
|
5537
5542
|
for (let i = 0; i < elements.length; i++) {
|
|
5538
5543
|
const elem = elements[i];
|
|
5539
5544
|
if ((_a = elem == null ? void 0 : elem.operations) == null ? void 0 : _a.invisible) {
|
|
5540
5545
|
continue;
|
|
5541
5546
|
}
|
|
5542
|
-
const elemSize = calcViewElementSize(elem, { viewScaleInfo
|
|
5547
|
+
const elemSize = calcViewElementSize(elem, { viewScaleInfo });
|
|
5543
5548
|
if (elemSize.angle && (elemSize.angle > 0 || elemSize.angle < 0)) {
|
|
5544
5549
|
const ves = rotateElementVertexes(elemSize);
|
|
5545
5550
|
if (ves.length === 4) {
|
|
@@ -6095,10 +6100,12 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6095
6100
|
const keyLayoutController = Symbol(`${key$2}_layoutController`);
|
|
6096
6101
|
const keyLayoutIsHover = Symbol(`${key$2}_layoutIsHover`);
|
|
6097
6102
|
const keyLayoutIsSelected = Symbol(`${key$2}_layoutIsSelected`);
|
|
6098
|
-
const selectColor = "#b331c9";
|
|
6099
|
-
const disableColor = "#5b5959b5";
|
|
6100
6103
|
const controllerSize = 10;
|
|
6101
|
-
|
|
6104
|
+
const defaultStyle$2 = {
|
|
6105
|
+
activeColor: "#b331c9"
|
|
6106
|
+
};
|
|
6107
|
+
function drawControllerBox(ctx, boxVertexes, style) {
|
|
6108
|
+
const { activeColor: activeColor2 } = style;
|
|
6102
6109
|
ctx.setLineDash([]);
|
|
6103
6110
|
ctx.fillStyle = "#FFFFFF";
|
|
6104
6111
|
ctx.beginPath();
|
|
@@ -6108,7 +6115,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6108
6115
|
ctx.lineTo(boxVertexes[3].x, boxVertexes[3].y);
|
|
6109
6116
|
ctx.closePath();
|
|
6110
6117
|
ctx.fill();
|
|
6111
|
-
ctx.strokeStyle =
|
|
6118
|
+
ctx.strokeStyle = activeColor2;
|
|
6112
6119
|
ctx.lineWidth = 2;
|
|
6113
6120
|
ctx.beginPath();
|
|
6114
6121
|
ctx.moveTo(boxVertexes[0].x, boxVertexes[0].y);
|
|
@@ -6118,26 +6125,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6118
6125
|
ctx.closePath();
|
|
6119
6126
|
ctx.stroke();
|
|
6120
6127
|
}
|
|
6121
|
-
function drawControllerCross(ctx, opts) {
|
|
6122
|
-
const { vertexes, strokeStyle, lineWidth } = opts;
|
|
6123
|
-
ctx.setLineDash([]);
|
|
6124
|
-
ctx.strokeStyle = strokeStyle;
|
|
6125
|
-
ctx.lineWidth = lineWidth;
|
|
6126
|
-
ctx.beginPath();
|
|
6127
|
-
ctx.moveTo(vertexes[0].x, vertexes[0].y);
|
|
6128
|
-
ctx.lineTo(vertexes[2].x, vertexes[2].y);
|
|
6129
|
-
ctx.closePath();
|
|
6130
|
-
ctx.stroke();
|
|
6131
|
-
ctx.beginPath();
|
|
6132
|
-
ctx.moveTo(vertexes[1].x, vertexes[1].y);
|
|
6133
|
-
ctx.lineTo(vertexes[3].x, vertexes[3].y);
|
|
6134
|
-
ctx.closePath();
|
|
6135
|
-
ctx.stroke();
|
|
6136
|
-
}
|
|
6137
6128
|
function drawControllerLine(ctx, opts) {
|
|
6138
|
-
const { start, end,
|
|
6139
|
-
const
|
|
6140
|
-
const
|
|
6129
|
+
const { start, end, style } = opts;
|
|
6130
|
+
const { activeColor: activeColor2 } = style;
|
|
6131
|
+
const lineWidth = 2;
|
|
6132
|
+
const strokeStyle = activeColor2;
|
|
6141
6133
|
ctx.setLineDash([]);
|
|
6142
6134
|
ctx.strokeStyle = strokeStyle;
|
|
6143
6135
|
ctx.lineWidth = lineWidth;
|
|
@@ -6146,51 +6138,25 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6146
6138
|
ctx.lineTo(end.x, end.y);
|
|
6147
6139
|
ctx.closePath();
|
|
6148
6140
|
ctx.stroke();
|
|
6149
|
-
if (disabled === true) {
|
|
6150
|
-
drawControllerCross(ctx, {
|
|
6151
|
-
vertexes: centerVertexes,
|
|
6152
|
-
lineWidth,
|
|
6153
|
-
strokeStyle
|
|
6154
|
-
});
|
|
6155
|
-
}
|
|
6156
6141
|
}
|
|
6157
6142
|
function drawLayoutController(ctx, opts) {
|
|
6158
|
-
const { controller,
|
|
6143
|
+
const { controller, style } = opts;
|
|
6159
6144
|
const { topLeft, topRight, bottomLeft, bottomRight, topMiddle, rightMiddle, bottomMiddle, leftMiddle } = controller;
|
|
6160
|
-
drawControllerLine(ctx, { start: topLeft.center, end: topRight.center, centerVertexes: topMiddle.vertexes,
|
|
6161
|
-
drawControllerLine(ctx, { start: topRight.center, end: bottomRight.center, centerVertexes: rightMiddle.vertexes,
|
|
6162
|
-
drawControllerLine(ctx, { start: bottomRight.center, end: bottomLeft.center, centerVertexes: bottomMiddle.vertexes,
|
|
6163
|
-
drawControllerLine(ctx, { start: bottomLeft.center, end: topLeft.center, centerVertexes: leftMiddle.vertexes,
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
if ((operations == null ? void 0 : operations.disabledTopLeft) === true) {
|
|
6169
|
-
drawControllerCross(ctx, { vertexes: topLeft.vertexes, ...disabledOpts });
|
|
6170
|
-
} else {
|
|
6171
|
-
drawControllerBox(ctx, topLeft.vertexes);
|
|
6172
|
-
}
|
|
6173
|
-
if ((operations == null ? void 0 : operations.disabledTopRight) === true) {
|
|
6174
|
-
drawControllerCross(ctx, { vertexes: topRight.vertexes, ...disabledOpts });
|
|
6175
|
-
} else {
|
|
6176
|
-
drawControllerBox(ctx, topRight.vertexes);
|
|
6177
|
-
}
|
|
6178
|
-
if ((operations == null ? void 0 : operations.disabledBottomRight) === true) {
|
|
6179
|
-
drawControllerCross(ctx, { vertexes: bottomRight.vertexes, ...disabledOpts });
|
|
6180
|
-
} else {
|
|
6181
|
-
drawControllerBox(ctx, bottomRight.vertexes);
|
|
6182
|
-
}
|
|
6183
|
-
if ((operations == null ? void 0 : operations.disabledBottomLeft) === true) {
|
|
6184
|
-
drawControllerCross(ctx, { vertexes: bottomLeft.vertexes, ...disabledOpts });
|
|
6185
|
-
} else {
|
|
6186
|
-
drawControllerBox(ctx, bottomLeft.vertexes);
|
|
6187
|
-
}
|
|
6145
|
+
drawControllerLine(ctx, { start: topLeft.center, end: topRight.center, centerVertexes: topMiddle.vertexes, style });
|
|
6146
|
+
drawControllerLine(ctx, { start: topRight.center, end: bottomRight.center, centerVertexes: rightMiddle.vertexes, style });
|
|
6147
|
+
drawControllerLine(ctx, { start: bottomRight.center, end: bottomLeft.center, centerVertexes: bottomMiddle.vertexes, style });
|
|
6148
|
+
drawControllerLine(ctx, { start: bottomLeft.center, end: topLeft.center, centerVertexes: leftMiddle.vertexes, style });
|
|
6149
|
+
drawControllerBox(ctx, topLeft.vertexes, style);
|
|
6150
|
+
drawControllerBox(ctx, topRight.vertexes, style);
|
|
6151
|
+
drawControllerBox(ctx, bottomRight.vertexes, style);
|
|
6152
|
+
drawControllerBox(ctx, bottomLeft.vertexes, style);
|
|
6188
6153
|
}
|
|
6189
6154
|
function drawLayoutHover(ctx, opts) {
|
|
6190
|
-
const { layoutSize } = opts;
|
|
6155
|
+
const { layoutSize, style } = opts;
|
|
6156
|
+
const { activeColor: activeColor2 } = style;
|
|
6191
6157
|
const { x: x2, y: y2, w: w2, h: h2 } = layoutSize;
|
|
6192
6158
|
ctx.setLineDash([]);
|
|
6193
|
-
ctx.strokeStyle =
|
|
6159
|
+
ctx.strokeStyle = activeColor2;
|
|
6194
6160
|
ctx.lineWidth = 1;
|
|
6195
6161
|
ctx.beginPath();
|
|
6196
6162
|
ctx.moveTo(x2, y2);
|
|
@@ -6201,9 +6167,15 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6201
6167
|
ctx.closePath();
|
|
6202
6168
|
ctx.stroke();
|
|
6203
6169
|
}
|
|
6204
|
-
const MiddlewareLayoutSelector = (opts) => {
|
|
6170
|
+
const MiddlewareLayoutSelector = (opts, config) => {
|
|
6205
6171
|
const { sharer, boardContent, calculator, viewer, eventHub } = opts;
|
|
6206
6172
|
const { overlayContext } = boardContent;
|
|
6173
|
+
const innerConfig = {
|
|
6174
|
+
...defaultStyle$2,
|
|
6175
|
+
...config
|
|
6176
|
+
};
|
|
6177
|
+
const { activeColor: activeColor2 } = innerConfig;
|
|
6178
|
+
const style = { activeColor: activeColor2 };
|
|
6207
6179
|
let prevPoint = null;
|
|
6208
6180
|
let prevIsHover = null;
|
|
6209
6181
|
let prevIsSelected = null;
|
|
@@ -6495,10 +6467,10 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6495
6467
|
const controller = calcLayoutSizeController(size, { viewScaleInfo, controllerSize });
|
|
6496
6468
|
if (layoutIsHover === true) {
|
|
6497
6469
|
const viewSize = calcViewElementSize(size, { viewScaleInfo });
|
|
6498
|
-
drawLayoutHover(overlayContext, { layoutSize: viewSize });
|
|
6470
|
+
drawLayoutHover(overlayContext, { layoutSize: viewSize, style });
|
|
6499
6471
|
}
|
|
6500
6472
|
if (layoutActionType && ["resize"].includes(layoutActionType) || layoutIsSelected === true) {
|
|
6501
|
-
drawLayoutController(overlayContext, { controller,
|
|
6473
|
+
drawLayoutController(overlayContext, { controller, style });
|
|
6502
6474
|
}
|
|
6503
6475
|
}
|
|
6504
6476
|
},
|
|
@@ -6515,7 +6487,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6515
6487
|
};
|
|
6516
6488
|
const MiddlewareSelector = (opts, config) => {
|
|
6517
6489
|
const innerConfig = {
|
|
6518
|
-
...defaultStyle$
|
|
6490
|
+
...defaultStyle$3,
|
|
6519
6491
|
...config
|
|
6520
6492
|
};
|
|
6521
6493
|
const { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 } = innerConfig;
|
|
@@ -6523,6 +6495,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6523
6495
|
const { viewer, sharer, boardContent, calculator, eventHub } = opts;
|
|
6524
6496
|
const { overlayContext } = boardContent;
|
|
6525
6497
|
let prevPoint = null;
|
|
6498
|
+
let moveOriginalStartPoint = null;
|
|
6499
|
+
let moveOriginalStartElementSize = null;
|
|
6526
6500
|
let inBusyMode = null;
|
|
6527
6501
|
sharer.setSharedStorage(keyActionType, null);
|
|
6528
6502
|
sharer.setSharedStorage(keyEnableSnapToGrid, true);
|
|
@@ -6605,7 +6579,6 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6605
6579
|
sharer.setSharedStorage(keySelectedElementController, null);
|
|
6606
6580
|
sharer.setSharedStorage(keySelectedElementPosition, []);
|
|
6607
6581
|
sharer.setSharedStorage(keyIsMoving, null);
|
|
6608
|
-
sharer.setSharedStorage(keyEnableSelectInGroup, null);
|
|
6609
6582
|
};
|
|
6610
6583
|
clear();
|
|
6611
6584
|
const selectCallback = ({ uuids, positions }) => {
|
|
@@ -6749,8 +6722,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6749
6722
|
}
|
|
6750
6723
|
},
|
|
6751
6724
|
pointStart: (e) => {
|
|
6752
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
6725
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
6753
6726
|
prevPoint = e.point;
|
|
6727
|
+
moveOriginalStartPoint = e.point;
|
|
6754
6728
|
const groupQueue = sharer.getSharedStorage(keyGroupQueue);
|
|
6755
6729
|
if ((groupQueue == null ? void 0 : groupQueue.length) > 0) {
|
|
6756
6730
|
if (isPointInViewActiveGroup(e.point, {
|
|
@@ -6760,15 +6734,18 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6760
6734
|
groupQueue
|
|
6761
6735
|
})) {
|
|
6762
6736
|
const target2 = getPointTarget(e.point, pointTargetBaseOptions());
|
|
6763
|
-
if (((_a = target2 == null ? void 0 : target2.elements) == null ? void 0 : _a.length) === 1 && ((_c = (_b = target2.elements[0]) == null ? void 0 : _b.operations) == null ? void 0 : _c.
|
|
6737
|
+
if (((_a = target2 == null ? void 0 : target2.elements) == null ? void 0 : _a.length) === 1 && ((_c = (_b = target2.elements[0]) == null ? void 0 : _b.operations) == null ? void 0 : _c.locked) === true) {
|
|
6764
6738
|
return;
|
|
6765
6739
|
} else {
|
|
6766
6740
|
updateHoverElement(null);
|
|
6767
6741
|
}
|
|
6768
|
-
if (
|
|
6742
|
+
if (((_d = target2 == null ? void 0 : target2.elements) == null ? void 0 : _d.length) === 1) {
|
|
6743
|
+
moveOriginalStartElementSize = getElementSize(target2 == null ? void 0 : target2.elements[0]);
|
|
6744
|
+
}
|
|
6745
|
+
if (target2.type === "over-element" && ((_e = target2 == null ? void 0 : target2.elements) == null ? void 0 : _e.length) === 1) {
|
|
6769
6746
|
updateSelectedElementList([target2.elements[0]], { triggerEvent: true });
|
|
6770
6747
|
sharer.setSharedStorage(keyActionType, "drag");
|
|
6771
|
-
} else if ((
|
|
6748
|
+
} else if ((_f = target2.type) == null ? void 0 : _f.startsWith("resize-")) {
|
|
6772
6749
|
sharer.setSharedStorage(keyResizeType, target2.type);
|
|
6773
6750
|
sharer.setSharedStorage(keyActionType, "resize");
|
|
6774
6751
|
} else {
|
|
@@ -6790,19 +6767,28 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6790
6767
|
areaSize: listAreaSize,
|
|
6791
6768
|
groupQueue: []
|
|
6792
6769
|
});
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
} else {
|
|
6770
|
+
const isLockedElement = ((_g = target == null ? void 0 : target.elements) == null ? void 0 : _g.length) === 1 && ((_i = (_h = target.elements[0]) == null ? void 0 : _h.operations) == null ? void 0 : _i.locked) === true;
|
|
6771
|
+
if (!isLockedElement) {
|
|
6796
6772
|
updateHoverElement(null);
|
|
6797
6773
|
}
|
|
6798
|
-
if (target.
|
|
6799
|
-
|
|
6800
|
-
}
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6774
|
+
if (((_j = target == null ? void 0 : target.elements) == null ? void 0 : _j.length) === 1) {
|
|
6775
|
+
moveOriginalStartElementSize = getElementSize(target == null ? void 0 : target.elements[0]);
|
|
6776
|
+
}
|
|
6777
|
+
if (!isLockedElement) {
|
|
6778
|
+
if (target.type === "list-area") {
|
|
6779
|
+
sharer.setSharedStorage(keyActionType, "drag-list");
|
|
6780
|
+
} else if (target.type === "over-element" && ((_k = target == null ? void 0 : target.elements) == null ? void 0 : _k.length) === 1) {
|
|
6781
|
+
updateSelectedElementList([target.elements[0]], { triggerEvent: true });
|
|
6782
|
+
sharer.setSharedStorage(keyActionType, "drag");
|
|
6783
|
+
} else if ((_l = target.type) == null ? void 0 : _l.startsWith("resize-")) {
|
|
6784
|
+
sharer.setSharedStorage(keyResizeType, target.type);
|
|
6785
|
+
sharer.setSharedStorage(keyActionType, "resize");
|
|
6786
|
+
} else {
|
|
6787
|
+
clear();
|
|
6788
|
+
sharer.setSharedStorage(keyActionType, "area");
|
|
6789
|
+
sharer.setSharedStorage(keyAreaStart, e.point);
|
|
6790
|
+
updateSelectedElementList([], { triggerEvent: true });
|
|
6791
|
+
}
|
|
6806
6792
|
} else {
|
|
6807
6793
|
clear();
|
|
6808
6794
|
sharer.setSharedStorage(keyActionType, "area");
|
|
@@ -6820,6 +6806,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6820
6806
|
const viewScaleInfo = sharer.getActiveViewScaleInfo();
|
|
6821
6807
|
const viewSizeInfo = sharer.getActiveViewSizeInfo();
|
|
6822
6808
|
const start = prevPoint;
|
|
6809
|
+
const originalStart = moveOriginalStartPoint;
|
|
6823
6810
|
const end = e.point;
|
|
6824
6811
|
const resizeType = sharer.getSharedStorage(keyResizeType);
|
|
6825
6812
|
const actionType = sharer.getSharedStorage(keyActionType);
|
|
@@ -6827,8 +6814,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6827
6814
|
const enableSnapToGrid = sharer.getSharedStorage(keyEnableSnapToGrid);
|
|
6828
6815
|
if (actionType === "drag") {
|
|
6829
6816
|
inBusyMode = "drag";
|
|
6830
|
-
if (data && (elems == null ? void 0 : elems.length) === 1 &&
|
|
6831
|
-
const { moveX, moveY } = calcMoveInGroup(
|
|
6817
|
+
if (data && (elems == null ? void 0 : elems.length) === 1 && moveOriginalStartElementSize && originalStart && end && ((_b = (_a = elems[0]) == null ? void 0 : _a.operations) == null ? void 0 : _b.locked) !== true) {
|
|
6818
|
+
const { moveX, moveY } = calcMoveInGroup(originalStart, end, groupQueue);
|
|
6832
6819
|
let totalMoveX = calculator.toGridNum(moveX / scale);
|
|
6833
6820
|
let totalMoveY = calculator.toGridNum(moveY / scale);
|
|
6834
6821
|
if (enableSnapToGrid === true) {
|
|
@@ -6852,8 +6839,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6852
6839
|
console.error(err);
|
|
6853
6840
|
}
|
|
6854
6841
|
}
|
|
6855
|
-
elems[0].x = calculator.toGridNum(
|
|
6856
|
-
elems[0].y = calculator.toGridNum(
|
|
6842
|
+
elems[0].x = calculator.toGridNum(moveOriginalStartElementSize.x + totalMoveX);
|
|
6843
|
+
elems[0].y = calculator.toGridNum(moveOriginalStartElementSize.y + totalMoveY);
|
|
6857
6844
|
updateSelectedElementList([elems[0]]);
|
|
6858
6845
|
calculator.modifyViewVisibleInfoMap(data, {
|
|
6859
6846
|
modifyOptions: {
|
|
@@ -6870,12 +6857,12 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6870
6857
|
viewer.drawFrame();
|
|
6871
6858
|
} else if (actionType === "drag-list") {
|
|
6872
6859
|
inBusyMode = "drag-list";
|
|
6873
|
-
if (data && start && end && (elems == null ? void 0 : elems.length) > 1) {
|
|
6860
|
+
if (data && originalStart && start && end && (elems == null ? void 0 : elems.length) > 1) {
|
|
6874
6861
|
const moveX = (end.x - start.x) / scale;
|
|
6875
6862
|
const moveY = (end.y - start.y) / scale;
|
|
6876
6863
|
elems.forEach((elem) => {
|
|
6877
6864
|
var _a2;
|
|
6878
|
-
if (elem && ((_a2 = elem == null ? void 0 : elem.operations) == null ? void 0 : _a2.
|
|
6865
|
+
if (elem && ((_a2 = elem == null ? void 0 : elem.operations) == null ? void 0 : _a2.locked) !== true) {
|
|
6879
6866
|
elem.x = calculator.toGridNum(elem.x + moveX);
|
|
6880
6867
|
elem.y = calculator.toGridNum(elem.y + moveY);
|
|
6881
6868
|
calculator.modifyViewVisibleInfoMap(data, {
|
|
@@ -6895,7 +6882,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6895
6882
|
}
|
|
6896
6883
|
viewer.drawFrame();
|
|
6897
6884
|
} else if (actionType === "resize") {
|
|
6898
|
-
if (data && (elems == null ? void 0 : elems.length) === 1 &&
|
|
6885
|
+
if (data && (elems == null ? void 0 : elems.length) === 1 && originalStart && moveOriginalStartElementSize && (resizeType == null ? void 0 : resizeType.startsWith("resize-"))) {
|
|
6899
6886
|
inBusyMode = "resize";
|
|
6900
6887
|
const pointGroupQueue = [];
|
|
6901
6888
|
groupQueue.forEach((group) => {
|
|
@@ -6908,10 +6895,10 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6908
6895
|
angle: 0 - angle2
|
|
6909
6896
|
});
|
|
6910
6897
|
});
|
|
6911
|
-
let resizeStart =
|
|
6898
|
+
let resizeStart = originalStart;
|
|
6912
6899
|
let resizeEnd = end;
|
|
6913
6900
|
if (groupQueue.length > 0) {
|
|
6914
|
-
resizeStart = rotatePointInGroup(
|
|
6901
|
+
resizeStart = rotatePointInGroup(originalStart, pointGroupQueue);
|
|
6915
6902
|
resizeEnd = rotatePointInGroup(end, pointGroupQueue);
|
|
6916
6903
|
}
|
|
6917
6904
|
if (resizeType === "resize-rotate") {
|
|
@@ -6923,19 +6910,19 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6923
6910
|
controller.bottomRight.center
|
|
6924
6911
|
];
|
|
6925
6912
|
const viewCenter = calcElementCenterFromVertexes(viewVertexes);
|
|
6926
|
-
const resizedElemSize = rotateElement(
|
|
6913
|
+
const resizedElemSize = rotateElement(moveOriginalStartElementSize, {
|
|
6927
6914
|
center: viewCenter,
|
|
6928
6915
|
viewScaleInfo,
|
|
6929
6916
|
viewSizeInfo,
|
|
6930
|
-
start,
|
|
6917
|
+
start: originalStart,
|
|
6931
6918
|
end,
|
|
6932
6919
|
resizeType,
|
|
6933
6920
|
sharer
|
|
6934
6921
|
});
|
|
6935
6922
|
elems[0].angle = calculator.toGridNum(resizedElemSize.angle || 0);
|
|
6936
6923
|
} else {
|
|
6937
|
-
const resizedElemSize = resizeElement(
|
|
6938
|
-
const calcOpts = { ignore: !!
|
|
6924
|
+
const resizedElemSize = resizeElement(moveOriginalStartElementSize, { scale, start: resizeStart, end: resizeEnd, resizeType, sharer });
|
|
6925
|
+
const calcOpts = { ignore: !!moveOriginalStartElementSize.angle };
|
|
6939
6926
|
elems[0].x = calculator.toGridNum(resizedElemSize.x, calcOpts);
|
|
6940
6927
|
elems[0].y = calculator.toGridNum(resizedElemSize.y, calcOpts);
|
|
6941
6928
|
if (elems[0].type === "group" && ((_c = elems[0].operations) == null ? void 0 : _c.deepResize) === true) {
|
|
@@ -6980,6 +6967,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6980
6967
|
const viewSizeInfo = sharer.getActiveViewSizeInfo();
|
|
6981
6968
|
let needDrawFrame = false;
|
|
6982
6969
|
prevPoint = null;
|
|
6970
|
+
moveOriginalStartPoint = null;
|
|
6971
|
+
moveOriginalStartElementSize = null;
|
|
6983
6972
|
if (actionType === "resize" && resizeType) {
|
|
6984
6973
|
sharer.setSharedStorage(keyResizeType, null);
|
|
6985
6974
|
needDrawFrame = true;
|
|
@@ -7042,6 +7031,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7042
7031
|
},
|
|
7043
7032
|
pointLeave() {
|
|
7044
7033
|
prevPoint = null;
|
|
7034
|
+
moveOriginalStartPoint = null;
|
|
7035
|
+
moveOriginalStartElementSize = null;
|
|
7045
7036
|
clear();
|
|
7046
7037
|
viewer.drawFrame();
|
|
7047
7038
|
},
|
|
@@ -7053,7 +7044,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7053
7044
|
const target = getPointTarget(e.point, pointTargetBaseOptions());
|
|
7054
7045
|
sharer.setSharedStorage(keySelectedElementController, null);
|
|
7055
7046
|
sharer.setSharedStorage(keySelectedElementList, []);
|
|
7056
|
-
if (target.elements.length === 1 && ((_b = (_a = target.elements[0]) == null ? void 0 : _a.operations) == null ? void 0 : _b.
|
|
7047
|
+
if (target.elements.length === 1 && ((_b = (_a = target.elements[0]) == null ? void 0 : _a.operations) == null ? void 0 : _b.locked) === true) {
|
|
7057
7048
|
return;
|
|
7058
7049
|
}
|
|
7059
7050
|
if (target.elements.length === 1 && ((_c = target.elements[0]) == null ? void 0 : _c.type) === "group") {
|
|
@@ -7097,12 +7088,12 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7097
7088
|
controllerSize: 10,
|
|
7098
7089
|
viewScaleInfo
|
|
7099
7090
|
}) : null;
|
|
7100
|
-
const
|
|
7091
|
+
const isLocked = !!((_a = hoverElement == null ? void 0 : hoverElement.operations) == null ? void 0 : _a.locked);
|
|
7101
7092
|
if ((groupQueue == null ? void 0 : groupQueue.length) > 0) {
|
|
7102
7093
|
drawGroupQueueVertexesWrappers(overlayContext, groupQueueVertexesList, drawBaseOpts);
|
|
7103
7094
|
if (hoverElement && actionType !== "drag") {
|
|
7104
|
-
if (
|
|
7105
|
-
|
|
7095
|
+
if (isLocked) {
|
|
7096
|
+
drawLockedVertexesWrapper(overlayContext, hoverElementVertexes, {
|
|
7106
7097
|
...drawBaseOpts,
|
|
7107
7098
|
controller: calcElementSizeController(hoverElement, {
|
|
7108
7099
|
groupQueue,
|
|
@@ -7115,7 +7106,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7115
7106
|
drawHoverVertexesWrapper(overlayContext, hoverElementVertexes, drawBaseOpts);
|
|
7116
7107
|
}
|
|
7117
7108
|
}
|
|
7118
|
-
if (!
|
|
7109
|
+
if (!isLocked && elem && ["select", "drag", "resize"].includes(actionType)) {
|
|
7119
7110
|
drawSelectedElementControllersVertexes(overlayContext, selectedElementController, {
|
|
7120
7111
|
...drawBaseOpts,
|
|
7121
7112
|
element: elem,
|
|
@@ -7147,8 +7138,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7147
7138
|
}
|
|
7148
7139
|
} else {
|
|
7149
7140
|
if (hoverElement && actionType !== "drag") {
|
|
7150
|
-
if (
|
|
7151
|
-
|
|
7141
|
+
if (isLocked) {
|
|
7142
|
+
drawLockedVertexesWrapper(overlayContext, hoverElementVertexes, {
|
|
7152
7143
|
...drawBaseOpts,
|
|
7153
7144
|
controller: calcElementSizeController(hoverElement, {
|
|
7154
7145
|
groupQueue,
|
|
@@ -7161,7 +7152,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7161
7152
|
drawHoverVertexesWrapper(overlayContext, hoverElementVertexes, drawBaseOpts);
|
|
7162
7153
|
}
|
|
7163
7154
|
}
|
|
7164
|
-
if (!
|
|
7155
|
+
if (!isLocked && elem && ["select", "drag", "resize"].includes(actionType)) {
|
|
7165
7156
|
drawSelectedElementControllersVertexes(overlayContext, selectedElementController, {
|
|
7166
7157
|
...drawBaseOpts,
|
|
7167
7158
|
element: elem,
|
|
@@ -8083,11 +8074,13 @@ var __privateMethod = (obj, member, method) => {
|
|
|
8083
8074
|
return {
|
|
8084
8075
|
name: "@middleware/info",
|
|
8085
8076
|
beforeDrawFrame({ snapshot }) {
|
|
8077
|
+
var _a;
|
|
8086
8078
|
const { sharedStore } = snapshot;
|
|
8087
8079
|
const selectedElementList = sharedStore[keySelectedElementList];
|
|
8080
|
+
const hoverElement = sharedStore[keyHoverElement];
|
|
8088
8081
|
const actionType = sharedStore[keyActionType];
|
|
8089
8082
|
const groupQueue = sharedStore[keyGroupQueue] || [];
|
|
8090
|
-
if (selectedElementList.length === 1) {
|
|
8083
|
+
if (selectedElementList.length === 1 && !((_a = hoverElement == null ? void 0 : hoverElement.operations) == null ? void 0 : _a.locked)) {
|
|
8091
8084
|
const elem = selectedElementList[0];
|
|
8092
8085
|
if (elem && ["select", "drag", "resize"].includes(actionType)) {
|
|
8093
8086
|
const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
|