@idraw/core 0.4.0-beta.37 → 0.4.0-beta.38
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 +15 -12
- package/dist/esm/middleware/selector/draw-wrapper.js +7 -4
- package/dist/esm/middleware/selector/index.js +16 -4
- package/dist/esm/middleware/selector/util.d.ts +0 -4
- package/dist/esm/middleware/selector/util.js +8 -30
- package/dist/index.global.js +85 -58
- package/dist/index.global.min.js +1 -1
- package/package.json +5 -5
|
@@ -27,6 +27,7 @@ export const MiddlewareInfo = (opts, config) => {
|
|
|
27
27
|
eventHub.off(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, showInfoAngleCallback);
|
|
28
28
|
},
|
|
29
29
|
beforeDrawFrame({ snapshot }) {
|
|
30
|
+
var _a;
|
|
30
31
|
const { sharedStore } = snapshot;
|
|
31
32
|
const selectedElementList = sharedStore[keySelectedElementList];
|
|
32
33
|
const actionType = sharedStore[keyActionType];
|
|
@@ -104,18 +105,20 @@ export const MiddlewareInfo = (opts, config) => {
|
|
|
104
105
|
style
|
|
105
106
|
});
|
|
106
107
|
if (showAngleInfo) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
if (((_a = elem.operations) === null || _a === void 0 ? void 0 : _a.rotatable) !== false) {
|
|
109
|
+
drawAngleInfoText(overlayContext, {
|
|
110
|
+
point: {
|
|
111
|
+
x: rectInfo.top.x + infoFontSize + 4,
|
|
112
|
+
y: rectInfo.top.y - infoFontSize * 2 - 18
|
|
113
|
+
},
|
|
114
|
+
rotateCenter: rectInfo.center,
|
|
115
|
+
angle: totalAngle,
|
|
116
|
+
text: angleText,
|
|
117
|
+
fontSize: infoFontSize,
|
|
118
|
+
lineHeight: infoLineHeight,
|
|
119
|
+
style
|
|
120
|
+
});
|
|
121
|
+
}
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
124
|
}
|
|
@@ -33,10 +33,11 @@ export function drawLockedVertexesWrapper(ctx, vertexes, opts) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
export function drawSelectedElementControllersVertexes(ctx, controller, opts) {
|
|
36
|
+
var _a;
|
|
36
37
|
if (!controller) {
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
|
-
const { hideControllers, style, rotateControllerPattern, viewSizeInfo } = opts;
|
|
40
|
+
const { hideControllers, style, rotateControllerPattern, viewSizeInfo, element } = opts;
|
|
40
41
|
const { devicePixelRatio = 1 } = viewSizeInfo;
|
|
41
42
|
const { activeColor } = style;
|
|
42
43
|
const { elementWrapper, topLeft, topRight, bottomLeft, bottomRight, rotate } = controller;
|
|
@@ -48,9 +49,11 @@ export function drawSelectedElementControllersVertexes(ctx, controller, opts) {
|
|
|
48
49
|
drawVertexes(ctx, calcViewVertexes(topRight.vertexes, opts), ctrlOpts);
|
|
49
50
|
drawVertexes(ctx, calcViewVertexes(bottomLeft.vertexes, opts), ctrlOpts);
|
|
50
51
|
drawVertexes(ctx, calcViewVertexes(bottomRight.vertexes, opts), ctrlOpts);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
if (((_a = element === null || element === void 0 ? void 0 : element.operations) === null || _a === void 0 ? void 0 : _a.rotatable) !== false) {
|
|
53
|
+
drawCircleController(ctx, calcViewPointSize(rotate.center, opts), Object.assign(Object.assign({}, ctrlOpts), { size: rotate.size, borderWidth: 0 }));
|
|
54
|
+
const rotateCenter = calcViewPointSize(rotate.center, opts);
|
|
55
|
+
ctx.drawImage(rotateControllerPattern.canvas, 0, 0, rotateControllerPattern.canvas.width / devicePixelRatio, rotateControllerPattern.canvas.height / devicePixelRatio, rotateCenter.x - rotate.size / 2, rotateCenter.y - rotate.size / 2, rotate.size, rotate.size);
|
|
56
|
+
}
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
export function drawElementListShadows(ctx, elements, opts) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { is, calcElementsViewInfo, calcElementVertexesInGroup, calcElementQueueVertexesQueueInGroup, calcElementSizeController, calcElementCenterFromVertexes, rotatePointInGroup, getGroupQueueFromList, findElementsFromList, findElementsFromListByPositions, getElementPositionFromList, getElementPositionMapFromList, deepResizeGroupElement, getElementSize } from '@idraw/util';
|
|
1
|
+
import { is, calcElementsViewInfo, calcElementVertexesInGroup, calcElementQueueVertexesQueueInGroup, calcElementSizeController, calcElementCenterFromVertexes, rotatePointInGroup, getGroupQueueFromList, findElementsFromList, findElementsFromListByPositions, getElementPositionFromList, getElementPositionMapFromList, deepResizeGroupElement, getElementSize, calcPointMoveElementInGroup, isSameElementSize } from '@idraw/util';
|
|
2
2
|
import { drawHoverVertexesWrapper, drawLockedVertexesWrapper, drawArea, drawListArea, drawGroupQueueVertexesWrappers, drawSelectedElementControllersVertexes } from './draw-wrapper';
|
|
3
3
|
import { drawReferenceLines } from './draw-reference';
|
|
4
|
-
import { getPointTarget, resizeElement, rotateElement, getSelectedListArea, calcSelectedElementsArea, isElementInGroup, isPointInViewActiveGroup
|
|
4
|
+
import { getPointTarget, resizeElement, rotateElement, getSelectedListArea, calcSelectedElementsArea, isElementInGroup, isPointInViewActiveGroup } from './util';
|
|
5
5
|
import { keyActionType, keyResizeType, keyAreaStart, keyAreaEnd, keyGroupQueue, keyGroupQueueVertexesList, keyHoverElement, keyHoverElementVertexes, keySelectedElementList, keySelectedElementListVertexes, keySelectedElementController, keySelectedElementPosition, keyIsMoving, keyEnableSelectInGroup, keyEnableSnapToGrid, controllerSize, rotateControllerSize, rotateControllerPosition, defaultStyle } from './config';
|
|
6
6
|
import { calcReferenceInfo } from './reference';
|
|
7
7
|
import { coreEventKeys } from '../../config';
|
|
@@ -365,7 +365,7 @@ export const MiddlewareSelector = (opts, config) => {
|
|
|
365
365
|
inBusyMode = 'drag';
|
|
366
366
|
eventHub.trigger(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, { show: false });
|
|
367
367
|
if (data && (elems === null || elems === void 0 ? void 0 : elems.length) === 1 && moveOriginalStartElementSize && originalStart && end && ((_b = (_a = elems[0]) === null || _a === void 0 ? void 0 : _a.operations) === null || _b === void 0 ? void 0 : _b.locked) !== true) {
|
|
368
|
-
const { moveX, moveY } =
|
|
368
|
+
const { moveX, moveY } = calcPointMoveElementInGroup(originalStart, end, groupQueue);
|
|
369
369
|
let totalMoveX = calculator.toGridNum(moveX / scale);
|
|
370
370
|
let totalMoveY = calculator.toGridNum(moveY / scale);
|
|
371
371
|
if (enableSnapToGrid === true) {
|
|
@@ -699,7 +699,19 @@ export const MiddlewareSelector = (opts, config) => {
|
|
|
699
699
|
const isMoving = sharedStore[keyIsMoving];
|
|
700
700
|
const enableSnapToGrid = sharedStore[keyEnableSnapToGrid];
|
|
701
701
|
const drawBaseOpts = { calculator, viewScaleInfo, viewSizeInfo, style };
|
|
702
|
-
|
|
702
|
+
let selectedElementController = sharedStore[keySelectedElementController];
|
|
703
|
+
if (selectedElementController && selectedElements.length === 1 && elem) {
|
|
704
|
+
if (!isSameElementSize(elem, selectedElementController.originalElementSize)) {
|
|
705
|
+
selectedElementController = calcElementSizeController(elem, {
|
|
706
|
+
groupQueue: groupQueue || [],
|
|
707
|
+
controllerSize,
|
|
708
|
+
viewScaleInfo,
|
|
709
|
+
rotateControllerPosition,
|
|
710
|
+
rotateControllerSize
|
|
711
|
+
});
|
|
712
|
+
sharer.setSharedStorage(keySelectedElementController, selectedElementController);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
703
715
|
const isHoverLocked = !!((_a = hoverElement === null || hoverElement === void 0 ? void 0 : hoverElement.operations) === null || _a === void 0 ? void 0 : _a.locked);
|
|
704
716
|
if ((groupQueue === null || groupQueue === void 0 ? void 0 : groupQueue.length) > 0) {
|
|
705
717
|
drawGroupQueueVertexesWrappers(overlayContext, groupQueueVertexesList, drawBaseOpts);
|
|
@@ -56,7 +56,3 @@ export declare function calcSelectedElementsArea(elements: Element<ElementType>[
|
|
|
56
56
|
calculator: ViewCalculator;
|
|
57
57
|
}): AreaSize | null;
|
|
58
58
|
export declare function isElementInGroup(elem: Element<ElementType>, group: Element<'group'>): boolean;
|
|
59
|
-
export declare function calcMoveInGroup(start: PointSize, end: PointSize, groupQueue: Element<'group'>[]): {
|
|
60
|
-
moveX: number;
|
|
61
|
-
moveY: number;
|
|
62
|
-
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { calcElementCenter, rotateElementVertexes, calcElementVertexesInGroup, calcElementQueueVertexesQueueInGroup, calcViewPointSize, calcViewElementSize,
|
|
1
|
+
import { calcElementCenter, rotateElementVertexes, calcElementVertexesInGroup, calcElementQueueVertexesQueueInGroup, calcViewPointSize, calcViewElementSize, rotatePoint, parseAngleToRadian, parseRadianToAngle, limitAngle, calcRadian } from '@idraw/util';
|
|
2
2
|
function parseRadian(angle) {
|
|
3
3
|
return (angle * Math.PI) / 180;
|
|
4
4
|
}
|
|
@@ -39,7 +39,7 @@ export function isPointInViewActiveGroup(p, opts) {
|
|
|
39
39
|
return isPointInViewActiveVertexes(p, { ctx, vertexes, viewScaleInfo, viewSizeInfo });
|
|
40
40
|
}
|
|
41
41
|
export function getPointTarget(p, opts) {
|
|
42
|
-
var _a, _b, _c;
|
|
42
|
+
var _a, _b, _c, _d, _e;
|
|
43
43
|
const target = {
|
|
44
44
|
type: null,
|
|
45
45
|
elements: [],
|
|
@@ -50,7 +50,10 @@ export function getPointTarget(p, opts) {
|
|
|
50
50
|
const { ctx, data, calculator, selectedElements, viewScaleInfo, viewSizeInfo, areaSize, groupQueue, selectedElementController } = opts;
|
|
51
51
|
if (selectedElementController) {
|
|
52
52
|
const { left, right, top, bottom, topLeft, topRight, bottomLeft, bottomRight, rotate } = selectedElementController;
|
|
53
|
-
const ctrls = [left, right, top, bottom, topLeft, topRight, bottomLeft, bottomRight
|
|
53
|
+
const ctrls = [left, right, top, bottom, topLeft, topRight, bottomLeft, bottomRight];
|
|
54
|
+
if ((selectedElements === null || selectedElements === void 0 ? void 0 : selectedElements.length) === 1 && ((_b = (_a = selectedElements === null || selectedElements === void 0 ? void 0 : selectedElements[0]) === null || _a === void 0 ? void 0 : _a.operations) === null || _b === void 0 ? void 0 : _b.rotatable) !== false) {
|
|
55
|
+
ctrls.push(rotate);
|
|
56
|
+
}
|
|
54
57
|
for (let i = 0; i < ctrls.length; i++) {
|
|
55
58
|
const ctrl = ctrls[i];
|
|
56
59
|
if (isPointInViewActiveVertexes(p, { ctx, vertexes: ctrl.vertexes, viewSizeInfo, viewScaleInfo })) {
|
|
@@ -65,7 +68,7 @@ export function getPointTarget(p, opts) {
|
|
|
65
68
|
}
|
|
66
69
|
if (groupQueue && Array.isArray(groupQueue) && groupQueue.length > 0) {
|
|
67
70
|
const lastGroup = groupQueue[groupQueue.length - 1];
|
|
68
|
-
if (((
|
|
71
|
+
if (((_c = lastGroup === null || lastGroup === void 0 ? void 0 : lastGroup.detail) === null || _c === void 0 ? void 0 : _c.children) && Array.isArray((_d = lastGroup === null || lastGroup === void 0 ? void 0 : lastGroup.detail) === null || _d === void 0 ? void 0 : _d.children)) {
|
|
69
72
|
for (let i = lastGroup.detail.children.length - 1; i >= 0; i--) {
|
|
70
73
|
const child = lastGroup.detail.children[i];
|
|
71
74
|
const vertexes = calcElementVertexesInGroup(child, { groupQueue });
|
|
@@ -94,7 +97,7 @@ export function getPointTarget(p, opts) {
|
|
|
94
97
|
}
|
|
95
98
|
if (data) {
|
|
96
99
|
const { index, element } = calculator.getPointElement(p, { data, viewScaleInfo, viewSizeInfo });
|
|
97
|
-
if (index >= 0 && element && ((
|
|
100
|
+
if (index >= 0 && element && ((_e = element === null || element === void 0 ? void 0 : element.operations) === null || _e === void 0 ? void 0 : _e.invisible) !== true) {
|
|
98
101
|
target.elements = [element];
|
|
99
102
|
target.type = 'over-element';
|
|
100
103
|
return target;
|
|
@@ -784,28 +787,3 @@ export function isElementInGroup(elem, group) {
|
|
|
784
787
|
}
|
|
785
788
|
return false;
|
|
786
789
|
}
|
|
787
|
-
export function calcMoveInGroup(start, end, groupQueue) {
|
|
788
|
-
let moveX = end.x - start.x;
|
|
789
|
-
let moveY = end.y - start.y;
|
|
790
|
-
const pointGroupQueue = [];
|
|
791
|
-
groupQueue.forEach((group) => {
|
|
792
|
-
const { x, y, w, h, angle = 0 } = group;
|
|
793
|
-
pointGroupQueue.push({
|
|
794
|
-
x,
|
|
795
|
-
y,
|
|
796
|
-
w,
|
|
797
|
-
h,
|
|
798
|
-
angle: 0 - angle
|
|
799
|
-
});
|
|
800
|
-
});
|
|
801
|
-
if ((groupQueue === null || groupQueue === void 0 ? void 0 : groupQueue.length) > 0) {
|
|
802
|
-
const startInGroup = rotatePointInGroup(start, pointGroupQueue);
|
|
803
|
-
const endInGroup = rotatePointInGroup(end, pointGroupQueue);
|
|
804
|
-
moveX = endInGroup.x - startInGroup.x;
|
|
805
|
-
moveY = endInGroup.y - startInGroup.y;
|
|
806
|
-
}
|
|
807
|
-
return {
|
|
808
|
-
moveX,
|
|
809
|
-
moveY
|
|
810
|
-
};
|
|
811
|
-
}
|
package/dist/index.global.js
CHANGED
|
@@ -1272,6 +1272,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1272
1272
|
_loop(elements);
|
|
1273
1273
|
return positionMap;
|
|
1274
1274
|
}
|
|
1275
|
+
function isSameElementSize(elem1, elem2) {
|
|
1276
|
+
return elem1.x === elem2.x && elem1.y === elem2.y && elem1.h === elem2.h && elem1.w === elem2.w && limitAngle(elem1.angle || 0) === limitAngle(elem2.angle || 0);
|
|
1277
|
+
}
|
|
1275
1278
|
function getElementVertexes(elemSize) {
|
|
1276
1279
|
const { x: x2, y: y2, h: h2, w: w2 } = elemSize;
|
|
1277
1280
|
return [
|
|
@@ -1755,6 +1758,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1755
1758
|
});
|
|
1756
1759
|
const rotateVertexes2 = calcElementVertexes(rotateSize);
|
|
1757
1760
|
const sizeController = {
|
|
1761
|
+
originalElementCenter: calcElementCenter(elemSize),
|
|
1762
|
+
originalElementSize: Object.assign({}, elemSize),
|
|
1758
1763
|
elementWrapper: vertexes,
|
|
1759
1764
|
left: {
|
|
1760
1765
|
type: "left",
|
|
@@ -2142,6 +2147,31 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2142
2147
|
}
|
|
2143
2148
|
return t;
|
|
2144
2149
|
});
|
|
2150
|
+
function calcPointMoveElementInGroup(start, end, groupQueue) {
|
|
2151
|
+
let moveX = end.x - start.x;
|
|
2152
|
+
let moveY = end.y - start.y;
|
|
2153
|
+
const pointGroupQueue = [];
|
|
2154
|
+
groupQueue.forEach((group) => {
|
|
2155
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 = 0 } = group;
|
|
2156
|
+
pointGroupQueue.push({
|
|
2157
|
+
x: x2,
|
|
2158
|
+
y: y2,
|
|
2159
|
+
w: w2,
|
|
2160
|
+
h: h2,
|
|
2161
|
+
angle: 0 - angle2
|
|
2162
|
+
});
|
|
2163
|
+
});
|
|
2164
|
+
if ((groupQueue === null || groupQueue === void 0 ? void 0 : groupQueue.length) > 0) {
|
|
2165
|
+
const startInGroup = rotatePointInGroup(start, pointGroupQueue);
|
|
2166
|
+
const endInGroup = rotatePointInGroup(end, pointGroupQueue);
|
|
2167
|
+
moveX = endInGroup.x - startInGroup.x;
|
|
2168
|
+
moveY = endInGroup.y - startInGroup.y;
|
|
2169
|
+
}
|
|
2170
|
+
return {
|
|
2171
|
+
moveX,
|
|
2172
|
+
moveY
|
|
2173
|
+
};
|
|
2174
|
+
}
|
|
2145
2175
|
function createColorStyle(ctx, color2, opts) {
|
|
2146
2176
|
if (typeof color2 === "string") {
|
|
2147
2177
|
return color2;
|
|
@@ -4792,6 +4822,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4792
4822
|
}
|
|
4793
4823
|
}
|
|
4794
4824
|
function drawSelectedElementControllersVertexes(ctx, controller, opts) {
|
|
4825
|
+
var _a;
|
|
4795
4826
|
if (!controller) {
|
|
4796
4827
|
return;
|
|
4797
4828
|
}
|
|
@@ -4799,8 +4830,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4799
4830
|
hideControllers,
|
|
4800
4831
|
style,
|
|
4801
4832
|
rotateControllerPattern,
|
|
4802
|
-
viewSizeInfo
|
|
4803
|
-
|
|
4833
|
+
viewSizeInfo,
|
|
4834
|
+
element
|
|
4835
|
+
// calculator, viewScaleInfo, viewSizeInfo
|
|
4804
4836
|
} = opts;
|
|
4805
4837
|
const { devicePixelRatio = 1 } = viewSizeInfo;
|
|
4806
4838
|
const { activeColor: activeColor2 } = style;
|
|
@@ -4813,19 +4845,21 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4813
4845
|
drawVertexes(ctx, calcViewVertexes(topRight.vertexes, opts), ctrlOpts);
|
|
4814
4846
|
drawVertexes(ctx, calcViewVertexes(bottomLeft.vertexes, opts), ctrlOpts);
|
|
4815
4847
|
drawVertexes(ctx, calcViewVertexes(bottomRight.vertexes, opts), ctrlOpts);
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4848
|
+
if (((_a = element == null ? void 0 : element.operations) == null ? void 0 : _a.rotatable) !== false) {
|
|
4849
|
+
drawCircleController(ctx, calcViewPointSize(rotate.center, opts), { ...ctrlOpts, size: rotate.size, borderWidth: 0 });
|
|
4850
|
+
const rotateCenter = calcViewPointSize(rotate.center, opts);
|
|
4851
|
+
ctx.drawImage(
|
|
4852
|
+
rotateControllerPattern.canvas,
|
|
4853
|
+
0,
|
|
4854
|
+
0,
|
|
4855
|
+
rotateControllerPattern.canvas.width / devicePixelRatio,
|
|
4856
|
+
rotateControllerPattern.canvas.height / devicePixelRatio,
|
|
4857
|
+
rotateCenter.x - rotate.size / 2,
|
|
4858
|
+
rotateCenter.y - rotate.size / 2,
|
|
4859
|
+
rotate.size,
|
|
4860
|
+
rotate.size
|
|
4861
|
+
);
|
|
4862
|
+
}
|
|
4829
4863
|
}
|
|
4830
4864
|
}
|
|
4831
4865
|
function drawArea(ctx, opts) {
|
|
@@ -4940,7 +4974,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4940
4974
|
return isPointInViewActiveVertexes(p, { ctx, vertexes, viewScaleInfo, viewSizeInfo });
|
|
4941
4975
|
}
|
|
4942
4976
|
function getPointTarget(p, opts) {
|
|
4943
|
-
var _a, _b, _c;
|
|
4977
|
+
var _a, _b, _c, _d, _e;
|
|
4944
4978
|
const target = {
|
|
4945
4979
|
type: null,
|
|
4946
4980
|
elements: [],
|
|
@@ -4951,7 +4985,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4951
4985
|
const { ctx, data, calculator, selectedElements, viewScaleInfo, viewSizeInfo, areaSize, groupQueue, selectedElementController } = opts;
|
|
4952
4986
|
if (selectedElementController) {
|
|
4953
4987
|
const { left, right, top, bottom, topLeft, topRight, bottomLeft, bottomRight, rotate } = selectedElementController;
|
|
4954
|
-
const ctrls = [left, right, top, bottom, topLeft, topRight, bottomLeft, bottomRight
|
|
4988
|
+
const ctrls = [left, right, top, bottom, topLeft, topRight, bottomLeft, bottomRight];
|
|
4989
|
+
if ((selectedElements == null ? void 0 : selectedElements.length) === 1 && ((_b = (_a = selectedElements == null ? void 0 : selectedElements[0]) == null ? void 0 : _a.operations) == null ? void 0 : _b.rotatable) !== false) {
|
|
4990
|
+
ctrls.push(rotate);
|
|
4991
|
+
}
|
|
4955
4992
|
for (let i = 0; i < ctrls.length; i++) {
|
|
4956
4993
|
const ctrl = ctrls[i];
|
|
4957
4994
|
if (isPointInViewActiveVertexes(p, { ctx, vertexes: ctrl.vertexes, viewSizeInfo, viewScaleInfo })) {
|
|
@@ -4966,7 +5003,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4966
5003
|
}
|
|
4967
5004
|
if (groupQueue && Array.isArray(groupQueue) && groupQueue.length > 0) {
|
|
4968
5005
|
const lastGroup = groupQueue[groupQueue.length - 1];
|
|
4969
|
-
if (((
|
|
5006
|
+
if (((_c = lastGroup == null ? void 0 : lastGroup.detail) == null ? void 0 : _c.children) && Array.isArray((_d = lastGroup == null ? void 0 : lastGroup.detail) == null ? void 0 : _d.children)) {
|
|
4970
5007
|
for (let i = lastGroup.detail.children.length - 1; i >= 0; i--) {
|
|
4971
5008
|
const child = lastGroup.detail.children[i];
|
|
4972
5009
|
const vertexes = calcElementVertexesInGroup(child, { groupQueue });
|
|
@@ -4995,7 +5032,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4995
5032
|
}
|
|
4996
5033
|
if (data) {
|
|
4997
5034
|
const { index, element } = calculator.getPointElement(p, { data, viewScaleInfo, viewSizeInfo });
|
|
4998
|
-
if (index >= 0 && element && ((
|
|
5035
|
+
if (index >= 0 && element && ((_e = element == null ? void 0 : element.operations) == null ? void 0 : _e.invisible) !== true) {
|
|
4999
5036
|
target.elements = [element];
|
|
5000
5037
|
target.type = "over-element";
|
|
5001
5038
|
return target;
|
|
@@ -5643,31 +5680,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5643
5680
|
}
|
|
5644
5681
|
return false;
|
|
5645
5682
|
}
|
|
5646
|
-
function calcMoveInGroup(start, end, groupQueue) {
|
|
5647
|
-
let moveX = end.x - start.x;
|
|
5648
|
-
let moveY = end.y - start.y;
|
|
5649
|
-
const pointGroupQueue = [];
|
|
5650
|
-
groupQueue.forEach((group) => {
|
|
5651
|
-
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 = 0 } = group;
|
|
5652
|
-
pointGroupQueue.push({
|
|
5653
|
-
x: x2,
|
|
5654
|
-
y: y2,
|
|
5655
|
-
w: w2,
|
|
5656
|
-
h: h2,
|
|
5657
|
-
angle: 0 - angle2
|
|
5658
|
-
});
|
|
5659
|
-
});
|
|
5660
|
-
if ((groupQueue == null ? void 0 : groupQueue.length) > 0) {
|
|
5661
|
-
const startInGroup = rotatePointInGroup(start, pointGroupQueue);
|
|
5662
|
-
const endInGroup = rotatePointInGroup(end, pointGroupQueue);
|
|
5663
|
-
moveX = endInGroup.x - startInGroup.x;
|
|
5664
|
-
moveY = endInGroup.y - startInGroup.y;
|
|
5665
|
-
}
|
|
5666
|
-
return {
|
|
5667
|
-
moveX,
|
|
5668
|
-
moveY
|
|
5669
|
-
};
|
|
5670
|
-
}
|
|
5671
5683
|
const unitSize = 2;
|
|
5672
5684
|
function getViewBoxInfo(rectInfo) {
|
|
5673
5685
|
const boxInfo = {
|
|
@@ -6669,6 +6681,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6669
6681
|
eventHub.off(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, showInfoAngleCallback);
|
|
6670
6682
|
},
|
|
6671
6683
|
beforeDrawFrame({ snapshot }) {
|
|
6684
|
+
var _a;
|
|
6672
6685
|
const { sharedStore } = snapshot;
|
|
6673
6686
|
const selectedElementList = sharedStore[keySelectedElementList];
|
|
6674
6687
|
const actionType = sharedStore[keyActionType];
|
|
@@ -6746,18 +6759,20 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6746
6759
|
style
|
|
6747
6760
|
});
|
|
6748
6761
|
if (showAngleInfo) {
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6762
|
+
if (((_a = elem.operations) == null ? void 0 : _a.rotatable) !== false) {
|
|
6763
|
+
drawAngleInfoText(overlayContext, {
|
|
6764
|
+
point: {
|
|
6765
|
+
x: rectInfo.top.x + infoFontSize + 4,
|
|
6766
|
+
y: rectInfo.top.y - infoFontSize * 2 - 18
|
|
6767
|
+
},
|
|
6768
|
+
rotateCenter: rectInfo.center,
|
|
6769
|
+
angle: totalAngle,
|
|
6770
|
+
text: angleText,
|
|
6771
|
+
fontSize: infoFontSize,
|
|
6772
|
+
lineHeight: infoLineHeight,
|
|
6773
|
+
style
|
|
6774
|
+
});
|
|
6775
|
+
}
|
|
6761
6776
|
}
|
|
6762
6777
|
}
|
|
6763
6778
|
}
|
|
@@ -7112,7 +7127,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7112
7127
|
inBusyMode = "drag";
|
|
7113
7128
|
eventHub.trigger(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, { show: false });
|
|
7114
7129
|
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) {
|
|
7115
|
-
const { moveX, moveY } =
|
|
7130
|
+
const { moveX, moveY } = calcPointMoveElementInGroup(originalStart, end, groupQueue);
|
|
7116
7131
|
let totalMoveX = calculator.toGridNum(moveX / scale);
|
|
7117
7132
|
let totalMoveY = calculator.toGridNum(moveY / scale);
|
|
7118
7133
|
if (enableSnapToGrid === true) {
|
|
@@ -7434,7 +7449,19 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7434
7449
|
const isMoving = sharedStore[keyIsMoving];
|
|
7435
7450
|
const enableSnapToGrid = sharedStore[keyEnableSnapToGrid];
|
|
7436
7451
|
const drawBaseOpts = { calculator, viewScaleInfo, viewSizeInfo, style };
|
|
7437
|
-
|
|
7452
|
+
let selectedElementController = sharedStore[keySelectedElementController];
|
|
7453
|
+
if (selectedElementController && selectedElements.length === 1 && elem) {
|
|
7454
|
+
if (!isSameElementSize(elem, selectedElementController.originalElementSize)) {
|
|
7455
|
+
selectedElementController = calcElementSizeController(elem, {
|
|
7456
|
+
groupQueue: groupQueue || [],
|
|
7457
|
+
controllerSize: controllerSize$1,
|
|
7458
|
+
viewScaleInfo,
|
|
7459
|
+
rotateControllerPosition,
|
|
7460
|
+
rotateControllerSize
|
|
7461
|
+
});
|
|
7462
|
+
sharer2.setSharedStorage(keySelectedElementController, selectedElementController);
|
|
7463
|
+
}
|
|
7464
|
+
}
|
|
7438
7465
|
const isHoverLocked = !!((_a = hoverElement == null ? void 0 : hoverElement.operations) == null ? void 0 : _a.locked);
|
|
7439
7466
|
if ((groupQueue == null ? void 0 : groupQueue.length) > 0) {
|
|
7440
7467
|
drawGroupQueueVertexesWrappers(overlayContext, groupQueueVertexesList, drawBaseOpts);
|