@idraw/util 0.4.0-beta.39 → 0.4.0-beta.40
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 -3
- package/dist/esm/index.js +5 -3
- package/dist/esm/lib/box.d.ts +2 -0
- package/dist/esm/lib/box.js +173 -0
- package/dist/esm/lib/canvas.d.ts +1 -7
- package/dist/esm/lib/canvas.js +25 -72
- package/dist/esm/lib/color.js +9 -6
- package/dist/esm/lib/context2d.d.ts +2 -0
- package/dist/esm/lib/context2d.js +6 -0
- package/dist/esm/lib/data.d.ts +1 -0
- package/dist/esm/lib/data.js +19 -2
- package/dist/esm/lib/is.d.ts +2 -0
- package/dist/esm/lib/is.js +21 -5
- package/dist/esm/lib/merge.d.ts +1 -0
- package/dist/esm/lib/merge.js +17 -0
- package/dist/esm/lib/omit.d.ts +1 -0
- package/dist/esm/lib/omit.js +7 -0
- package/dist/esm/lib/view-box.js +2 -1
- package/dist/esm/lib/view-calc.d.ts +1 -5
- package/dist/esm/lib/view-calc.js +0 -44
- package/dist/index.global.js +357 -244
- package/dist/index.global.min.js +1 -1
- package/package.json +2 -2
- package/dist/esm/lib/view-visible.d.ts +0 -21
- package/dist/esm/lib/view-visible.js +0 -93
package/dist/index.global.js
CHANGED
|
@@ -143,13 +143,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
143
143
|
downloadLink = null;
|
|
144
144
|
}
|
|
145
145
|
function toColorHexNum(color2) {
|
|
146
|
-
return parseInt(color2.replace(
|
|
146
|
+
return parseInt(color2.replace(/^#/, "0x"));
|
|
147
147
|
}
|
|
148
148
|
function toColorHexStr(color2) {
|
|
149
149
|
return "#" + color2.toString(16);
|
|
150
150
|
}
|
|
151
151
|
function isColorStr(color2) {
|
|
152
|
-
return typeof color2 === "string" && (
|
|
152
|
+
return typeof color2 === "string" && (/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(color2) || /^[a-z]{1,}$/i.test(color2));
|
|
153
153
|
}
|
|
154
154
|
const colorNameMap = {
|
|
155
155
|
aliceblue: "#f0f8ff",
|
|
@@ -306,6 +306,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
306
306
|
let css = "transparent";
|
|
307
307
|
if (typeof color2 === "string") {
|
|
308
308
|
css = color2;
|
|
309
|
+
} else if ((color2 == null ? void 0 : color2.stops.length) === 1) {
|
|
310
|
+
css = color2.stops[0].color;
|
|
309
311
|
} else if ((color2 == null ? void 0 : color2.type) === "linear-gradient") {
|
|
310
312
|
const items = [];
|
|
311
313
|
if (typeof color2.angle === "number") {
|
|
@@ -353,13 +355,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
353
355
|
return hex;
|
|
354
356
|
}
|
|
355
357
|
let hexAlpha = 1;
|
|
356
|
-
const regHex1 =
|
|
357
|
-
const regHex2 =
|
|
358
|
+
const regHex1 = /^#[0-9a-f]{6,6}$/i;
|
|
359
|
+
const regHex2 = /^#[0-9a-f]{8,8}$/i;
|
|
358
360
|
let result = hex;
|
|
359
361
|
if (regHex1.test(hex)) {
|
|
360
|
-
hexAlpha = parseInt(hex.substring(5, 7).replace(
|
|
362
|
+
hexAlpha = parseInt(hex.substring(5, 7).replace(/^#/, "0x"));
|
|
361
363
|
} else if (regHex2.test(hex)) {
|
|
362
|
-
hexAlpha = parseInt(hex.substring(7, 9).replace(
|
|
364
|
+
hexAlpha = parseInt(hex.substring(7, 9).replace(/^#/, "0x"));
|
|
363
365
|
result = hex.substring(0, 7);
|
|
364
366
|
}
|
|
365
367
|
hexAlpha = hexAlpha * alpha;
|
|
@@ -439,6 +441,15 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
439
441
|
_resetUUID(elem);
|
|
440
442
|
return elem;
|
|
441
443
|
}
|
|
444
|
+
function deepCloneData(data) {
|
|
445
|
+
const { elements, ...restData } = data;
|
|
446
|
+
return {
|
|
447
|
+
...deepClone(restData),
|
|
448
|
+
...{
|
|
449
|
+
elements: elements.map((elem) => deepCloneElement(elem))
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
}
|
|
442
453
|
function is$1(target) {
|
|
443
454
|
return Object.prototype.toString.call(target).replace(/[\]|\[]{1,1}/gi, "").split(" ")[1];
|
|
444
455
|
}
|
|
@@ -688,6 +699,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
688
699
|
const image = await loadImage(dataURL);
|
|
689
700
|
return image;
|
|
690
701
|
}
|
|
702
|
+
function positiveNum(value) {
|
|
703
|
+
return typeof value === "number" && value >= 0;
|
|
704
|
+
}
|
|
691
705
|
function number(value) {
|
|
692
706
|
return typeof value === "number" && (value > 0 || value <= 0);
|
|
693
707
|
}
|
|
@@ -698,19 +712,19 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
698
712
|
return number(value);
|
|
699
713
|
}
|
|
700
714
|
function w(value) {
|
|
701
|
-
return
|
|
715
|
+
return positiveNum(value);
|
|
702
716
|
}
|
|
703
717
|
function h(value) {
|
|
704
|
-
return
|
|
718
|
+
return positiveNum(value);
|
|
705
719
|
}
|
|
706
720
|
function angle(value) {
|
|
707
721
|
return typeof value === "number" && value >= -360 && value <= 360;
|
|
708
722
|
}
|
|
709
723
|
function borderWidth(value) {
|
|
710
|
-
return
|
|
724
|
+
return positiveNum(value) || Array.isArray(value) && positiveNum(value[0]) && positiveNum(value[1]) && positiveNum(value[2]) && positiveNum(value[3]);
|
|
711
725
|
}
|
|
712
726
|
function borderRadius(value) {
|
|
713
|
-
return
|
|
727
|
+
return positiveNum(value) || Array.isArray(value) && positiveNum(value[0]) && positiveNum(value[1]) && positiveNum(value[2]) && positiveNum(value[3]);
|
|
714
728
|
}
|
|
715
729
|
function color(value) {
|
|
716
730
|
return isColorStr(value);
|
|
@@ -764,6 +778,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
764
778
|
return /^(-?\d+(?:\.\d+)?)$/.test(`${value}`);
|
|
765
779
|
}
|
|
766
780
|
const is = {
|
|
781
|
+
positiveNum,
|
|
767
782
|
x,
|
|
768
783
|
y,
|
|
769
784
|
w,
|
|
@@ -1048,16 +1063,33 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1048
1063
|
return __privateGet(this, _ctx).fill(...args);
|
|
1049
1064
|
}
|
|
1050
1065
|
arc(x2, y2, radius, startAngle, endAngle, anticlockwise) {
|
|
1051
|
-
return __privateGet(this, _ctx).arc(
|
|
1066
|
+
return __privateGet(this, _ctx).arc(
|
|
1067
|
+
this.$doPixelRatio(x2),
|
|
1068
|
+
this.$doPixelRatio(y2),
|
|
1069
|
+
this.$doPixelRatio(radius),
|
|
1070
|
+
startAngle,
|
|
1071
|
+
endAngle,
|
|
1072
|
+
anticlockwise
|
|
1073
|
+
);
|
|
1052
1074
|
}
|
|
1053
1075
|
rect(x2, y2, w2, h2) {
|
|
1054
1076
|
return __privateGet(this, _ctx).rect(this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(w2), this.$doPixelRatio(h2));
|
|
1055
1077
|
}
|
|
1056
1078
|
fillRect(x2, y2, w2, h2) {
|
|
1057
|
-
return __privateGet(this, _ctx).fillRect(
|
|
1079
|
+
return __privateGet(this, _ctx).fillRect(
|
|
1080
|
+
this.$doPixelRatio(x2),
|
|
1081
|
+
this.$doPixelRatio(y2),
|
|
1082
|
+
this.$doPixelRatio(w2),
|
|
1083
|
+
this.$doPixelRatio(h2)
|
|
1084
|
+
);
|
|
1058
1085
|
}
|
|
1059
1086
|
clearRect(x2, y2, w2, h2) {
|
|
1060
|
-
return __privateGet(this, _ctx).clearRect(
|
|
1087
|
+
return __privateGet(this, _ctx).clearRect(
|
|
1088
|
+
this.$doPixelRatio(x2),
|
|
1089
|
+
this.$doPixelRatio(y2),
|
|
1090
|
+
this.$doPixelRatio(w2),
|
|
1091
|
+
this.$doPixelRatio(h2)
|
|
1092
|
+
);
|
|
1061
1093
|
}
|
|
1062
1094
|
beginPath() {
|
|
1063
1095
|
return __privateGet(this, _ctx).beginPath();
|
|
@@ -1072,7 +1104,31 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1072
1104
|
return __privateGet(this, _ctx).moveTo(this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
1073
1105
|
}
|
|
1074
1106
|
arcTo(x1, y1, x2, y2, radius) {
|
|
1075
|
-
return __privateGet(this, _ctx).arcTo(
|
|
1107
|
+
return __privateGet(this, _ctx).arcTo(
|
|
1108
|
+
this.$doPixelRatio(x1),
|
|
1109
|
+
this.$doPixelRatio(y1),
|
|
1110
|
+
this.$doPixelRatio(x2),
|
|
1111
|
+
this.$doPixelRatio(y2),
|
|
1112
|
+
this.$doPixelRatio(radius)
|
|
1113
|
+
);
|
|
1114
|
+
}
|
|
1115
|
+
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x2, y2) {
|
|
1116
|
+
return __privateGet(this, _ctx).bezierCurveTo(
|
|
1117
|
+
this.$doPixelRatio(cp1x),
|
|
1118
|
+
this.$doPixelRatio(cp1y),
|
|
1119
|
+
this.$doPixelRatio(cp2x),
|
|
1120
|
+
this.$doPixelRatio(cp2y),
|
|
1121
|
+
this.$doPixelRatio(x2),
|
|
1122
|
+
this.$doPixelRatio(y2)
|
|
1123
|
+
);
|
|
1124
|
+
}
|
|
1125
|
+
quadraticCurveTo(cpx, cpy, x2, y2) {
|
|
1126
|
+
return __privateGet(this, _ctx).quadraticCurveTo(
|
|
1127
|
+
this.$doPixelRatio(cpx),
|
|
1128
|
+
this.$doPixelRatio(cpy),
|
|
1129
|
+
this.$doPixelRatio(x2),
|
|
1130
|
+
this.$doPixelRatio(y2)
|
|
1131
|
+
);
|
|
1076
1132
|
}
|
|
1077
1133
|
getLineDash() {
|
|
1078
1134
|
return __privateGet(this, _ctx).getLineDash();
|
|
@@ -1113,7 +1169,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1113
1169
|
this.$doPixelRatio(dh)
|
|
1114
1170
|
);
|
|
1115
1171
|
} else {
|
|
1116
|
-
return __privateGet(this, _ctx).drawImage(
|
|
1172
|
+
return __privateGet(this, _ctx).drawImage(
|
|
1173
|
+
image,
|
|
1174
|
+
this.$doPixelRatio(dx),
|
|
1175
|
+
this.$doPixelRatio(dy),
|
|
1176
|
+
this.$doPixelRatio(dw),
|
|
1177
|
+
this.$doPixelRatio(dh)
|
|
1178
|
+
);
|
|
1117
1179
|
}
|
|
1118
1180
|
}
|
|
1119
1181
|
createPattern(image, repetition) {
|
|
@@ -1173,7 +1235,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1173
1235
|
return __privateGet(this, _ctx).getTransform();
|
|
1174
1236
|
}
|
|
1175
1237
|
createLinearGradient(x0, y0, x1, y1) {
|
|
1176
|
-
return __privateGet(this, _ctx).createLinearGradient(
|
|
1238
|
+
return __privateGet(this, _ctx).createLinearGradient(
|
|
1239
|
+
this.$doPixelRatio(x0),
|
|
1240
|
+
this.$doPixelRatio(y0),
|
|
1241
|
+
this.$doPixelRatio(x1),
|
|
1242
|
+
this.$doPixelRatio(y1)
|
|
1243
|
+
);
|
|
1177
1244
|
}
|
|
1178
1245
|
createRadialGradient(x0, y0, r0, x1, y1, r1) {
|
|
1179
1246
|
return __privateGet(this, _ctx).createRadialGradient(
|
|
@@ -1215,83 +1282,37 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1215
1282
|
return context2d;
|
|
1216
1283
|
}
|
|
1217
1284
|
function createBoardContent(canvas, opts) {
|
|
1218
|
-
const { width, height, devicePixelRatio
|
|
1285
|
+
const { width, height, devicePixelRatio } = opts;
|
|
1219
1286
|
const ctxOpts = {
|
|
1220
1287
|
width,
|
|
1221
1288
|
height,
|
|
1222
1289
|
devicePixelRatio
|
|
1223
1290
|
};
|
|
1224
1291
|
const ctx = canvas.getContext("2d");
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
if (offscreen === true) {
|
|
1250
|
-
const viewContext = createOffscreenContext2D(ctxOpts);
|
|
1251
|
-
const overlayContext = createOffscreenContext2D(ctxOpts);
|
|
1252
|
-
const underlayContext = createOffscreenContext2D(ctxOpts);
|
|
1253
|
-
const boardContext = createContext2D({ ctx, ...ctxOpts });
|
|
1254
|
-
const drawView = () => {
|
|
1255
|
-
const { width: w2, height: h2 } = viewContext.$getSize();
|
|
1256
|
-
boardContext.clearRect(0, 0, w2, h2);
|
|
1257
|
-
boardContext.drawImage(underlayContext.canvas, 0, 0, w2, h2);
|
|
1258
|
-
boardContext.drawImage(viewContext.canvas, 0, 0, w2, h2);
|
|
1259
|
-
boardContext.drawImage(overlayContext.canvas, 0, 0, w2, h2);
|
|
1260
|
-
underlayContext.clearRect(0, 0, w2, h2);
|
|
1261
|
-
viewContext.clearRect(0, 0, w2, h2);
|
|
1262
|
-
overlayContext.clearRect(0, 0, w2, h2);
|
|
1263
|
-
};
|
|
1264
|
-
const content = {
|
|
1265
|
-
underlayContext,
|
|
1266
|
-
viewContext,
|
|
1267
|
-
overlayContext,
|
|
1268
|
-
boardContext,
|
|
1269
|
-
drawView
|
|
1270
|
-
};
|
|
1271
|
-
return content;
|
|
1272
|
-
} else {
|
|
1273
|
-
const viewContext = createContext2D(ctxOpts);
|
|
1274
|
-
const overlayContext = createContext2D(ctxOpts);
|
|
1275
|
-
const underlayContext = createContext2D(ctxOpts);
|
|
1276
|
-
const boardContext = createContext2D({ ctx, ...ctxOpts });
|
|
1277
|
-
const drawView = () => {
|
|
1278
|
-
boardContext.clearRect(0, 0, width, height);
|
|
1279
|
-
boardContext.drawImage(underlayContext.canvas, 0, 0, width, height);
|
|
1280
|
-
boardContext.drawImage(viewContext.canvas, 0, 0, width, height);
|
|
1281
|
-
boardContext.drawImage(overlayContext.canvas, 0, 0, width, height);
|
|
1282
|
-
underlayContext.clearRect(0, 0, width, height);
|
|
1283
|
-
viewContext.clearRect(0, 0, width, height);
|
|
1284
|
-
overlayContext.clearRect(0, 0, width, height);
|
|
1285
|
-
};
|
|
1286
|
-
const content = {
|
|
1287
|
-
underlayContext,
|
|
1288
|
-
viewContext,
|
|
1289
|
-
overlayContext,
|
|
1290
|
-
boardContext,
|
|
1291
|
-
drawView
|
|
1292
|
-
};
|
|
1293
|
-
return content;
|
|
1294
|
-
}
|
|
1292
|
+
const viewContext = createOffscreenContext2D(ctxOpts);
|
|
1293
|
+
const overlayContext = createOffscreenContext2D(ctxOpts);
|
|
1294
|
+
const underlayContext = createOffscreenContext2D(ctxOpts);
|
|
1295
|
+
const boardContext = createContext2D({ ctx, ...ctxOpts });
|
|
1296
|
+
const tempContext = createOffscreenContext2D(ctxOpts);
|
|
1297
|
+
const drawView = () => {
|
|
1298
|
+
const { width: w2, height: h2 } = viewContext.$getSize();
|
|
1299
|
+
boardContext.clearRect(0, 0, w2, h2);
|
|
1300
|
+
boardContext.drawImage(underlayContext.canvas, 0, 0, w2, h2);
|
|
1301
|
+
boardContext.drawImage(viewContext.canvas, 0, 0, w2, h2);
|
|
1302
|
+
boardContext.drawImage(overlayContext.canvas, 0, 0, w2, h2);
|
|
1303
|
+
underlayContext.clearRect(0, 0, w2, h2);
|
|
1304
|
+
viewContext.clearRect(0, 0, w2, h2);
|
|
1305
|
+
overlayContext.clearRect(0, 0, w2, h2);
|
|
1306
|
+
};
|
|
1307
|
+
const content = {
|
|
1308
|
+
underlayContext,
|
|
1309
|
+
viewContext,
|
|
1310
|
+
overlayContext,
|
|
1311
|
+
boardContext,
|
|
1312
|
+
tempContext,
|
|
1313
|
+
drawView
|
|
1314
|
+
};
|
|
1315
|
+
return content;
|
|
1295
1316
|
}
|
|
1296
1317
|
class EventEmitter {
|
|
1297
1318
|
constructor() {
|
|
@@ -1579,7 +1600,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1579
1600
|
let resultY = point.y;
|
|
1580
1601
|
groupQueue.forEach((group) => {
|
|
1581
1602
|
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 = 0 } = group;
|
|
1582
|
-
const center = calcElementCenter({ x: x2, y: y2, w: w2, h: h2
|
|
1603
|
+
const center = calcElementCenter({ x: x2, y: y2, w: w2, h: h2 });
|
|
1583
1604
|
const temp = rotatePoint(center, { x: resultX, y: resultY }, parseAngleToRadian(angle2));
|
|
1584
1605
|
resultX = temp.x;
|
|
1585
1606
|
resultY = temp.y;
|
|
@@ -2091,7 +2112,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2091
2112
|
if (angle2 === 0) {
|
|
2092
2113
|
return getElementVertexes(elemSize);
|
|
2093
2114
|
}
|
|
2094
|
-
return getElementRotateVertexes(elemSize, calcElementCenter({ x: x2, y: y2, w: w2, h: h2
|
|
2115
|
+
return getElementRotateVertexes(elemSize, calcElementCenter({ x: x2, y: y2, w: w2, h: h2 }), angle2);
|
|
2095
2116
|
}
|
|
2096
2117
|
function calcElementQueueVertexesQueueInGroup(groupQueue) {
|
|
2097
2118
|
const vesList = [];
|
|
@@ -2105,7 +2126,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2105
2126
|
totalY += y2;
|
|
2106
2127
|
let ves;
|
|
2107
2128
|
if (i === 0) {
|
|
2108
|
-
const elemSize = { x: totalX, y: totalY, w: w2, h: h2
|
|
2129
|
+
const elemSize = { x: totalX, y: totalY, w: w2, h: h2 };
|
|
2109
2130
|
ves = calcElementVertexes({ x: x2, y: y2, w: w2, h: h2, angle: angle2 });
|
|
2110
2131
|
rotateActionList.push({
|
|
2111
2132
|
center: calcElementCenter(elemSize),
|
|
@@ -2113,7 +2134,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2113
2134
|
radian: parseAngleToRadian(angle2)
|
|
2114
2135
|
});
|
|
2115
2136
|
} else {
|
|
2116
|
-
const elemSize = { x: totalX, y: totalY, w: w2, h: h2
|
|
2137
|
+
const elemSize = { x: totalX, y: totalY, w: w2, h: h2 };
|
|
2117
2138
|
ves = getElementVertexes(elemSize);
|
|
2118
2139
|
for (let aIdx = 0; aIdx < rotateActionList.length; aIdx++) {
|
|
2119
2140
|
const { center, radian } = rotateActionList[aIdx];
|
|
@@ -2303,7 +2324,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2303
2324
|
h: child.h,
|
|
2304
2325
|
angle: totalAngle + (child.angle || 0)
|
|
2305
2326
|
};
|
|
2306
|
-
if (isViewPointInElement(p, { context2d: ctx, element: elemSize, viewScaleInfo
|
|
2327
|
+
if (isViewPointInElement(p, { context2d: ctx, element: elemSize, viewScaleInfo })) {
|
|
2307
2328
|
result.element = child;
|
|
2308
2329
|
if (gIdx < groupQueue.length - 1 || child.type !== "group") {
|
|
2309
2330
|
result.groupQueueIndex = gIdx;
|
|
@@ -2328,7 +2349,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2328
2349
|
if (((_c = elem == null ? void 0 : elem.operations) == null ? void 0 : _c.invisible) === true) {
|
|
2329
2350
|
continue;
|
|
2330
2351
|
}
|
|
2331
|
-
if (isViewPointInElement(p, { context2d: ctx, element: elem, viewScaleInfo
|
|
2352
|
+
if (isViewPointInElement(p, { context2d: ctx, element: elem, viewScaleInfo })) {
|
|
2332
2353
|
result.index = i;
|
|
2333
2354
|
result.element = elem;
|
|
2334
2355
|
break;
|
|
@@ -2383,10 +2404,30 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2383
2404
|
return rectInfo;
|
|
2384
2405
|
}
|
|
2385
2406
|
function originRectInfoToRangeRectInfo(originRectInfo) {
|
|
2386
|
-
const rangeMaxX = Math.max(
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2407
|
+
const rangeMaxX = Math.max(
|
|
2408
|
+
originRectInfo.topLeft.x,
|
|
2409
|
+
originRectInfo.topRight.x,
|
|
2410
|
+
originRectInfo.bottomRight.x,
|
|
2411
|
+
originRectInfo.bottomLeft.x
|
|
2412
|
+
);
|
|
2413
|
+
const rangeMaxY = Math.max(
|
|
2414
|
+
originRectInfo.topLeft.y,
|
|
2415
|
+
originRectInfo.topRight.y,
|
|
2416
|
+
originRectInfo.bottomRight.y,
|
|
2417
|
+
originRectInfo.bottomLeft.y
|
|
2418
|
+
);
|
|
2419
|
+
const rangeMinX = Math.min(
|
|
2420
|
+
originRectInfo.topLeft.x,
|
|
2421
|
+
originRectInfo.topRight.x,
|
|
2422
|
+
originRectInfo.bottomRight.x,
|
|
2423
|
+
originRectInfo.bottomLeft.x
|
|
2424
|
+
);
|
|
2425
|
+
const rangeMinY = Math.min(
|
|
2426
|
+
originRectInfo.topLeft.y,
|
|
2427
|
+
originRectInfo.topRight.y,
|
|
2428
|
+
originRectInfo.bottomRight.y,
|
|
2429
|
+
originRectInfo.bottomLeft.y
|
|
2430
|
+
);
|
|
2390
2431
|
const rangeCenter = { x: originRectInfo.center.x, y: originRectInfo.center.y };
|
|
2391
2432
|
const rangeTopLeft = { x: rangeMinX, y: rangeMinY };
|
|
2392
2433
|
const rangeTopRight = { x: rangeMaxX, y: rangeMinY };
|
|
@@ -2425,10 +2466,30 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2425
2466
|
bottom: calcViewPointSize(bottom, { viewScaleInfo })
|
|
2426
2467
|
};
|
|
2427
2468
|
if (range === true) {
|
|
2428
|
-
const viewMaxX = Math.max(
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2469
|
+
const viewMaxX = Math.max(
|
|
2470
|
+
viewRectInfo.topLeft.x,
|
|
2471
|
+
viewRectInfo.topRight.x,
|
|
2472
|
+
viewRectInfo.bottomRight.x,
|
|
2473
|
+
viewRectInfo.bottomLeft.x
|
|
2474
|
+
);
|
|
2475
|
+
const viewMaxY = Math.max(
|
|
2476
|
+
viewRectInfo.topLeft.y,
|
|
2477
|
+
viewRectInfo.topRight.y,
|
|
2478
|
+
viewRectInfo.bottomRight.y,
|
|
2479
|
+
viewRectInfo.bottomLeft.y
|
|
2480
|
+
);
|
|
2481
|
+
const viewMinX = Math.min(
|
|
2482
|
+
viewRectInfo.topLeft.x,
|
|
2483
|
+
viewRectInfo.topRight.x,
|
|
2484
|
+
viewRectInfo.bottomRight.x,
|
|
2485
|
+
viewRectInfo.bottomLeft.x
|
|
2486
|
+
);
|
|
2487
|
+
const viewMinY = Math.min(
|
|
2488
|
+
viewRectInfo.topLeft.y,
|
|
2489
|
+
viewRectInfo.topRight.y,
|
|
2490
|
+
viewRectInfo.bottomRight.y,
|
|
2491
|
+
viewRectInfo.bottomLeft.y
|
|
2492
|
+
);
|
|
2432
2493
|
const rangeCenter = { x: viewRectInfo.center.x, y: viewRectInfo.center.y };
|
|
2433
2494
|
const rangeTopLeft = { x: viewMinX, y: viewMinY };
|
|
2434
2495
|
const rangeTopRight = { x: viewMaxX, y: viewMinY };
|
|
@@ -2453,142 +2514,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2453
2514
|
}
|
|
2454
2515
|
return viewRectInfo;
|
|
2455
2516
|
}
|
|
2456
|
-
function calcElementViewRectInfoMap(elemSize, opts) {
|
|
2457
|
-
const { groupQueue, viewScaleInfo } = opts;
|
|
2458
|
-
const originRectInfo = calcElementOriginRectInfo(elemSize, { groupQueue });
|
|
2459
|
-
const { center, top, bottom, left, right, topLeft, topRight, bottomLeft, bottomRight } = originRectInfo;
|
|
2460
|
-
const viewRectInfo = {
|
|
2461
|
-
center: calcViewPointSize(center, { viewScaleInfo }),
|
|
2462
|
-
topLeft: calcViewPointSize(topLeft, { viewScaleInfo }),
|
|
2463
|
-
topRight: calcViewPointSize(topRight, { viewScaleInfo }),
|
|
2464
|
-
bottomLeft: calcViewPointSize(bottomLeft, { viewScaleInfo }),
|
|
2465
|
-
bottomRight: calcViewPointSize(bottomRight, { viewScaleInfo }),
|
|
2466
|
-
top: calcViewPointSize(top, { viewScaleInfo }),
|
|
2467
|
-
right: calcViewPointSize(right, { viewScaleInfo }),
|
|
2468
|
-
left: calcViewPointSize(left, { viewScaleInfo }),
|
|
2469
|
-
bottom: calcViewPointSize(bottom, { viewScaleInfo })
|
|
2470
|
-
};
|
|
2471
|
-
const viewMaxX = Math.max(viewRectInfo.topLeft.x, viewRectInfo.topRight.x, viewRectInfo.bottomRight.x, viewRectInfo.bottomLeft.x);
|
|
2472
|
-
const viewMaxY = Math.max(viewRectInfo.topLeft.y, viewRectInfo.topRight.y, viewRectInfo.bottomRight.y, viewRectInfo.bottomLeft.y);
|
|
2473
|
-
const viewMinX = Math.min(viewRectInfo.topLeft.x, viewRectInfo.topRight.x, viewRectInfo.bottomRight.x, viewRectInfo.bottomLeft.x);
|
|
2474
|
-
const viewMinY = Math.min(viewRectInfo.topLeft.y, viewRectInfo.topRight.y, viewRectInfo.bottomRight.y, viewRectInfo.bottomLeft.y);
|
|
2475
|
-
const rangeCenter = { x: viewRectInfo.center.x, y: viewRectInfo.center.y };
|
|
2476
|
-
const rangeTopLeft = { x: viewMinX, y: viewMinY };
|
|
2477
|
-
const rangeTopRight = { x: viewMaxX, y: viewMinY };
|
|
2478
|
-
const rangeBottomRight = { x: viewMaxX, y: viewMaxY };
|
|
2479
|
-
const rangeBottomLeft = { x: viewMinX, y: viewMaxY };
|
|
2480
|
-
const rangeTop = getCenterFromTwoPoints(rangeTopLeft, rangeTopRight);
|
|
2481
|
-
const rangeBottom = getCenterFromTwoPoints(rangeBottomLeft, rangeBottomRight);
|
|
2482
|
-
const rangeLeft = getCenterFromTwoPoints(rangeTopLeft, rangeBottomLeft);
|
|
2483
|
-
const rangeRight = getCenterFromTwoPoints(rangeTopRight, rangeBottomRight);
|
|
2484
|
-
const rangeRectInfo = {
|
|
2485
|
-
center: rangeCenter,
|
|
2486
|
-
topLeft: rangeTopLeft,
|
|
2487
|
-
topRight: rangeTopRight,
|
|
2488
|
-
bottomLeft: rangeBottomLeft,
|
|
2489
|
-
bottomRight: rangeBottomRight,
|
|
2490
|
-
top: rangeTop,
|
|
2491
|
-
right: rangeRight,
|
|
2492
|
-
left: rangeLeft,
|
|
2493
|
-
bottom: rangeBottom
|
|
2494
|
-
};
|
|
2495
|
-
return {
|
|
2496
|
-
originRectInfo,
|
|
2497
|
-
// viewRectInfo,
|
|
2498
|
-
rangeRectInfo
|
|
2499
|
-
};
|
|
2500
|
-
}
|
|
2501
|
-
function sortElementsViewVisiableInfoMap(elements, opts) {
|
|
2502
|
-
const visibleInfoMap = {};
|
|
2503
|
-
const currentPosition = [];
|
|
2504
|
-
const _walk = (elem) => {
|
|
2505
|
-
const baseInfo = {
|
|
2506
|
-
isVisibleInView: true,
|
|
2507
|
-
isGroup: elem.type === "group",
|
|
2508
|
-
position: [...currentPosition]
|
|
2509
|
-
};
|
|
2510
|
-
let originRectInfo = null;
|
|
2511
|
-
const groupQueue = getGroupQueueByElementPosition(elements, currentPosition);
|
|
2512
|
-
originRectInfo = calcElementOriginRectInfo(elem, {
|
|
2513
|
-
groupQueue: groupQueue || []
|
|
2514
|
-
});
|
|
2515
|
-
visibleInfoMap[elem.uuid] = {
|
|
2516
|
-
...baseInfo,
|
|
2517
|
-
...{
|
|
2518
|
-
originRectInfo,
|
|
2519
|
-
rangeRectInfo: is.angle(elem.angle) ? originRectInfoToRangeRectInfo(originRectInfo) : originRectInfo
|
|
2520
|
-
}
|
|
2521
|
-
};
|
|
2522
|
-
if (elem.type === "group") {
|
|
2523
|
-
elem.detail.children.forEach((ele, i) => {
|
|
2524
|
-
currentPosition.push(i);
|
|
2525
|
-
_walk(ele);
|
|
2526
|
-
currentPosition.pop();
|
|
2527
|
-
});
|
|
2528
|
-
}
|
|
2529
|
-
};
|
|
2530
|
-
elements.forEach((elem, index) => {
|
|
2531
|
-
currentPosition.push(index);
|
|
2532
|
-
_walk(elem);
|
|
2533
|
-
currentPosition.pop();
|
|
2534
|
-
});
|
|
2535
|
-
return updateViewVisibleInfoMapStatus(visibleInfoMap, opts);
|
|
2536
|
-
}
|
|
2537
|
-
function isRangeRectInfoCollide(info1, info2) {
|
|
2538
|
-
const rect1MinX = Math.min(info1.topLeft.x, info1.topRight.x, info1.bottomLeft.x, info1.bottomRight.x);
|
|
2539
|
-
const rect1MaxX = Math.max(info1.topLeft.x, info1.topRight.x, info1.bottomLeft.x, info1.bottomRight.x);
|
|
2540
|
-
const rect1MinY = Math.min(info1.topLeft.y, info1.topRight.y, info1.bottomLeft.y, info1.bottomRight.y);
|
|
2541
|
-
const rect1MaxY = Math.max(info1.topLeft.y, info1.topRight.y, info1.bottomLeft.y, info1.bottomRight.y);
|
|
2542
|
-
const rect2MinX = Math.min(info2.topLeft.x, info2.topRight.x, info2.bottomLeft.x, info2.bottomRight.x);
|
|
2543
|
-
const rect2MaxX = Math.max(info2.topLeft.x, info2.topRight.x, info2.bottomLeft.x, info2.bottomRight.x);
|
|
2544
|
-
const rect2MinY = Math.min(info2.topLeft.y, info2.topRight.y, info2.bottomLeft.y, info2.bottomRight.y);
|
|
2545
|
-
const rect2MaxY = Math.max(info2.topLeft.y, info2.topRight.y, info2.bottomLeft.y, info2.bottomRight.y);
|
|
2546
|
-
if (rect1MinX <= rect2MaxX && rect1MaxX >= rect2MinX && rect1MinY <= rect2MaxY && rect1MaxY >= rect2MinY || rect2MaxX <= rect1MaxY && rect2MaxX >= rect1MaxY && rect2MaxX <= rect1MaxY && rect2MaxX >= rect1MaxY) {
|
|
2547
|
-
return true;
|
|
2548
|
-
}
|
|
2549
|
-
return false;
|
|
2550
|
-
}
|
|
2551
|
-
function updateViewVisibleInfoMapStatus(viewVisibleInfoMap, opts) {
|
|
2552
|
-
const canvasRectInfo = calcVisibleOriginCanvasRectInfo(opts);
|
|
2553
|
-
let visibleCount = 0;
|
|
2554
|
-
let invisibleCount = 0;
|
|
2555
|
-
Object.keys(viewVisibleInfoMap).forEach((uuid) => {
|
|
2556
|
-
const info = viewVisibleInfoMap[uuid];
|
|
2557
|
-
info.isVisibleInView = isRangeRectInfoCollide(info.rangeRectInfo, canvasRectInfo);
|
|
2558
|
-
info.isVisibleInView ? visibleCount++ : invisibleCount++;
|
|
2559
|
-
});
|
|
2560
|
-
return { viewVisibleInfoMap, visibleCount, invisibleCount };
|
|
2561
|
-
}
|
|
2562
|
-
function calcVisibleOriginCanvasRectInfo(opts) {
|
|
2563
|
-
const { viewScaleInfo, viewSizeInfo } = opts;
|
|
2564
|
-
const { scale, offsetTop, offsetLeft } = viewScaleInfo;
|
|
2565
|
-
const { width, height } = viewSizeInfo;
|
|
2566
|
-
const x2 = 0 - offsetLeft / scale;
|
|
2567
|
-
const y2 = 0 - offsetTop / scale;
|
|
2568
|
-
const w2 = width / scale;
|
|
2569
|
-
const h2 = height / scale;
|
|
2570
|
-
const center = calcElementCenter({ x: x2, y: y2, w: w2, h: h2 });
|
|
2571
|
-
const topLeft = { x: x2, y: y2 };
|
|
2572
|
-
const topRight = { x: x2 + w2, y: y2 };
|
|
2573
|
-
const bottomLeft = { x: x2, y: y2 + h2 };
|
|
2574
|
-
const bottomRight = { x: x2 + w2, y: y2 + h2 };
|
|
2575
|
-
const left = { x: x2, y: center.y };
|
|
2576
|
-
const top = { x: center.x, y: y2 };
|
|
2577
|
-
const right = { x: x2 + w2, y: center.y };
|
|
2578
|
-
const bottom = { x: center.x, y: y2 + h2 };
|
|
2579
|
-
const rectInfo = {
|
|
2580
|
-
center,
|
|
2581
|
-
topLeft,
|
|
2582
|
-
topRight,
|
|
2583
|
-
bottomLeft,
|
|
2584
|
-
bottomRight,
|
|
2585
|
-
left,
|
|
2586
|
-
top,
|
|
2587
|
-
right,
|
|
2588
|
-
bottom
|
|
2589
|
-
};
|
|
2590
|
-
return rectInfo;
|
|
2591
|
-
}
|
|
2592
2517
|
function createControllerElementSizeFromCenter(center, opts) {
|
|
2593
2518
|
const { x: x2, y: y2 } = center;
|
|
2594
2519
|
const { size, angle: angle2 } = opts;
|
|
@@ -2947,7 +2872,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2947
2872
|
const arr = [];
|
|
2948
2873
|
let current;
|
|
2949
2874
|
let level = -1;
|
|
2950
|
-
let inComponent = false;
|
|
2951
2875
|
html2.replace(elemRegExp, (element, index) => {
|
|
2952
2876
|
const isOpen = element.charAt(1) !== "/";
|
|
2953
2877
|
const isComment = element.startsWith("<!--");
|
|
@@ -2967,7 +2891,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2967
2891
|
if (isOpen) {
|
|
2968
2892
|
level++;
|
|
2969
2893
|
current = parseElement(element);
|
|
2970
|
-
if (!current.isVoid &&
|
|
2894
|
+
if (!current.isVoid && true && nextChar && nextChar !== "<") {
|
|
2971
2895
|
const content = html2.slice(start, html2.indexOf("<", start));
|
|
2972
2896
|
if (content.trim()) {
|
|
2973
2897
|
current.children.push({
|
|
@@ -3175,7 +3099,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3175
3099
|
function calcViewBoxSize(viewElem, opts) {
|
|
3176
3100
|
const { viewScaleInfo } = opts;
|
|
3177
3101
|
const { scale } = viewScaleInfo;
|
|
3178
|
-
let { borderRadius: borderRadius2
|
|
3102
|
+
let { borderRadius: borderRadius2 } = viewElem.detail;
|
|
3103
|
+
const { borderDash } = viewElem.detail;
|
|
3179
3104
|
const hasBorderDash = Array.isArray(borderDash) && borderDash.length > 0;
|
|
3180
3105
|
const { boxSizing = defaultElemConfig.boxSizing, borderWidth: borderWidth2 } = viewElem.detail;
|
|
3181
3106
|
if (Array.isArray(borderWidth2)) {
|
|
@@ -3992,6 +3917,194 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3992
3917
|
moveY
|
|
3993
3918
|
};
|
|
3994
3919
|
}
|
|
3920
|
+
function merge(target, source) {
|
|
3921
|
+
const result = target;
|
|
3922
|
+
for (const key in source) {
|
|
3923
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3924
|
+
if (typeof source[key] === "object" && source[key] !== null && typeof result[key] === "object" && result[key] !== null) {
|
|
3925
|
+
result[key] = merge(result[key], source[key]);
|
|
3926
|
+
} else {
|
|
3927
|
+
result[key] = source[key];
|
|
3928
|
+
}
|
|
3929
|
+
}
|
|
3930
|
+
}
|
|
3931
|
+
return target;
|
|
3932
|
+
}
|
|
3933
|
+
function omit(obj, keys) {
|
|
3934
|
+
const result = { ...obj };
|
|
3935
|
+
for (const key of keys) {
|
|
3936
|
+
delete result[key];
|
|
3937
|
+
}
|
|
3938
|
+
return result;
|
|
3939
|
+
}
|
|
3940
|
+
function elementToBoxInfo(elem) {
|
|
3941
|
+
const { x: x2, y: y2, w: w2, h: h2, detail } = elem;
|
|
3942
|
+
const { borderWidth: borderWidth2, borderRadius: borderRadius2, boxSizing } = detail;
|
|
3943
|
+
let btw = 0;
|
|
3944
|
+
let brw = 0;
|
|
3945
|
+
let bbw = 0;
|
|
3946
|
+
let blw = 0;
|
|
3947
|
+
let btlr = 0;
|
|
3948
|
+
let btrr = 0;
|
|
3949
|
+
let bblr = 0;
|
|
3950
|
+
let bbrr = 0;
|
|
3951
|
+
if (typeof borderWidth2 === "number" && borderWidth2 > 0) {
|
|
3952
|
+
btw = borderWidth2;
|
|
3953
|
+
brw = borderWidth2;
|
|
3954
|
+
bbw = borderWidth2;
|
|
3955
|
+
blw = borderWidth2;
|
|
3956
|
+
} else if (Array.isArray(borderWidth2)) {
|
|
3957
|
+
btw = is.positiveNum(borderWidth2[0]) ? borderWidth2[0] : 0;
|
|
3958
|
+
brw = is.positiveNum(borderWidth2[1]) ? borderWidth2[0] : 0;
|
|
3959
|
+
bbw = is.positiveNum(borderWidth2[2]) ? borderWidth2[0] : 0;
|
|
3960
|
+
blw = is.positiveNum(borderWidth2[3]) ? borderWidth2[0] : 0;
|
|
3961
|
+
}
|
|
3962
|
+
if (typeof borderRadius2 === "number" && borderRadius2 > 0) {
|
|
3963
|
+
btlr = borderRadius2;
|
|
3964
|
+
btrr = borderRadius2;
|
|
3965
|
+
bblr = borderRadius2;
|
|
3966
|
+
bbrr = borderRadius2;
|
|
3967
|
+
} else if (Array.isArray(borderRadius2)) {
|
|
3968
|
+
btlr = is.positiveNum(borderRadius2[0]) ? borderRadius2[0] : 0;
|
|
3969
|
+
btrr = is.positiveNum(borderRadius2[0]) ? borderRadius2[0] : 0;
|
|
3970
|
+
bblr = is.positiveNum(borderRadius2[0]) ? borderRadius2[0] : 0;
|
|
3971
|
+
bbrr = is.positiveNum(borderRadius2[0]) ? borderRadius2[0] : 0;
|
|
3972
|
+
}
|
|
3973
|
+
const p0 = { x: x2, y: y2 };
|
|
3974
|
+
const p1 = { x: x2 + w2, y: y2 };
|
|
3975
|
+
const p2 = { x: x2 + w2, y: y2 + h2 };
|
|
3976
|
+
const p3 = { x: x2, y: y2 + h2 };
|
|
3977
|
+
const p0s = { x: x2, y: y2 + btlr };
|
|
3978
|
+
const p0e = { x: x2 + btlr, y: y2 };
|
|
3979
|
+
const p1s = { x: x2 + w2 - btrr, y: y2 };
|
|
3980
|
+
const p1e = { x: x2 + w2, y: y2 + btrr };
|
|
3981
|
+
const p2s = { x: x2 + w2, y: y2 + h2 - bbrr };
|
|
3982
|
+
const p2e = { x: x2 + w2 - bbrr, y: y2 + h2 };
|
|
3983
|
+
const p3s = { x: x2 + bblr, y: y2 + h2 };
|
|
3984
|
+
const p3e = { x: x2, y: y2 + h2 - bblr };
|
|
3985
|
+
let op0 = { ...p0 };
|
|
3986
|
+
let op1 = { ...p1 };
|
|
3987
|
+
let op2 = { ...p2 };
|
|
3988
|
+
let op3 = { ...p3 };
|
|
3989
|
+
let op0s = { ...p0s };
|
|
3990
|
+
let op0e = { ...p0e };
|
|
3991
|
+
let op1s = { ...p1s };
|
|
3992
|
+
let op1e = { ...p1e };
|
|
3993
|
+
let op2s = { ...p2s };
|
|
3994
|
+
let op2e = { ...p2e };
|
|
3995
|
+
let op3s = { ...p3s };
|
|
3996
|
+
let op3e = { ...p3e };
|
|
3997
|
+
let ip0 = { ...p0 };
|
|
3998
|
+
let ip1 = { ...p1 };
|
|
3999
|
+
let ip2 = { ...p2 };
|
|
4000
|
+
let ip3 = { ...p3 };
|
|
4001
|
+
let ip0s = { ...p0s };
|
|
4002
|
+
let ip0e = { ...p0e };
|
|
4003
|
+
let ip1s = { ...p1s };
|
|
4004
|
+
let ip1e = { ...p1e };
|
|
4005
|
+
let ip2s = { ...p2s };
|
|
4006
|
+
let ip2e = { ...p2e };
|
|
4007
|
+
let ip3s = { ...p3s };
|
|
4008
|
+
let ip3e = { ...p3e };
|
|
4009
|
+
if (boxSizing === "border-box") {
|
|
4010
|
+
ip0 = { x: ip0.x + blw, y: ip0.y + btw };
|
|
4011
|
+
ip1 = { x: ip1.x - brw, y: ip1.y + btw };
|
|
4012
|
+
ip2 = { x: ip2.x - brw, y: ip2.y - bbw };
|
|
4013
|
+
ip3 = { x: ip3.x + blw, y: ip3.y - bbw };
|
|
4014
|
+
ip0s = { x: ip0s.x + blw, y: ip0s.y + btw };
|
|
4015
|
+
ip0e = { x: ip0e.x + blw, y: ip0e.y + btw };
|
|
4016
|
+
ip1s = { x: ip1s.x - brw, y: ip1s.y + btw };
|
|
4017
|
+
ip1e = { x: ip1e.x - brw, y: ip1e.y + btw };
|
|
4018
|
+
ip2s = { x: ip2s.x - brw, y: ip2s.y - bbw };
|
|
4019
|
+
ip2e = { x: ip2e.x - brw, y: ip2e.y - bbw };
|
|
4020
|
+
ip3s = { x: ip3s.x + blw, y: ip3s.y - bbw };
|
|
4021
|
+
ip3e = { x: ip3e.x + blw, y: ip3e.y - bbw };
|
|
4022
|
+
} else if (boxSizing === "content-box") {
|
|
4023
|
+
op0 = { x: op0.x - blw, y: op0.y - btw };
|
|
4024
|
+
op1 = { x: op1.x + brw, y: op1.y - btw };
|
|
4025
|
+
op2 = { x: op2.x + brw, y: op2.y + bbw };
|
|
4026
|
+
op3 = { x: op3.x - blw, y: op3.y + bbw };
|
|
4027
|
+
op0s = { x: op0s.x - blw, y: op0s.y - btw };
|
|
4028
|
+
op0e = { x: op0e.x - blw, y: op0e.y - btw };
|
|
4029
|
+
op1s = { x: op1s.x + brw, y: op1s.y - btw };
|
|
4030
|
+
op1e = { x: op1e.x + brw, y: op1e.y - btw };
|
|
4031
|
+
op2s = { x: op2s.x + brw, y: op2s.y + bbw };
|
|
4032
|
+
op2e = { x: op2e.x + brw, y: op2e.y + bbw };
|
|
4033
|
+
op3s = { x: op3s.x - blw, y: op3s.y + bbw };
|
|
4034
|
+
op3e = { x: op3e.x - blw, y: op3e.y + bbw };
|
|
4035
|
+
} else {
|
|
4036
|
+
ip0 = { x: ip0.x + blw / 2, y: ip0.y + btw / 2 };
|
|
4037
|
+
ip1 = { x: ip1.x - brw / 2, y: ip1.y + btw / 2 };
|
|
4038
|
+
ip2 = { x: ip2.x - brw / 2, y: ip2.y - bbw / 2 };
|
|
4039
|
+
ip3 = { x: ip3.x + blw / 2, y: ip3.y - bbw / 2 };
|
|
4040
|
+
ip0s = { x: ip0s.x + blw / 2, y: ip0s.y + btw / 2 };
|
|
4041
|
+
ip0e = { x: ip0e.x + blw / 2, y: ip0e.y + btw / 2 };
|
|
4042
|
+
ip1s = { x: ip1s.x - brw / 2, y: ip1s.y + btw / 2 };
|
|
4043
|
+
ip1e = { x: ip1e.x - brw / 2, y: ip1e.y + btw / 2 };
|
|
4044
|
+
ip2s = { x: ip2s.x - brw / 2, y: ip2s.y - bbw / 2 };
|
|
4045
|
+
ip2e = { x: ip2e.x - brw / 2, y: ip2e.y - bbw / 2 };
|
|
4046
|
+
ip3s = { x: ip3s.x + blw / 2, y: ip3s.y - bbw / 2 };
|
|
4047
|
+
ip3e = { x: ip3e.x + blw / 2, y: ip3e.y - bbw / 2 };
|
|
4048
|
+
op0 = { x: op0.x - blw / 2, y: op0.y - btw / 2 };
|
|
4049
|
+
op1 = { x: op1.x + brw / 2, y: op1.y - btw / 2 };
|
|
4050
|
+
op2 = { x: op2.x + brw / 2, y: op2.y + bbw / 2 };
|
|
4051
|
+
op3 = { x: op3.x - blw / 2, y: op3.y + bbw / 2 };
|
|
4052
|
+
op0s = { x: op0s.x - blw / 2, y: op0s.y - btw / 2 };
|
|
4053
|
+
op0e = { x: op0e.x - blw / 2, y: op0e.y - btw / 2 };
|
|
4054
|
+
op1s = { x: op1s.x + brw / 2, y: op1s.y - btw / 2 };
|
|
4055
|
+
op1e = { x: op1e.x + brw / 2, y: op1e.y - btw / 2 };
|
|
4056
|
+
op2s = { x: op2s.x + brw / 2, y: op2s.y + bbw / 2 };
|
|
4057
|
+
op2e = { x: op2e.x + brw / 2, y: op2e.y + bbw / 2 };
|
|
4058
|
+
op3s = { x: op3s.x - blw / 2, y: op3s.y + bbw / 2 };
|
|
4059
|
+
op3e = { x: op3e.x - blw / 2, y: op3e.y + bbw / 2 };
|
|
4060
|
+
}
|
|
4061
|
+
return {
|
|
4062
|
+
btw,
|
|
4063
|
+
brw,
|
|
4064
|
+
bbw,
|
|
4065
|
+
blw,
|
|
4066
|
+
btlr,
|
|
4067
|
+
btrr,
|
|
4068
|
+
bblr,
|
|
4069
|
+
bbrr,
|
|
4070
|
+
p0,
|
|
4071
|
+
p1,
|
|
4072
|
+
p2,
|
|
4073
|
+
p3,
|
|
4074
|
+
p0s,
|
|
4075
|
+
p0e,
|
|
4076
|
+
p1s,
|
|
4077
|
+
p1e,
|
|
4078
|
+
p2s,
|
|
4079
|
+
p2e,
|
|
4080
|
+
p3s,
|
|
4081
|
+
p3e,
|
|
4082
|
+
op0,
|
|
4083
|
+
op1,
|
|
4084
|
+
op2,
|
|
4085
|
+
op3,
|
|
4086
|
+
op0s,
|
|
4087
|
+
op0e,
|
|
4088
|
+
op1s,
|
|
4089
|
+
op1e,
|
|
4090
|
+
op2s,
|
|
4091
|
+
op2e,
|
|
4092
|
+
op3s,
|
|
4093
|
+
op3e,
|
|
4094
|
+
ip0,
|
|
4095
|
+
ip1,
|
|
4096
|
+
ip2,
|
|
4097
|
+
ip3,
|
|
4098
|
+
ip0s,
|
|
4099
|
+
ip0e,
|
|
4100
|
+
ip1s,
|
|
4101
|
+
ip1e,
|
|
4102
|
+
ip2s,
|
|
4103
|
+
ip2e,
|
|
4104
|
+
ip3s,
|
|
4105
|
+
ip3e
|
|
4106
|
+
};
|
|
4107
|
+
}
|
|
3995
4108
|
exports.Context2D = Context2D;
|
|
3996
4109
|
exports.EventEmitter = EventEmitter;
|
|
3997
4110
|
exports.Store = Store;
|
|
@@ -4005,7 +4118,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4005
4118
|
exports.calcElementVertexesInGroup = calcElementVertexesInGroup;
|
|
4006
4119
|
exports.calcElementVertexesQueueInGroup = calcElementVertexesQueueInGroup;
|
|
4007
4120
|
exports.calcElementViewRectInfo = calcElementViewRectInfo;
|
|
4008
|
-
exports.calcElementViewRectInfoMap = calcElementViewRectInfoMap;
|
|
4009
4121
|
exports.calcElementsContextSize = calcElementsContextSize;
|
|
4010
4122
|
exports.calcElementsViewInfo = calcElementsViewInfo;
|
|
4011
4123
|
exports.calcLayoutSizeController = calcLayoutSizeController;
|
|
@@ -4019,7 +4131,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4019
4131
|
exports.calcViewPointSize = calcViewPointSize;
|
|
4020
4132
|
exports.calcViewScaleInfo = calcViewScaleInfo;
|
|
4021
4133
|
exports.calcViewVertexes = calcViewVertexes;
|
|
4022
|
-
exports.calcVisibleOriginCanvasRectInfo = calcVisibleOriginCanvasRectInfo;
|
|
4023
4134
|
exports.check = check;
|
|
4024
4135
|
exports.checkRectIntersect = checkRectIntersect;
|
|
4025
4136
|
exports.colorNameToHex = colorNameToHex;
|
|
@@ -4035,6 +4146,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4035
4146
|
exports.createUUID = createUUID;
|
|
4036
4147
|
exports.debounce = debounce;
|
|
4037
4148
|
exports.deepClone = deepClone;
|
|
4149
|
+
exports.deepCloneData = deepCloneData;
|
|
4038
4150
|
exports.deepCloneElement = deepCloneElement;
|
|
4039
4151
|
exports.deepResizeGroupElement = deepResizeGroupElement;
|
|
4040
4152
|
exports.delay = delay;
|
|
@@ -4042,6 +4154,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4042
4154
|
exports.deleteElementInListByPosition = deleteElementInListByPosition;
|
|
4043
4155
|
exports.downloadFileFromText = downloadFileFromText;
|
|
4044
4156
|
exports.downloadImageFromCanvas = downloadImageFromCanvas;
|
|
4157
|
+
exports.elementToBoxInfo = elementToBoxInfo;
|
|
4045
4158
|
exports.enhanceFontFamliy = enhanceFontFamliy;
|
|
4046
4159
|
exports.equalPoint = equalPoint;
|
|
4047
4160
|
exports.equalTouchPoint = equalTouchPoint;
|
|
@@ -4090,10 +4203,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4090
4203
|
exports.loadSVG = loadSVG;
|
|
4091
4204
|
exports.matrixToAngle = matrixToAngle;
|
|
4092
4205
|
exports.matrixToRadian = matrixToRadian;
|
|
4206
|
+
exports.merge = merge;
|
|
4093
4207
|
exports.mergeElementAsset = mergeElementAsset;
|
|
4094
4208
|
exports.mergeHexColorAlpha = mergeHexColorAlpha;
|
|
4095
4209
|
exports.modifyElement = modifyElement;
|
|
4096
4210
|
exports.moveElementPosition = moveElementPosition;
|
|
4211
|
+
exports.omit = omit;
|
|
4097
4212
|
exports.originRectInfoToRangeRectInfo = originRectInfoToRangeRectInfo;
|
|
4098
4213
|
exports.parseAngleToRadian = parseAngleToRadian;
|
|
4099
4214
|
exports.parseFileToBase64 = parseFileToBase64;
|
|
@@ -4109,14 +4224,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4109
4224
|
exports.rotatePointInGroup = rotatePointInGroup;
|
|
4110
4225
|
exports.rotateVertexes = rotateVertexes;
|
|
4111
4226
|
exports.sortDataAsserts = sortDataAsserts;
|
|
4112
|
-
exports.sortElementsViewVisiableInfoMap = sortElementsViewVisiableInfoMap;
|
|
4113
4227
|
exports.throttle = throttle;
|
|
4114
4228
|
exports.toColorHexNum = toColorHexNum;
|
|
4115
4229
|
exports.toColorHexStr = toColorHexStr;
|
|
4116
4230
|
exports.ungroupElementsByPosition = ungroupElementsByPosition;
|
|
4117
4231
|
exports.updateElementInList = updateElementInList;
|
|
4118
4232
|
exports.updateElementInListByPosition = updateElementInListByPosition;
|
|
4119
|
-
exports.updateViewVisibleInfoMapStatus = updateViewVisibleInfoMapStatus;
|
|
4120
4233
|
exports.vaildPoint = vaildPoint;
|
|
4121
4234
|
exports.vaildTouchPoint = vaildTouchPoint;
|
|
4122
4235
|
exports.validateElements = validateElements;
|