@idraw/core 0.4.0-alpha.3 → 0.4.0-alpha.4
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 +3 -2
- package/dist/esm/index.js +5 -2
- package/dist/esm/middleware/ruler/index.d.ts +3 -0
- package/dist/esm/middleware/ruler/index.js +36 -0
- package/dist/esm/middleware/ruler/util.d.ts +33 -0
- package/dist/esm/middleware/ruler/util.js +179 -0
- package/dist/esm/middleware/scaler/index.d.ts +3 -2
- package/dist/esm/middleware/scaler/index.js +5 -1
- package/dist/esm/middleware/scroller/util.js +61 -54
- package/dist/esm/middleware/selector/draw-wrapper.js +0 -4
- package/dist/esm/middleware/selector/index.d.ts +1 -0
- package/dist/esm/middleware/selector/index.js +3 -2
- package/dist/index.global.js +750 -244
- package/dist/index.global.min.js +1 -1
- package/package.json +8 -7
package/dist/index.global.js
CHANGED
|
@@ -15,12 +15,58 @@ var iDrawCore = function(exports) {
|
|
|
15
15
|
function isColorStr(color2) {
|
|
16
16
|
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));
|
|
17
17
|
}
|
|
18
|
+
function mergeHexColorAlpha(hex, alpha) {
|
|
19
|
+
if (alpha === 1) {
|
|
20
|
+
return hex;
|
|
21
|
+
}
|
|
22
|
+
let hexAlpha = 1;
|
|
23
|
+
const regHex1 = /^\#[0-9a-f]{6,6}$/i;
|
|
24
|
+
const regHex2 = /^\#[0-9a-f]{8,8}$/i;
|
|
25
|
+
let result = hex;
|
|
26
|
+
if (regHex1.test(hex)) {
|
|
27
|
+
hexAlpha = parseInt(hex.substring(5, 7).replace(/^\#/, "0x"));
|
|
28
|
+
} else if (regHex2.test(hex)) {
|
|
29
|
+
hexAlpha = parseInt(hex.substring(7, 9).replace(/^\#/, "0x"));
|
|
30
|
+
result = hex.substring(0, 7);
|
|
31
|
+
}
|
|
32
|
+
hexAlpha = hexAlpha * alpha;
|
|
33
|
+
if (regHex1.test(result) && hexAlpha > 0 && hexAlpha < 1) {
|
|
34
|
+
const aHexNum = Math.max(0, Math.min(255, Math.ceil(hexAlpha * 256)));
|
|
35
|
+
result = `${result.toUpperCase()}${aHexNum.toString(16).toUpperCase()}`;
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
18
39
|
function createUUID() {
|
|
19
40
|
function _createStr() {
|
|
20
41
|
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
21
42
|
}
|
|
22
43
|
return `${_createStr()}${_createStr()}-${_createStr()}-${_createStr()}-${_createStr()}-${_createStr()}${_createStr()}${_createStr()}`;
|
|
23
44
|
}
|
|
45
|
+
function limitHexStr(str) {
|
|
46
|
+
let count = 0;
|
|
47
|
+
for (let i = 0; i < str.length; i++) {
|
|
48
|
+
count += str.charCodeAt(i) * str.charCodeAt(i) * i * i;
|
|
49
|
+
}
|
|
50
|
+
return count.toString(16).substring(0, 4);
|
|
51
|
+
}
|
|
52
|
+
function createAssetId(assetStr) {
|
|
53
|
+
const len = assetStr.length;
|
|
54
|
+
const mid = Math.floor(len / 2);
|
|
55
|
+
const start4 = assetStr.substring(0, 4).padEnd(4, "0");
|
|
56
|
+
const end4 = assetStr.substring(0, 4).padEnd(4, "0");
|
|
57
|
+
const str1 = limitHexStr(len.toString(16).padEnd(4, start4));
|
|
58
|
+
const str2 = limitHexStr(assetStr.substring(mid - 4, mid).padEnd(4, start4)).padEnd(4, "f");
|
|
59
|
+
const str3 = limitHexStr(assetStr.substring(mid - 8, mid - 4).padEnd(4, start4)).padEnd(4, "f");
|
|
60
|
+
const str4 = limitHexStr(assetStr.substring(mid - 12, mid - 8).padEnd(4, start4)).padEnd(4, "f");
|
|
61
|
+
const str5 = limitHexStr(assetStr.substring(mid - 16, mid - 12).padEnd(4, end4)).padEnd(4, "f");
|
|
62
|
+
const str6 = limitHexStr(assetStr.substring(mid, mid + 4).padEnd(4, end4)).padEnd(4, "f");
|
|
63
|
+
const str7 = limitHexStr(assetStr.substring(mid + 4, mid + 8).padEnd(4, end4)).padEnd(4, "f");
|
|
64
|
+
const str8 = limitHexStr(end4.padEnd(4, start4).padEnd(4, end4));
|
|
65
|
+
return `@assets/${str1}${str2}-${str3}-${str4}-${str5}-${str6}${str7}${str8}`;
|
|
66
|
+
}
|
|
67
|
+
function isAssetId(id) {
|
|
68
|
+
return /^@assets\/[0-9a-z]{8,8}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{12,12}$/.test(`${id}`);
|
|
69
|
+
}
|
|
24
70
|
function deepClone(target) {
|
|
25
71
|
function _clone(t) {
|
|
26
72
|
const type = is$1(t);
|
|
@@ -132,7 +178,7 @@ var iDrawCore = function(exports) {
|
|
|
132
178
|
};
|
|
133
179
|
});
|
|
134
180
|
}
|
|
135
|
-
var __awaiter$1 =
|
|
181
|
+
var __awaiter$1 = function(thisArg, _arguments, P, generator) {
|
|
136
182
|
function adopt(value) {
|
|
137
183
|
return value instanceof P ? value : new P(function(resolve) {
|
|
138
184
|
resolve(value);
|
|
@@ -244,7 +290,7 @@ var iDrawCore = function(exports) {
|
|
|
244
290
|
function text(value) {
|
|
245
291
|
return typeof value === "string";
|
|
246
292
|
}
|
|
247
|
-
function fontSize(value) {
|
|
293
|
+
function fontSize$1(value) {
|
|
248
294
|
return number(value) && value > 0;
|
|
249
295
|
}
|
|
250
296
|
function lineHeight(value) {
|
|
@@ -256,10 +302,10 @@ var iDrawCore = function(exports) {
|
|
|
256
302
|
function textAlign(value) {
|
|
257
303
|
return ["center", "left", "right"].includes(value);
|
|
258
304
|
}
|
|
259
|
-
function fontFamily(value) {
|
|
305
|
+
function fontFamily$1(value) {
|
|
260
306
|
return typeof value === "string" && value.length > 0;
|
|
261
307
|
}
|
|
262
|
-
function fontWeight(value) {
|
|
308
|
+
function fontWeight$1(value) {
|
|
263
309
|
return ["bold"].includes(value);
|
|
264
310
|
}
|
|
265
311
|
function numberStr(value) {
|
|
@@ -282,11 +328,11 @@ var iDrawCore = function(exports) {
|
|
|
282
328
|
svg,
|
|
283
329
|
html,
|
|
284
330
|
text,
|
|
285
|
-
fontSize,
|
|
331
|
+
fontSize: fontSize$1,
|
|
286
332
|
lineHeight,
|
|
287
333
|
textAlign,
|
|
288
|
-
fontFamily,
|
|
289
|
-
fontWeight,
|
|
334
|
+
fontFamily: fontFamily$1,
|
|
335
|
+
fontWeight: fontWeight$1,
|
|
290
336
|
strokeWidth
|
|
291
337
|
};
|
|
292
338
|
class Context2D {
|
|
@@ -430,7 +476,8 @@ var iDrawCore = function(exports) {
|
|
|
430
476
|
return this._ctx.getLineDash();
|
|
431
477
|
}
|
|
432
478
|
setLineDash(nums) {
|
|
433
|
-
|
|
479
|
+
const dash = nums.map((n) => this.$doPixelRatio(n));
|
|
480
|
+
return this._ctx.setLineDash(dash);
|
|
434
481
|
}
|
|
435
482
|
stroke(path) {
|
|
436
483
|
return path ? this._ctx.stroke(path) : this._ctx.stroke();
|
|
@@ -532,8 +579,10 @@ var iDrawCore = function(exports) {
|
|
|
532
579
|
};
|
|
533
580
|
const viewContext = createContext2D(ctxOpts);
|
|
534
581
|
const helperContext = createContext2D(ctxOpts);
|
|
582
|
+
const underContext = createContext2D(ctxOpts);
|
|
535
583
|
const boardContext = createContext2D(Object.assign({ ctx }, ctxOpts));
|
|
536
584
|
const content = {
|
|
585
|
+
underContext,
|
|
537
586
|
viewContext,
|
|
538
587
|
helperContext,
|
|
539
588
|
boardContext
|
|
@@ -644,9 +693,8 @@ var iDrawCore = function(exports) {
|
|
|
644
693
|
function parseAngleToRadian(angle2) {
|
|
645
694
|
return angle2 / 180 * Math.PI;
|
|
646
695
|
}
|
|
647
|
-
function
|
|
648
|
-
const
|
|
649
|
-
const radian = parseAngleToRadian(elemSize.angle || 0);
|
|
696
|
+
function rotateByCenter(ctx, angle2, center, callback) {
|
|
697
|
+
const radian = parseAngleToRadian(angle2 || 0);
|
|
650
698
|
if (center && (radian > 0 || radian < 0)) {
|
|
651
699
|
ctx.translate(center.x, center.y);
|
|
652
700
|
ctx.rotate(radian);
|
|
@@ -659,6 +707,12 @@ var iDrawCore = function(exports) {
|
|
|
659
707
|
ctx.translate(-center.x, -center.y);
|
|
660
708
|
}
|
|
661
709
|
}
|
|
710
|
+
function rotateElement(ctx, elemSize, callback) {
|
|
711
|
+
const center = calcElementCenter(elemSize);
|
|
712
|
+
rotateByCenter(ctx, elemSize.angle || 0, center, () => {
|
|
713
|
+
callback(ctx);
|
|
714
|
+
});
|
|
715
|
+
}
|
|
662
716
|
function calcElementCenter(elem) {
|
|
663
717
|
const p = {
|
|
664
718
|
x: elem.x + elem.w / 2,
|
|
@@ -1221,54 +1275,58 @@ var iDrawCore = function(exports) {
|
|
|
1221
1275
|
const topRightCenter = vertexes[1];
|
|
1222
1276
|
const bottomRightCenter = vertexes[2];
|
|
1223
1277
|
const bottomLeftCenter = vertexes[3];
|
|
1224
|
-
const topSize = createControllerElementSizeFromCenter(topCenter, { size: ctrlSize, angle: totalAngle });
|
|
1225
|
-
const rightSize = createControllerElementSizeFromCenter(rightCenter, { size: ctrlSize, angle: totalAngle });
|
|
1226
|
-
const bottomSize = createControllerElementSizeFromCenter(bottomCenter, { size: ctrlSize, angle: totalAngle });
|
|
1227
|
-
const leftSize = createControllerElementSizeFromCenter(leftCenter, { size: ctrlSize, angle: totalAngle });
|
|
1228
1278
|
const topLeftSize = createControllerElementSizeFromCenter(topLeftCenter, { size: ctrlSize, angle: totalAngle });
|
|
1229
1279
|
const topRightSize = createControllerElementSizeFromCenter(topRightCenter, { size: ctrlSize, angle: totalAngle });
|
|
1230
1280
|
const bottomLeftSize = createControllerElementSizeFromCenter(bottomLeftCenter, { size: ctrlSize, angle: totalAngle });
|
|
1231
1281
|
const bottomRightSize = createControllerElementSizeFromCenter(bottomRightCenter, { size: ctrlSize, angle: totalAngle });
|
|
1282
|
+
const topLeftVertexes = calcElementVertexes(topLeftSize);
|
|
1283
|
+
const topRightVertexes = calcElementVertexes(topRightSize);
|
|
1284
|
+
const bottomLeftVertexes = calcElementVertexes(bottomLeftSize);
|
|
1285
|
+
const bottomRightVertexes = calcElementVertexes(bottomRightSize);
|
|
1286
|
+
const topVertexes = [topLeftVertexes[1], topRightVertexes[0], topRightVertexes[3], topLeftVertexes[2]];
|
|
1287
|
+
const rightVertexes = [topRightVertexes[3], topRightVertexes[2], bottomRightVertexes[1], bottomRightVertexes[0]];
|
|
1288
|
+
const bottomVertexes = [bottomLeftVertexes[1], bottomRightVertexes[0], bottomRightVertexes[3], bottomLeftVertexes[2]];
|
|
1289
|
+
const leftVertexes = [topLeftVertexes[3], topLeftVertexes[2], bottomLeftVertexes[1], bottomLeftVertexes[0]];
|
|
1232
1290
|
const sizeController = {
|
|
1233
1291
|
elementWrapper: vertexes,
|
|
1234
1292
|
left: {
|
|
1235
1293
|
type: "left",
|
|
1236
|
-
vertexes:
|
|
1294
|
+
vertexes: leftVertexes,
|
|
1237
1295
|
center: leftCenter
|
|
1238
1296
|
},
|
|
1239
1297
|
right: {
|
|
1240
1298
|
type: "right",
|
|
1241
|
-
vertexes:
|
|
1299
|
+
vertexes: rightVertexes,
|
|
1242
1300
|
center: rightCenter
|
|
1243
1301
|
},
|
|
1244
1302
|
top: {
|
|
1245
1303
|
type: "top",
|
|
1246
|
-
vertexes:
|
|
1304
|
+
vertexes: topVertexes,
|
|
1247
1305
|
center: topCenter
|
|
1248
1306
|
},
|
|
1249
1307
|
bottom: {
|
|
1250
1308
|
type: "bottom",
|
|
1251
|
-
vertexes:
|
|
1309
|
+
vertexes: bottomVertexes,
|
|
1252
1310
|
center: bottomCenter
|
|
1253
1311
|
},
|
|
1254
1312
|
topLeft: {
|
|
1255
1313
|
type: "top-left",
|
|
1256
|
-
vertexes:
|
|
1314
|
+
vertexes: topLeftVertexes,
|
|
1257
1315
|
center: topLeftCenter
|
|
1258
1316
|
},
|
|
1259
1317
|
topRight: {
|
|
1260
1318
|
type: "top-right",
|
|
1261
|
-
vertexes:
|
|
1319
|
+
vertexes: topRightVertexes,
|
|
1262
1320
|
center: topRightCenter
|
|
1263
1321
|
},
|
|
1264
1322
|
bottomLeft: {
|
|
1265
1323
|
type: "bottom-left",
|
|
1266
|
-
vertexes:
|
|
1324
|
+
vertexes: bottomLeftVertexes,
|
|
1267
1325
|
center: bottomLeftCenter
|
|
1268
1326
|
},
|
|
1269
1327
|
bottomRight: {
|
|
1270
1328
|
type: "bottom-right",
|
|
1271
|
-
vertexes:
|
|
1329
|
+
vertexes: bottomRightVertexes,
|
|
1272
1330
|
center: bottomRightCenter
|
|
1273
1331
|
}
|
|
1274
1332
|
};
|
|
@@ -1281,40 +1339,124 @@ var iDrawCore = function(exports) {
|
|
|
1281
1339
|
});
|
|
1282
1340
|
return path;
|
|
1283
1341
|
}
|
|
1284
|
-
function
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
const a = w2 / 2;
|
|
1291
|
-
const b = h2 / 2;
|
|
1292
|
-
const centerX = x2 + a;
|
|
1293
|
-
const centerY = y2 + b;
|
|
1294
|
-
if (borderWidth2 && borderWidth2 > 0) {
|
|
1295
|
-
const ba = borderWidth2 / 2 + a;
|
|
1296
|
-
const bb = borderWidth2 / 2 + b;
|
|
1297
|
-
ctx.beginPath();
|
|
1298
|
-
ctx.strokeStyle = borderColor;
|
|
1299
|
-
ctx.lineWidth = borderWidth2;
|
|
1300
|
-
ctx.circle(centerX, centerY, ba, bb, 0, 0, 2 * Math.PI);
|
|
1301
|
-
ctx.closePath();
|
|
1302
|
-
ctx.stroke();
|
|
1303
|
-
}
|
|
1304
|
-
ctx.beginPath();
|
|
1305
|
-
ctx.fillStyle = background;
|
|
1306
|
-
ctx.circle(centerX, centerY, a, b, 0, 0, 2 * Math.PI);
|
|
1307
|
-
ctx.closePath();
|
|
1308
|
-
ctx.fill();
|
|
1309
|
-
});
|
|
1342
|
+
function formatNumber(num, opts) {
|
|
1343
|
+
let decimalPlaces = 2;
|
|
1344
|
+
if (typeof (opts === null || opts === void 0 ? void 0 : opts.decimalPlaces) !== "undefined" && (opts === null || opts === void 0 ? void 0 : opts.decimalPlaces) >= 0) {
|
|
1345
|
+
decimalPlaces = opts.decimalPlaces;
|
|
1346
|
+
}
|
|
1347
|
+
return parseFloat(num.toFixed(decimalPlaces));
|
|
1310
1348
|
}
|
|
1311
|
-
function
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1349
|
+
function getDefaultElementDetailConfig() {
|
|
1350
|
+
const config = {
|
|
1351
|
+
boxSizing: "border-box",
|
|
1352
|
+
borderWidth: 0,
|
|
1353
|
+
borderColor: "#000000",
|
|
1354
|
+
shadowColor: "#000000",
|
|
1355
|
+
borderRadius: 0,
|
|
1356
|
+
borderDash: [],
|
|
1357
|
+
shadowOffsetX: 0,
|
|
1358
|
+
shadowOffsetY: 0,
|
|
1359
|
+
shadowBlur: 0,
|
|
1360
|
+
opacity: 1,
|
|
1361
|
+
color: "#000000",
|
|
1362
|
+
textAlign: "left",
|
|
1363
|
+
verticalAlign: "top",
|
|
1364
|
+
fontSize: 16,
|
|
1365
|
+
lineHeight: 20,
|
|
1366
|
+
fontFamily: "sans-serif",
|
|
1367
|
+
fontWeight: 400
|
|
1368
|
+
};
|
|
1369
|
+
return config;
|
|
1370
|
+
}
|
|
1371
|
+
const defaultElemConfig$1 = getDefaultElementDetailConfig();
|
|
1372
|
+
function calcViewBoxSize(viewElem, opts) {
|
|
1373
|
+
const { viewScaleInfo } = opts;
|
|
1374
|
+
const { scale } = viewScaleInfo;
|
|
1375
|
+
let { borderRadius: borderRadius2, boxSizing = defaultElemConfig$1.boxSizing, borderWidth: borderWidth2 } = viewElem.detail;
|
|
1376
|
+
if (typeof borderWidth2 !== "number") {
|
|
1377
|
+
borderRadius2 = 0;
|
|
1378
|
+
}
|
|
1379
|
+
let { x: x2, y: y2, w: w2, h: h2 } = viewElem;
|
|
1380
|
+
let radiusList = [0, 0, 0, 0];
|
|
1381
|
+
if (typeof borderRadius2 === "number") {
|
|
1382
|
+
const br = borderRadius2 * scale;
|
|
1383
|
+
radiusList = [br, br, br, br];
|
|
1384
|
+
} else if (Array.isArray(borderRadius2) && (borderRadius2 === null || borderRadius2 === void 0 ? void 0 : borderRadius2.length) === 4) {
|
|
1385
|
+
radiusList = [borderRadius2[0] * scale, borderRadius2[1] * scale, borderRadius2[2] * scale, borderRadius2[3] * scale];
|
|
1386
|
+
}
|
|
1387
|
+
let bw = 0;
|
|
1388
|
+
if (typeof borderWidth2 === "number") {
|
|
1389
|
+
bw = (borderWidth2 || 1) * scale;
|
|
1390
|
+
}
|
|
1391
|
+
if (boxSizing === "border-box") {
|
|
1392
|
+
x2 = viewElem.x + bw / 2;
|
|
1393
|
+
y2 = viewElem.y + bw / 2;
|
|
1394
|
+
w2 = viewElem.w - bw;
|
|
1395
|
+
h2 = viewElem.h - bw;
|
|
1396
|
+
} else if (boxSizing === "content-box") {
|
|
1397
|
+
x2 = viewElem.x - bw / 2;
|
|
1398
|
+
y2 = viewElem.y - bw / 2;
|
|
1399
|
+
w2 = viewElem.w + bw;
|
|
1400
|
+
h2 = viewElem.h + bw;
|
|
1315
1401
|
} else {
|
|
1316
|
-
|
|
1402
|
+
x2 = viewElem.x;
|
|
1403
|
+
y2 = viewElem.y;
|
|
1404
|
+
w2 = viewElem.w;
|
|
1405
|
+
h2 = viewElem.h;
|
|
1317
1406
|
}
|
|
1407
|
+
return {
|
|
1408
|
+
x: x2,
|
|
1409
|
+
y: y2,
|
|
1410
|
+
w: w2,
|
|
1411
|
+
h: h2,
|
|
1412
|
+
radiusList
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
function createColorStyle(ctx, color2, opts) {
|
|
1416
|
+
if (typeof color2 === "string") {
|
|
1417
|
+
return color2;
|
|
1418
|
+
}
|
|
1419
|
+
const { viewElementSize, viewScaleInfo, opacity = 1 } = opts;
|
|
1420
|
+
const { x: x2, y: y2 } = viewElementSize;
|
|
1421
|
+
const { scale } = viewScaleInfo;
|
|
1422
|
+
if ((color2 === null || color2 === void 0 ? void 0 : color2.type) === "linear-gradient") {
|
|
1423
|
+
const { start, end, stops } = color2;
|
|
1424
|
+
const viewStart = {
|
|
1425
|
+
x: x2 + start.x * scale,
|
|
1426
|
+
y: y2 + start.y * scale
|
|
1427
|
+
};
|
|
1428
|
+
const viewEnd = {
|
|
1429
|
+
x: x2 + end.x * scale,
|
|
1430
|
+
y: y2 + end.y * scale
|
|
1431
|
+
};
|
|
1432
|
+
const linearGradient = ctx.createLinearGradient(viewStart.x, viewStart.y, viewEnd.x, viewEnd.y);
|
|
1433
|
+
stops.forEach((stop) => {
|
|
1434
|
+
linearGradient.addColorStop(stop.offset, mergeHexColorAlpha(stop.color, opacity));
|
|
1435
|
+
});
|
|
1436
|
+
return linearGradient;
|
|
1437
|
+
}
|
|
1438
|
+
if ((color2 === null || color2 === void 0 ? void 0 : color2.type) === "radial-gradient") {
|
|
1439
|
+
const { inner, outer, stops } = color2;
|
|
1440
|
+
const viewInner = {
|
|
1441
|
+
x: x2 + inner.x * scale,
|
|
1442
|
+
y: y2 + inner.y * scale,
|
|
1443
|
+
radius: inner.radius * scale
|
|
1444
|
+
};
|
|
1445
|
+
const viewOuter = {
|
|
1446
|
+
x: x2 + outer.x * scale,
|
|
1447
|
+
y: y2 + outer.y * scale,
|
|
1448
|
+
radius: outer.radius * scale
|
|
1449
|
+
};
|
|
1450
|
+
const radialGradient = ctx.createRadialGradient(viewInner.x, viewInner.y, viewInner.radius, viewOuter.x, viewOuter.y, viewOuter.radius);
|
|
1451
|
+
stops.forEach((stop) => {
|
|
1452
|
+
radialGradient.addColorStop(stop.offset, mergeHexColorAlpha(stop.color, opacity));
|
|
1453
|
+
});
|
|
1454
|
+
return radialGradient;
|
|
1455
|
+
}
|
|
1456
|
+
return "#000000";
|
|
1457
|
+
}
|
|
1458
|
+
const defaultElemConfig = getDefaultElementDetailConfig();
|
|
1459
|
+
function drawBox(ctx, viewElem, opts) {
|
|
1318
1460
|
const { pattern, renderContent, originElem, calcElemSize, viewScaleInfo, viewSizeInfo } = opts || {};
|
|
1319
1461
|
drawClipPath(ctx, viewElem, {
|
|
1320
1462
|
originElem,
|
|
@@ -1322,12 +1464,18 @@ var iDrawCore = function(exports) {
|
|
|
1322
1464
|
viewScaleInfo,
|
|
1323
1465
|
viewSizeInfo,
|
|
1324
1466
|
renderContent: () => {
|
|
1325
|
-
|
|
1467
|
+
var _a, _b;
|
|
1468
|
+
if (((_a = viewElem === null || viewElem === void 0 ? void 0 : viewElem.detail) === null || _a === void 0 ? void 0 : _a.opacity) !== void 0 && ((_b = viewElem === null || viewElem === void 0 ? void 0 : viewElem.detail) === null || _b === void 0 ? void 0 : _b.opacity) >= 0) {
|
|
1469
|
+
ctx.globalAlpha = viewElem.detail.opacity;
|
|
1470
|
+
} else {
|
|
1471
|
+
ctx.globalAlpha = 1;
|
|
1472
|
+
}
|
|
1326
1473
|
drawBoxBackground(ctx, viewElem, { pattern, viewScaleInfo, viewSizeInfo });
|
|
1327
1474
|
renderContent === null || renderContent === void 0 ? void 0 : renderContent();
|
|
1475
|
+
drawBoxBorder(ctx, viewElem, { viewScaleInfo, viewSizeInfo });
|
|
1476
|
+
ctx.globalAlpha = 1;
|
|
1328
1477
|
}
|
|
1329
1478
|
});
|
|
1330
|
-
ctx.globalAlpha = 1;
|
|
1331
1479
|
}
|
|
1332
1480
|
function drawClipPath(ctx, viewElem, opts) {
|
|
1333
1481
|
const { renderContent, originElem, calcElemSize, viewScaleInfo, viewSizeInfo } = opts;
|
|
@@ -1360,21 +1508,20 @@ var iDrawCore = function(exports) {
|
|
|
1360
1508
|
}
|
|
1361
1509
|
function drawBoxBackground(ctx, viewElem, opts) {
|
|
1362
1510
|
var _a, _b;
|
|
1363
|
-
const { pattern, viewScaleInfo } = opts;
|
|
1511
|
+
const { pattern, viewScaleInfo, viewSizeInfo } = opts;
|
|
1364
1512
|
let transform = [];
|
|
1513
|
+
viewElem.detail;
|
|
1365
1514
|
if (viewElem.detail.background || pattern) {
|
|
1366
|
-
const { x: x2, y: y2, w: w2, h: h2 } = viewElem
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
r = 0;
|
|
1371
|
-
}
|
|
1515
|
+
const { x: x2, y: y2, w: w2, h: h2, radiusList } = calcViewBoxSize(viewElem, {
|
|
1516
|
+
viewScaleInfo,
|
|
1517
|
+
viewSizeInfo
|
|
1518
|
+
});
|
|
1372
1519
|
ctx.beginPath();
|
|
1373
|
-
ctx.moveTo(x2 +
|
|
1374
|
-
ctx.arcTo(x2 + w2, y2, x2 + w2, y2 + h2,
|
|
1375
|
-
ctx.arcTo(x2 + w2, y2 + h2, x2, y2 + h2,
|
|
1376
|
-
ctx.arcTo(x2, y2 + h2, x2, y2,
|
|
1377
|
-
ctx.arcTo(x2, y2, x2 + w2, y2,
|
|
1520
|
+
ctx.moveTo(x2 + radiusList[0], y2);
|
|
1521
|
+
ctx.arcTo(x2 + w2, y2, x2 + w2, y2 + h2, radiusList[1]);
|
|
1522
|
+
ctx.arcTo(x2 + w2, y2 + h2, x2, y2 + h2, radiusList[2]);
|
|
1523
|
+
ctx.arcTo(x2, y2 + h2, x2, y2, radiusList[3]);
|
|
1524
|
+
ctx.arcTo(x2, y2, x2 + w2, y2, radiusList[0]);
|
|
1378
1525
|
ctx.closePath();
|
|
1379
1526
|
if (typeof pattern === "string") {
|
|
1380
1527
|
ctx.fillStyle = pattern;
|
|
@@ -1382,39 +1529,20 @@ var iDrawCore = function(exports) {
|
|
|
1382
1529
|
ctx.fillStyle = pattern;
|
|
1383
1530
|
} else if (typeof viewElem.detail.background === "string") {
|
|
1384
1531
|
ctx.fillStyle = viewElem.detail.background;
|
|
1385
|
-
} else if (((_a = viewElem.detail.background) === null || _a === void 0 ? void 0 : _a.type) === "
|
|
1386
|
-
const
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
};
|
|
1391
|
-
const viewEnd = {
|
|
1392
|
-
x: end.x + x2,
|
|
1393
|
-
y: end.y + y2
|
|
1394
|
-
};
|
|
1395
|
-
const linearGradient = ctx.createLinearGradient(viewStart.x, viewStart.y, viewEnd.x, viewEnd.y);
|
|
1396
|
-
stops.forEach((stop) => {
|
|
1397
|
-
linearGradient.addColorStop(stop.offset, stop.color);
|
|
1532
|
+
} else if (((_a = viewElem.detail.background) === null || _a === void 0 ? void 0 : _a.type) === "linear-gradient") {
|
|
1533
|
+
const colorStyle = createColorStyle(ctx, viewElem.detail.background, {
|
|
1534
|
+
viewElementSize: { x: x2, y: y2, w: w2, h: h2 },
|
|
1535
|
+
viewScaleInfo,
|
|
1536
|
+
opacity: ctx.globalAlpha
|
|
1398
1537
|
});
|
|
1399
|
-
ctx.fillStyle =
|
|
1400
|
-
} else if (((_b = viewElem.detail.background) === null || _b === void 0 ? void 0 : _b.type) === "
|
|
1401
|
-
const
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
y: inner.y,
|
|
1406
|
-
radius: inner.radius * viewScaleInfo.scale
|
|
1407
|
-
};
|
|
1408
|
-
const viewOuter = {
|
|
1409
|
-
x: outer.x,
|
|
1410
|
-
y: outer.y,
|
|
1411
|
-
radius: outer.radius * viewScaleInfo.scale
|
|
1412
|
-
};
|
|
1413
|
-
const radialGradient = ctx.createRadialGradient(viewInner.x, viewInner.y, viewInner.radius, viewOuter.x, viewOuter.y, viewOuter.radius);
|
|
1414
|
-
stops.forEach((stop) => {
|
|
1415
|
-
radialGradient.addColorStop(stop.offset, stop.color);
|
|
1538
|
+
ctx.fillStyle = colorStyle;
|
|
1539
|
+
} else if (((_b = viewElem.detail.background) === null || _b === void 0 ? void 0 : _b.type) === "radial-gradient") {
|
|
1540
|
+
const colorStyle = createColorStyle(ctx, viewElem.detail.background, {
|
|
1541
|
+
viewElementSize: { x: x2, y: y2, w: w2, h: h2 },
|
|
1542
|
+
viewScaleInfo,
|
|
1543
|
+
opacity: ctx.globalAlpha
|
|
1416
1544
|
});
|
|
1417
|
-
ctx.fillStyle =
|
|
1545
|
+
ctx.fillStyle = colorStyle;
|
|
1418
1546
|
if (transform && transform.length > 0) {
|
|
1419
1547
|
for (let i = 0; i < (transform === null || transform === void 0 ? void 0 : transform.length); i++) {
|
|
1420
1548
|
const action = transform[i];
|
|
@@ -1435,95 +1563,139 @@ var iDrawCore = function(exports) {
|
|
|
1435
1563
|
}
|
|
1436
1564
|
}
|
|
1437
1565
|
function drawBoxBorder(ctx, viewElem, opts) {
|
|
1566
|
+
var _a, _b;
|
|
1567
|
+
if (viewElem.detail.borderWidth === 0) {
|
|
1568
|
+
return;
|
|
1569
|
+
}
|
|
1438
1570
|
if (!isColorStr(viewElem.detail.borderColor)) {
|
|
1439
1571
|
return;
|
|
1440
1572
|
}
|
|
1573
|
+
if (((_a = viewElem === null || viewElem === void 0 ? void 0 : viewElem.detail) === null || _a === void 0 ? void 0 : _a.opacity) !== void 0 && ((_b = viewElem === null || viewElem === void 0 ? void 0 : viewElem.detail) === null || _b === void 0 ? void 0 : _b.opacity) >= 0) {
|
|
1574
|
+
ctx.globalAlpha = viewElem.detail.opacity;
|
|
1575
|
+
} else {
|
|
1576
|
+
ctx.globalAlpha = 1;
|
|
1577
|
+
}
|
|
1441
1578
|
const { viewScaleInfo } = opts;
|
|
1442
|
-
|
|
1579
|
+
const { scale } = viewScaleInfo;
|
|
1580
|
+
let borderColor2 = defaultElemConfig.borderColor;
|
|
1443
1581
|
if (isColorStr(viewElem.detail.borderColor) === true) {
|
|
1444
|
-
|
|
1582
|
+
borderColor2 = viewElem.detail.borderColor;
|
|
1445
1583
|
}
|
|
1446
|
-
const { borderWidth: borderWidth2, borderRadius: borderRadius2, borderDash } = viewElem.detail;
|
|
1584
|
+
const { borderWidth: borderWidth2, borderRadius: borderRadius2, borderDash, boxSizing = defaultElemConfig.boxSizing } = viewElem.detail;
|
|
1447
1585
|
let bw = 0;
|
|
1448
1586
|
if (typeof borderWidth2 === "number") {
|
|
1449
1587
|
bw = borderWidth2 || 1;
|
|
1450
1588
|
}
|
|
1451
|
-
bw = bw *
|
|
1452
|
-
let
|
|
1453
|
-
|
|
1454
|
-
|
|
1589
|
+
bw = bw * scale;
|
|
1590
|
+
let radiusList = [0, 0, 0, 0];
|
|
1591
|
+
if (typeof borderRadius2 === "number") {
|
|
1592
|
+
const br = borderRadius2 * scale;
|
|
1593
|
+
radiusList = [br, br, br, br];
|
|
1594
|
+
} else if (Array.isArray(borderRadius2) && (borderRadius2 === null || borderRadius2 === void 0 ? void 0 : borderRadius2.length) === 4) {
|
|
1595
|
+
radiusList = [borderRadius2[0] * scale, borderRadius2[1] * scale, borderRadius2[2] * scale, borderRadius2[3] * scale];
|
|
1596
|
+
}
|
|
1597
|
+
ctx.strokeStyle = borderColor2;
|
|
1598
|
+
let viewBorderDash = [];
|
|
1599
|
+
if (Array.isArray(borderDash) && borderDash.length > 0) {
|
|
1600
|
+
viewBorderDash = borderDash.map((num) => Math.ceil(num * scale));
|
|
1601
|
+
}
|
|
1455
1602
|
let borderTop = 0;
|
|
1456
1603
|
let borderRight = 0;
|
|
1457
1604
|
let borderBottom = 0;
|
|
1458
1605
|
let borderLeft = 0;
|
|
1459
1606
|
if (Array.isArray(borderWidth2)) {
|
|
1460
|
-
borderTop = borderWidth2[0] || 0;
|
|
1461
|
-
borderRight = borderWidth2[1] || 0;
|
|
1462
|
-
borderBottom = borderWidth2[2] || 0;
|
|
1463
|
-
borderLeft = borderWidth2[3] || 0;
|
|
1607
|
+
borderTop = (borderWidth2[0] || 0) * scale;
|
|
1608
|
+
borderRight = (borderWidth2[1] || 0) * scale;
|
|
1609
|
+
borderBottom = (borderWidth2[2] || 0) * scale;
|
|
1610
|
+
borderLeft = (borderWidth2[3] || 0) * scale;
|
|
1464
1611
|
}
|
|
1465
1612
|
if (borderLeft || borderRight || borderTop || borderBottom) {
|
|
1466
|
-
|
|
1467
|
-
|
|
1613
|
+
ctx.lineCap = "butt";
|
|
1614
|
+
let { x: x2, y: y2, w: w2, h: h2 } = viewElem;
|
|
1615
|
+
if (boxSizing === "border-box") {
|
|
1616
|
+
x2 = x2 + borderLeft / 2;
|
|
1617
|
+
y2 = y2 + borderTop / 2;
|
|
1618
|
+
w2 = w2 - borderLeft / 2 - borderRight / 2;
|
|
1619
|
+
h2 = h2 - borderTop / 2 - borderBottom / 2;
|
|
1620
|
+
} else if (boxSizing === "content-box") {
|
|
1621
|
+
x2 = x2 - borderLeft / 2;
|
|
1622
|
+
y2 = y2 - borderTop / 2;
|
|
1623
|
+
w2 = w2 + borderLeft / 2 + borderRight / 2;
|
|
1624
|
+
h2 = h2 + borderTop / 2 + borderBottom / 2;
|
|
1625
|
+
} else {
|
|
1626
|
+
x2 = viewElem.x;
|
|
1627
|
+
y2 = viewElem.y;
|
|
1628
|
+
w2 = viewElem.w;
|
|
1629
|
+
h2 = viewElem.h;
|
|
1630
|
+
}
|
|
1631
|
+
if (borderTop) {
|
|
1468
1632
|
ctx.beginPath();
|
|
1469
|
-
ctx.lineWidth =
|
|
1470
|
-
ctx.moveTo(x2, y2);
|
|
1471
|
-
ctx.lineTo(x2
|
|
1633
|
+
ctx.lineWidth = borderTop;
|
|
1634
|
+
ctx.moveTo(x2 - borderLeft / 2, y2);
|
|
1635
|
+
ctx.lineTo(x2 + w2 + borderRight / 2, y2);
|
|
1472
1636
|
ctx.closePath();
|
|
1473
1637
|
ctx.stroke();
|
|
1474
1638
|
}
|
|
1475
1639
|
if (borderRight) {
|
|
1476
1640
|
ctx.beginPath();
|
|
1477
|
-
ctx.lineWidth = borderRight
|
|
1478
|
-
ctx.moveTo(x2 + w2, y2);
|
|
1479
|
-
ctx.lineTo(x2 + w2, y2 + h2);
|
|
1641
|
+
ctx.lineWidth = borderRight;
|
|
1642
|
+
ctx.moveTo(x2 + w2, y2 - borderTop / 2);
|
|
1643
|
+
ctx.lineTo(x2 + w2, y2 + h2 + borderBottom / 2);
|
|
1480
1644
|
ctx.closePath();
|
|
1481
1645
|
ctx.stroke();
|
|
1482
1646
|
}
|
|
1483
|
-
if (
|
|
1647
|
+
if (borderBottom) {
|
|
1484
1648
|
ctx.beginPath();
|
|
1485
|
-
ctx.lineWidth =
|
|
1486
|
-
ctx.moveTo(x2, y2);
|
|
1487
|
-
ctx.lineTo(x2 + w2, y2);
|
|
1649
|
+
ctx.lineWidth = borderBottom;
|
|
1650
|
+
ctx.moveTo(x2 - borderLeft / 2, y2 + h2);
|
|
1651
|
+
ctx.lineTo(x2 + w2 + borderRight / 2, y2 + h2);
|
|
1488
1652
|
ctx.closePath();
|
|
1489
1653
|
ctx.stroke();
|
|
1490
1654
|
}
|
|
1491
|
-
if (
|
|
1655
|
+
if (borderLeft) {
|
|
1492
1656
|
ctx.beginPath();
|
|
1493
|
-
ctx.lineWidth =
|
|
1494
|
-
ctx.moveTo(x2, y2
|
|
1495
|
-
ctx.lineTo(x2
|
|
1657
|
+
ctx.lineWidth = borderLeft;
|
|
1658
|
+
ctx.moveTo(x2, y2 - borderTop / 2);
|
|
1659
|
+
ctx.lineTo(x2, y2 + h2 + borderBottom / 2);
|
|
1496
1660
|
ctx.closePath();
|
|
1497
1661
|
ctx.stroke();
|
|
1498
1662
|
}
|
|
1499
1663
|
} else {
|
|
1500
1664
|
let { x: x2, y: y2, w: w2, h: h2 } = viewElem;
|
|
1501
|
-
const { boxSizing } = viewElem.detail;
|
|
1502
1665
|
if (boxSizing === "border-box") {
|
|
1666
|
+
x2 = viewElem.x + bw / 2;
|
|
1667
|
+
y2 = viewElem.y + bw / 2;
|
|
1668
|
+
w2 = viewElem.w - bw;
|
|
1669
|
+
h2 = viewElem.h - bw;
|
|
1670
|
+
} else if (boxSizing === "content-box") {
|
|
1671
|
+
x2 = viewElem.x - bw / 2;
|
|
1672
|
+
y2 = viewElem.y - bw / 2;
|
|
1673
|
+
w2 = viewElem.w + bw;
|
|
1674
|
+
h2 = viewElem.h + bw;
|
|
1675
|
+
} else {
|
|
1503
1676
|
x2 = viewElem.x;
|
|
1504
1677
|
y2 = viewElem.y;
|
|
1505
1678
|
w2 = viewElem.w;
|
|
1506
1679
|
h2 = viewElem.h;
|
|
1507
|
-
} else {
|
|
1508
|
-
x2 = viewElem.x - bw;
|
|
1509
|
-
y2 = viewElem.y - bw;
|
|
1510
|
-
w2 = viewElem.w + bw * 2;
|
|
1511
|
-
h2 = viewElem.h + bw * 2;
|
|
1512
1680
|
}
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1681
|
+
if (viewBorderDash.length > 0) {
|
|
1682
|
+
ctx.lineCap = "butt";
|
|
1683
|
+
} else {
|
|
1684
|
+
ctx.lineCap = "square";
|
|
1516
1685
|
}
|
|
1517
|
-
ctx.
|
|
1686
|
+
ctx.setLineDash(viewBorderDash);
|
|
1518
1687
|
ctx.lineWidth = bw;
|
|
1519
|
-
ctx.
|
|
1520
|
-
ctx.
|
|
1521
|
-
ctx.arcTo(x2 + w2, y2 +
|
|
1522
|
-
ctx.arcTo(x2, y2 + h2, x2, y2,
|
|
1523
|
-
ctx.arcTo(x2, y2
|
|
1688
|
+
ctx.beginPath();
|
|
1689
|
+
ctx.moveTo(x2 + radiusList[0], y2);
|
|
1690
|
+
ctx.arcTo(x2 + w2, y2, x2 + w2, y2 + h2, radiusList[1]);
|
|
1691
|
+
ctx.arcTo(x2 + w2, y2 + h2, x2, y2 + h2, radiusList[2]);
|
|
1692
|
+
ctx.arcTo(x2, y2 + h2, x2, y2, radiusList[3]);
|
|
1693
|
+
ctx.arcTo(x2, y2, x2 + w2, y2, radiusList[0]);
|
|
1524
1694
|
ctx.closePath();
|
|
1525
1695
|
ctx.stroke();
|
|
1696
|
+
ctx.globalAlpha = 1;
|
|
1526
1697
|
}
|
|
1698
|
+
ctx.setLineDash([]);
|
|
1527
1699
|
}
|
|
1528
1700
|
function drawBoxShadow(ctx, viewElem, opts) {
|
|
1529
1701
|
const { detail } = viewElem;
|
|
@@ -1531,7 +1703,7 @@ var iDrawCore = function(exports) {
|
|
|
1531
1703
|
const { shadowColor, shadowOffsetX, shadowOffsetY, shadowBlur } = detail;
|
|
1532
1704
|
if (is.number(shadowBlur)) {
|
|
1533
1705
|
ctx.save();
|
|
1534
|
-
ctx.shadowColor = shadowColor ||
|
|
1706
|
+
ctx.shadowColor = shadowColor || defaultElemConfig.shadowColor;
|
|
1535
1707
|
ctx.shadowOffsetX = (shadowOffsetX || 0) * viewScaleInfo.scale;
|
|
1536
1708
|
ctx.shadowOffsetY = (shadowOffsetY || 0) * viewScaleInfo.scale;
|
|
1537
1709
|
ctx.shadowBlur = (shadowBlur || 0) * viewScaleInfo.scale;
|
|
@@ -1541,6 +1713,52 @@ var iDrawCore = function(exports) {
|
|
|
1541
1713
|
renderContent();
|
|
1542
1714
|
}
|
|
1543
1715
|
}
|
|
1716
|
+
function drawCircle(ctx, elem, opts) {
|
|
1717
|
+
const { detail, angle: angle2 } = elem;
|
|
1718
|
+
const { background: background2 = "#000000", borderColor: borderColor2 = "#000000", borderWidth: borderWidth2 = 0 } = detail;
|
|
1719
|
+
const { calculator, viewScaleInfo, viewSizeInfo } = opts;
|
|
1720
|
+
const { x: x2, y: y2, w: w2, h: h2 } = calculator.elementSize({ x: elem.x, y: elem.y, w: elem.w, h: elem.h }, viewScaleInfo, viewSizeInfo);
|
|
1721
|
+
const viewElem = Object.assign(Object.assign({}, elem), { x: x2, y: y2, w: w2, h: h2, angle: angle2 });
|
|
1722
|
+
rotateElement(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
1723
|
+
drawBoxShadow(ctx, viewElem, {
|
|
1724
|
+
viewScaleInfo,
|
|
1725
|
+
viewSizeInfo,
|
|
1726
|
+
renderContent: () => {
|
|
1727
|
+
var _a, _b;
|
|
1728
|
+
const a = w2 / 2;
|
|
1729
|
+
const b = h2 / 2;
|
|
1730
|
+
const centerX = x2 + a;
|
|
1731
|
+
const centerY = y2 + b;
|
|
1732
|
+
if (((_a = elem === null || elem === void 0 ? void 0 : elem.detail) === null || _a === void 0 ? void 0 : _a.opacity) !== void 0 && ((_b = elem === null || elem === void 0 ? void 0 : elem.detail) === null || _b === void 0 ? void 0 : _b.opacity) >= 0) {
|
|
1733
|
+
ctx.globalAlpha = elem.detail.opacity;
|
|
1734
|
+
} else {
|
|
1735
|
+
ctx.globalAlpha = 1;
|
|
1736
|
+
}
|
|
1737
|
+
if (typeof borderWidth2 === "number" && borderWidth2 > 0) {
|
|
1738
|
+
const ba = borderWidth2 / 2 + a;
|
|
1739
|
+
const bb = borderWidth2 / 2 + b;
|
|
1740
|
+
ctx.beginPath();
|
|
1741
|
+
ctx.strokeStyle = borderColor2;
|
|
1742
|
+
ctx.lineWidth = borderWidth2;
|
|
1743
|
+
ctx.circle(centerX, centerY, ba, bb, 0, 0, 2 * Math.PI);
|
|
1744
|
+
ctx.closePath();
|
|
1745
|
+
ctx.stroke();
|
|
1746
|
+
}
|
|
1747
|
+
ctx.beginPath();
|
|
1748
|
+
const fillStyle = createColorStyle(ctx, background2, {
|
|
1749
|
+
viewElementSize: { x: x2, y: y2, w: w2, h: h2 },
|
|
1750
|
+
viewScaleInfo,
|
|
1751
|
+
opacity: ctx.globalAlpha
|
|
1752
|
+
});
|
|
1753
|
+
ctx.fillStyle = fillStyle;
|
|
1754
|
+
ctx.circle(centerX, centerY, a, b, 0, 0, 2 * Math.PI);
|
|
1755
|
+
ctx.closePath();
|
|
1756
|
+
ctx.fill();
|
|
1757
|
+
ctx.globalAlpha = 1;
|
|
1758
|
+
}
|
|
1759
|
+
});
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1544
1762
|
function drawRect(ctx, elem, opts) {
|
|
1545
1763
|
const { calculator, viewScaleInfo, viewSizeInfo } = opts;
|
|
1546
1764
|
let { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calculator.elementSize(elem, viewScaleInfo, viewSizeInfo);
|
|
@@ -1563,20 +1781,53 @@ var iDrawCore = function(exports) {
|
|
|
1563
1781
|
});
|
|
1564
1782
|
}
|
|
1565
1783
|
function drawImage(ctx, elem, opts) {
|
|
1566
|
-
const content = opts.loader.getContent(elem
|
|
1784
|
+
const content = opts.loader.getContent(elem);
|
|
1567
1785
|
const { calculator, viewScaleInfo, viewSizeInfo } = opts;
|
|
1568
1786
|
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calculator.elementSize(elem, viewScaleInfo, viewSizeInfo);
|
|
1787
|
+
const viewElem = Object.assign(Object.assign({}, elem), { x: x2, y: y2, w: w2, h: h2, angle: angle2 });
|
|
1569
1788
|
rotateElement(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1789
|
+
drawBoxShadow(ctx, viewElem, {
|
|
1790
|
+
viewScaleInfo,
|
|
1791
|
+
viewSizeInfo,
|
|
1792
|
+
renderContent: () => {
|
|
1793
|
+
drawBox(ctx, viewElem, {
|
|
1794
|
+
originElem: elem,
|
|
1795
|
+
calcElemSize: { x: x2, y: y2, w: w2, h: h2, angle: angle2 },
|
|
1796
|
+
viewScaleInfo,
|
|
1797
|
+
viewSizeInfo,
|
|
1798
|
+
renderContent: () => {
|
|
1799
|
+
if (!content) {
|
|
1800
|
+
opts.loader.load(elem, opts.elementAssets || {});
|
|
1801
|
+
}
|
|
1802
|
+
if (elem.type === "image" && content) {
|
|
1803
|
+
const { opacity } = elem.detail;
|
|
1804
|
+
ctx.globalAlpha = opacity ? opacity : 1;
|
|
1805
|
+
const { x: x3, y: y3, w: w3, h: h3, radiusList } = calcViewBoxSize(viewElem, {
|
|
1806
|
+
viewScaleInfo,
|
|
1807
|
+
viewSizeInfo
|
|
1808
|
+
});
|
|
1809
|
+
ctx.save();
|
|
1810
|
+
ctx.beginPath();
|
|
1811
|
+
ctx.moveTo(x3 + radiusList[0], y3);
|
|
1812
|
+
ctx.arcTo(x3 + w3, y3, x3 + w3, y3 + h3, radiusList[1]);
|
|
1813
|
+
ctx.arcTo(x3 + w3, y3 + h3, x3, y3 + h3, radiusList[2]);
|
|
1814
|
+
ctx.arcTo(x3, y3 + h3, x3, y3, radiusList[3]);
|
|
1815
|
+
ctx.arcTo(x3, y3, x3 + w3, y3, radiusList[0]);
|
|
1816
|
+
ctx.closePath();
|
|
1817
|
+
ctx.fill();
|
|
1818
|
+
ctx.clip();
|
|
1819
|
+
ctx.drawImage(content, x3, y3, w3, h3);
|
|
1820
|
+
ctx.globalAlpha = 1;
|
|
1821
|
+
ctx.restore();
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
});
|
|
1825
|
+
}
|
|
1826
|
+
});
|
|
1576
1827
|
});
|
|
1577
1828
|
}
|
|
1578
1829
|
function drawSVG(ctx, elem, opts) {
|
|
1579
|
-
const content = opts.loader.getContent(elem
|
|
1830
|
+
const content = opts.loader.getContent(elem);
|
|
1580
1831
|
const { calculator, viewScaleInfo, viewSizeInfo } = opts;
|
|
1581
1832
|
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calculator.elementSize(elem, viewScaleInfo, viewSizeInfo);
|
|
1582
1833
|
rotateElement(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
@@ -1584,23 +1835,30 @@ var iDrawCore = function(exports) {
|
|
|
1584
1835
|
opts.loader.load(elem, opts.elementAssets || {});
|
|
1585
1836
|
}
|
|
1586
1837
|
if (elem.type === "svg" && content) {
|
|
1838
|
+
const { opacity } = elem.detail;
|
|
1839
|
+
ctx.globalAlpha = opacity ? opacity : 1;
|
|
1587
1840
|
ctx.drawImage(content, x2, y2, w2, h2);
|
|
1841
|
+
ctx.globalAlpha = 1;
|
|
1588
1842
|
}
|
|
1589
1843
|
});
|
|
1590
1844
|
}
|
|
1591
1845
|
function drawHTML(ctx, elem, opts) {
|
|
1592
|
-
const content = opts.loader.getContent(elem
|
|
1846
|
+
const content = opts.loader.getContent(elem);
|
|
1593
1847
|
const { calculator, viewScaleInfo, viewSizeInfo } = opts;
|
|
1594
1848
|
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calculator.elementSize(elem, viewScaleInfo, viewSizeInfo);
|
|
1595
1849
|
rotateElement(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
1596
1850
|
if (!content) {
|
|
1597
|
-
opts.loader.load(elem);
|
|
1851
|
+
opts.loader.load(elem, opts.elementAssets || {});
|
|
1598
1852
|
}
|
|
1599
1853
|
if (elem.type === "html" && content) {
|
|
1854
|
+
const { opacity } = elem.detail;
|
|
1855
|
+
ctx.globalAlpha = opacity ? opacity : 1;
|
|
1600
1856
|
ctx.drawImage(content, x2, y2, w2, h2);
|
|
1857
|
+
ctx.globalAlpha = 1;
|
|
1601
1858
|
}
|
|
1602
1859
|
});
|
|
1603
1860
|
}
|
|
1861
|
+
const detailConfig = getDefaultElementDetailConfig();
|
|
1604
1862
|
function drawText(ctx, elem, opts) {
|
|
1605
1863
|
const { calculator, viewScaleInfo, viewSizeInfo } = opts;
|
|
1606
1864
|
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calculator.elementSize(elem, viewScaleInfo, viewSizeInfo);
|
|
@@ -1612,14 +1870,10 @@ var iDrawCore = function(exports) {
|
|
|
1612
1870
|
viewScaleInfo,
|
|
1613
1871
|
viewSizeInfo,
|
|
1614
1872
|
renderContent: () => {
|
|
1615
|
-
const detail = Object.assign({
|
|
1616
|
-
|
|
1617
|
-
fontFamily: "sans-serif",
|
|
1618
|
-
textAlign: "center"
|
|
1619
|
-
}, elem.detail);
|
|
1620
|
-
const fontSize2 = detail.fontSize * viewScaleInfo.scale;
|
|
1873
|
+
const detail = Object.assign(Object.assign({}, detailConfig), elem.detail);
|
|
1874
|
+
const fontSize2 = (detail.fontSize || detailConfig.fontSize) * viewScaleInfo.scale;
|
|
1621
1875
|
const lineHeight2 = detail.lineHeight ? detail.lineHeight * viewScaleInfo.scale : fontSize2;
|
|
1622
|
-
ctx.fillStyle = elem.detail.color;
|
|
1876
|
+
ctx.fillStyle = elem.detail.color || detailConfig.color;
|
|
1623
1877
|
ctx.textBaseline = "top";
|
|
1624
1878
|
ctx.$setFont({
|
|
1625
1879
|
fontWeight: detail.fontWeight,
|
|
@@ -1852,10 +2106,14 @@ var iDrawCore = function(exports) {
|
|
|
1852
2106
|
});
|
|
1853
2107
|
});
|
|
1854
2108
|
}
|
|
2109
|
+
const defaultDetail = getDefaultElementDetailConfig();
|
|
1855
2110
|
function drawElementList(ctx, data, opts) {
|
|
1856
2111
|
const { elements = [] } = data;
|
|
1857
2112
|
for (let i = 0; i < elements.length; i++) {
|
|
1858
|
-
const
|
|
2113
|
+
const element = elements[i];
|
|
2114
|
+
const elem = Object.assign(Object.assign({}, element), {
|
|
2115
|
+
detail: Object.assign(Object.assign({}, defaultDetail), element === null || element === void 0 ? void 0 : element.detail)
|
|
2116
|
+
});
|
|
1859
2117
|
if (!opts.calculator.isElementInView(elem, opts.viewScaleInfo, opts.viewSizeInfo)) {
|
|
1860
2118
|
continue;
|
|
1861
2119
|
}
|
|
@@ -1866,7 +2124,7 @@ var iDrawCore = function(exports) {
|
|
|
1866
2124
|
}
|
|
1867
2125
|
}
|
|
1868
2126
|
}
|
|
1869
|
-
var __awaiter =
|
|
2127
|
+
var __awaiter = function(thisArg, _arguments, P, generator) {
|
|
1870
2128
|
function adopt(value) {
|
|
1871
2129
|
return value instanceof P ? value : new P(function(resolve) {
|
|
1872
2130
|
resolve(value);
|
|
@@ -1894,6 +2152,24 @@ var iDrawCore = function(exports) {
|
|
|
1894
2152
|
});
|
|
1895
2153
|
};
|
|
1896
2154
|
const supportElementTypes = ["image", "svg", "html"];
|
|
2155
|
+
const getAssetIdFromElement = (element) => {
|
|
2156
|
+
var _a, _b, _c;
|
|
2157
|
+
let source = null;
|
|
2158
|
+
if (element.type === "image") {
|
|
2159
|
+
source = ((_a = element === null || element === void 0 ? void 0 : element.detail) === null || _a === void 0 ? void 0 : _a.src) || null;
|
|
2160
|
+
} else if (element.type === "svg") {
|
|
2161
|
+
source = ((_b = element === null || element === void 0 ? void 0 : element.detail) === null || _b === void 0 ? void 0 : _b.svg) || null;
|
|
2162
|
+
} else if (element.type === "html") {
|
|
2163
|
+
source = ((_c = element === null || element === void 0 ? void 0 : element.detail) === null || _c === void 0 ? void 0 : _c.html) || null;
|
|
2164
|
+
}
|
|
2165
|
+
if (typeof source === "string" && source) {
|
|
2166
|
+
if (isAssetId(source)) {
|
|
2167
|
+
return source;
|
|
2168
|
+
}
|
|
2169
|
+
return createAssetId(source);
|
|
2170
|
+
}
|
|
2171
|
+
return createAssetId(`${createUUID()}-${element.uuid}-${createUUID()}-${createUUID()}`);
|
|
2172
|
+
};
|
|
1897
2173
|
class Loader extends EventEmitter {
|
|
1898
2174
|
constructor() {
|
|
1899
2175
|
super();
|
|
@@ -1961,34 +2237,35 @@ var iDrawCore = function(exports) {
|
|
|
1961
2237
|
};
|
|
1962
2238
|
}
|
|
1963
2239
|
_emitLoad(item) {
|
|
1964
|
-
const
|
|
1965
|
-
const storageItem = this._storageLoadItemMap[
|
|
2240
|
+
const assetId = getAssetIdFromElement(item.element);
|
|
2241
|
+
const storageItem = this._storageLoadItemMap[assetId];
|
|
1966
2242
|
if (storageItem) {
|
|
1967
2243
|
if (storageItem.startTime < item.startTime) {
|
|
1968
|
-
this._storageLoadItemMap[
|
|
2244
|
+
this._storageLoadItemMap[assetId] = item;
|
|
1969
2245
|
this.trigger("load", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
1970
2246
|
}
|
|
1971
2247
|
} else {
|
|
1972
|
-
this._storageLoadItemMap[
|
|
2248
|
+
this._storageLoadItemMap[assetId] = item;
|
|
1973
2249
|
this.trigger("load", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
1974
2250
|
}
|
|
1975
2251
|
}
|
|
1976
2252
|
_emitError(item) {
|
|
1977
|
-
const
|
|
1978
|
-
const storageItem = this._storageLoadItemMap[
|
|
2253
|
+
const assetId = getAssetIdFromElement(item.element);
|
|
2254
|
+
const storageItem = this._storageLoadItemMap[assetId];
|
|
1979
2255
|
if (storageItem) {
|
|
1980
2256
|
if (storageItem.startTime < item.startTime) {
|
|
1981
|
-
this._storageLoadItemMap[
|
|
2257
|
+
this._storageLoadItemMap[assetId] = item;
|
|
1982
2258
|
this.trigger("error", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
1983
2259
|
}
|
|
1984
2260
|
} else {
|
|
1985
|
-
this._storageLoadItemMap[
|
|
2261
|
+
this._storageLoadItemMap[assetId] = item;
|
|
1986
2262
|
this.trigger("error", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
1987
2263
|
}
|
|
1988
2264
|
}
|
|
1989
2265
|
_loadResource(element, assets) {
|
|
1990
2266
|
const item = this._createLoadItem(element);
|
|
1991
|
-
|
|
2267
|
+
const assetId = getAssetIdFromElement(element);
|
|
2268
|
+
this._currentLoadItemMap[assetId] = item;
|
|
1992
2269
|
const loadFunc = this._loadFuncMap[element.type];
|
|
1993
2270
|
if (typeof loadFunc === "function") {
|
|
1994
2271
|
item.startTime = Date.now();
|
|
@@ -2008,7 +2285,8 @@ var iDrawCore = function(exports) {
|
|
|
2008
2285
|
}
|
|
2009
2286
|
_isExistingErrorStorage(element) {
|
|
2010
2287
|
var _a;
|
|
2011
|
-
const
|
|
2288
|
+
const assetId = getAssetIdFromElement(element);
|
|
2289
|
+
const existItem = (_a = this._currentLoadItemMap) === null || _a === void 0 ? void 0 : _a[assetId];
|
|
2012
2290
|
if (existItem && existItem.status === "error" && existItem.source && existItem.source === this._getLoadElementSource(element)) {
|
|
2013
2291
|
return true;
|
|
2014
2292
|
}
|
|
@@ -2019,13 +2297,13 @@ var iDrawCore = function(exports) {
|
|
|
2019
2297
|
return;
|
|
2020
2298
|
}
|
|
2021
2299
|
if (supportElementTypes.includes(element.type)) {
|
|
2022
|
-
|
|
2023
|
-
this._loadResource(elem, assets);
|
|
2300
|
+
this._loadResource(element, assets);
|
|
2024
2301
|
}
|
|
2025
2302
|
}
|
|
2026
|
-
getContent(
|
|
2303
|
+
getContent(element) {
|
|
2027
2304
|
var _a, _b;
|
|
2028
|
-
|
|
2305
|
+
const assetId = getAssetIdFromElement(element);
|
|
2306
|
+
return ((_b = (_a = this._storageLoadItemMap) === null || _a === void 0 ? void 0 : _a[assetId]) === null || _b === void 0 ? void 0 : _b.content) || null;
|
|
2029
2307
|
}
|
|
2030
2308
|
}
|
|
2031
2309
|
class Renderer extends EventEmitter {
|
|
@@ -2357,7 +2635,7 @@ var iDrawCore = function(exports) {
|
|
|
2357
2635
|
const { renderer, viewContent, beforeDrawFrame, afterDrawFrame } = this._opts;
|
|
2358
2636
|
if (snapshot) {
|
|
2359
2637
|
const { scale, offsetTop, offsetBottom, offsetLeft, offsetRight, width, height, contextHeight, contextWidth, devicePixelRatio } = snapshot.activeStore;
|
|
2360
|
-
const { viewContext, helperContext, boardContext } = viewContent;
|
|
2638
|
+
const { underContext, viewContext, helperContext, boardContext } = viewContent;
|
|
2361
2639
|
if (snapshot === null || snapshot === void 0 ? void 0 : snapshot.activeStore.data) {
|
|
2362
2640
|
renderer.drawData(snapshot.activeStore.data, {
|
|
2363
2641
|
viewScaleInfo: {
|
|
@@ -2378,8 +2656,10 @@ var iDrawCore = function(exports) {
|
|
|
2378
2656
|
}
|
|
2379
2657
|
beforeDrawFrame({ snapshot });
|
|
2380
2658
|
boardContext.clearRect(0, 0, width, height);
|
|
2659
|
+
boardContext.drawImage(underContext.canvas, 0, 0, width, height);
|
|
2381
2660
|
boardContext.drawImage(viewContext.canvas, 0, 0, width, height);
|
|
2382
2661
|
boardContext.drawImage(helperContext.canvas, 0, 0, width, height);
|
|
2662
|
+
underContext.clearRect(0, 0, width, height);
|
|
2383
2663
|
viewContext.clearRect(0, 0, width, height);
|
|
2384
2664
|
helperContext.clearRect(0, 0, width, height);
|
|
2385
2665
|
afterDrawFrame({ snapshot });
|
|
@@ -2435,11 +2715,13 @@ var iDrawCore = function(exports) {
|
|
|
2435
2715
|
const originViewSize = sharer.getActiveViewSizeInfo();
|
|
2436
2716
|
const newViewSize = Object.assign(Object.assign({}, originViewSize), viewSize);
|
|
2437
2717
|
const { width, height, devicePixelRatio } = newViewSize;
|
|
2438
|
-
const { boardContext, helperContext, viewContext } = this._opts.viewContent;
|
|
2718
|
+
const { underContext, boardContext, helperContext, viewContext } = this._opts.viewContent;
|
|
2439
2719
|
boardContext.canvas.width = width * devicePixelRatio;
|
|
2440
2720
|
boardContext.canvas.height = height * devicePixelRatio;
|
|
2441
2721
|
boardContext.canvas.style.width = `${width}px`;
|
|
2442
2722
|
boardContext.canvas.style.height = `${height}px`;
|
|
2723
|
+
underContext.canvas.width = width * devicePixelRatio;
|
|
2724
|
+
underContext.canvas.height = height * devicePixelRatio;
|
|
2443
2725
|
helperContext.canvas.width = width * devicePixelRatio;
|
|
2444
2726
|
helperContext.canvas.height = height * devicePixelRatio;
|
|
2445
2727
|
viewContext.canvas.width = width * devicePixelRatio;
|
|
@@ -2668,6 +2950,9 @@ var iDrawCore = function(exports) {
|
|
|
2668
2950
|
getSharer() {
|
|
2669
2951
|
return this._sharer;
|
|
2670
2952
|
}
|
|
2953
|
+
getViewer() {
|
|
2954
|
+
return this._viewer;
|
|
2955
|
+
}
|
|
2671
2956
|
setData(data) {
|
|
2672
2957
|
const sharer = this._sharer;
|
|
2673
2958
|
this._sharer.setActiveStorage("data", data);
|
|
@@ -2717,7 +3002,8 @@ var iDrawCore = function(exports) {
|
|
|
2717
3002
|
}
|
|
2718
3003
|
clear() {
|
|
2719
3004
|
const { viewContent } = this._opts;
|
|
2720
|
-
const { helperContext, viewContext, boardContext } = viewContent;
|
|
3005
|
+
const { underContext, helperContext, viewContext, boardContext } = viewContent;
|
|
3006
|
+
underContext.clearRect(0, 0, underContext.canvas.width, underContext.canvas.height);
|
|
2721
3007
|
helperContext.clearRect(0, 0, helperContext.canvas.width, helperContext.canvas.height);
|
|
2722
3008
|
viewContext.clearRect(0, 0, viewContext.canvas.width, viewContext.canvas.height);
|
|
2723
3009
|
boardContext.clearRect(0, 0, boardContext.canvas.width, boardContext.canvas.height);
|
|
@@ -2852,11 +3138,11 @@ var iDrawCore = function(exports) {
|
|
|
2852
3138
|
const resizeControllerBorderWidth = 2;
|
|
2853
3139
|
const wrapperColor = "#1973ba";
|
|
2854
3140
|
function drawVertexes(ctx, vertexes, opts) {
|
|
2855
|
-
const { borderColor, borderWidth: borderWidth2, background, lineDash } = opts;
|
|
3141
|
+
const { borderColor: borderColor2, borderWidth: borderWidth2, background: background2, lineDash } = opts;
|
|
2856
3142
|
ctx.setLineDash([]);
|
|
2857
3143
|
ctx.lineWidth = borderWidth2;
|
|
2858
|
-
ctx.strokeStyle =
|
|
2859
|
-
ctx.fillStyle =
|
|
3144
|
+
ctx.strokeStyle = borderColor2;
|
|
3145
|
+
ctx.fillStyle = background2;
|
|
2860
3146
|
ctx.setLineDash(lineDash);
|
|
2861
3147
|
ctx.beginPath();
|
|
2862
3148
|
ctx.moveTo(vertexes[0].x, vertexes[0].y);
|
|
@@ -2883,10 +3169,6 @@ var iDrawCore = function(exports) {
|
|
|
2883
3169
|
const wrapperOpts = { borderColor: wrapperColor, borderWidth: 1, background: "transparent", lineDash: [] };
|
|
2884
3170
|
const ctrlOpts = { ...wrapperOpts, borderWidth: resizeControllerBorderWidth, background: "#FFFFFF" };
|
|
2885
3171
|
drawVertexes(ctx, calcViewVertexes(elementWrapper, opts), wrapperOpts);
|
|
2886
|
-
drawVertexes(ctx, calcViewVertexes(left.vertexes, opts), ctrlOpts);
|
|
2887
|
-
drawVertexes(ctx, calcViewVertexes(right.vertexes, opts), ctrlOpts);
|
|
2888
|
-
drawVertexes(ctx, calcViewVertexes(top.vertexes, opts), ctrlOpts);
|
|
2889
|
-
drawVertexes(ctx, calcViewVertexes(bottom.vertexes, opts), ctrlOpts);
|
|
2890
3172
|
drawVertexes(ctx, calcViewVertexes(topLeft.vertexes, opts), ctrlOpts);
|
|
2891
3173
|
drawVertexes(ctx, calcViewVertexes(topRight.vertexes, opts), ctrlOpts);
|
|
2892
3174
|
drawVertexes(ctx, calcViewVertexes(bottomLeft.vertexes, opts), ctrlOpts);
|
|
@@ -3676,12 +3958,13 @@ var iDrawCore = function(exports) {
|
|
|
3676
3958
|
moveY
|
|
3677
3959
|
};
|
|
3678
3960
|
}
|
|
3961
|
+
const middlewareEventSelect = "@middleware/select";
|
|
3679
3962
|
const MiddlewareSelector = (opts) => {
|
|
3680
3963
|
const { viewer, sharer, viewContent, calculator, eventHub } = opts;
|
|
3681
3964
|
const { helperContext } = viewContent;
|
|
3682
3965
|
let prevPoint = null;
|
|
3683
3966
|
let inBusyMode = null;
|
|
3684
|
-
eventHub.on(
|
|
3967
|
+
eventHub.on(middlewareEventSelect, ({ uuids }) => {
|
|
3685
3968
|
const actionType = sharer.getSharedStorage(keyActionType);
|
|
3686
3969
|
const data = sharer.getActiveStorage("data");
|
|
3687
3970
|
const elements = findElementsFromList(uuids, (data == null ? void 0 : data.elements) || []);
|
|
@@ -3746,7 +4029,7 @@ var iDrawCore = function(exports) {
|
|
|
3746
4029
|
sharer.setSharedStorage(keySelectedElementController, null);
|
|
3747
4030
|
}
|
|
3748
4031
|
if ((opts2 == null ? void 0 : opts2.triggerEvent) === true) {
|
|
3749
|
-
eventHub.trigger(
|
|
4032
|
+
eventHub.trigger(middlewareEventSelect, { uuids: list.map((elem) => elem.uuid) });
|
|
3750
4033
|
}
|
|
3751
4034
|
};
|
|
3752
4035
|
const pointTargetBaseOptions = () => {
|
|
@@ -4117,9 +4400,15 @@ var iDrawCore = function(exports) {
|
|
|
4117
4400
|
const keyPrevPoint = Symbol(`${key}_prevPoint`);
|
|
4118
4401
|
const keyActivePoint = Symbol(`${key}_activePoint`);
|
|
4119
4402
|
const keyActiveThumbType = Symbol(`${key}_activeThumbType`);
|
|
4403
|
+
const minScrollerWidth = 12;
|
|
4120
4404
|
const scrollerLineWidth = 16;
|
|
4121
|
-
const scrollerAlpha = 0.12;
|
|
4122
4405
|
const scrollerThumbAlpha = 0.36;
|
|
4406
|
+
const scrollConfig = {
|
|
4407
|
+
width: minScrollerWidth,
|
|
4408
|
+
thumbColor: "#000000AA",
|
|
4409
|
+
scrollBarColor: "#FFFFFF60",
|
|
4410
|
+
showScrollBar: false
|
|
4411
|
+
};
|
|
4123
4412
|
function isPointAtRect(helperContext, p, rect) {
|
|
4124
4413
|
const ctx = helperContext;
|
|
4125
4414
|
const { x: x2, y: y2, w: w2, h: h2 } = rect;
|
|
@@ -4167,7 +4456,7 @@ var iDrawCore = function(exports) {
|
|
|
4167
4456
|
if (ySize >= height) {
|
|
4168
4457
|
ySize = height;
|
|
4169
4458
|
}
|
|
4170
|
-
const xStart = lineSize
|
|
4459
|
+
const xStart = lineSize;
|
|
4171
4460
|
const xEnd = width - xSize - lineSize;
|
|
4172
4461
|
let translateX = xStart;
|
|
4173
4462
|
if (offsetLeft > 0) {
|
|
@@ -4175,10 +4464,10 @@ var iDrawCore = function(exports) {
|
|
|
4175
4464
|
} else if (offsetRight > 0) {
|
|
4176
4465
|
translateX = xEnd;
|
|
4177
4466
|
} else if (offsetLeft <= 0 && xSize > 0 && !(offsetLeft === 0 && offsetRight === 0)) {
|
|
4178
|
-
translateX =
|
|
4179
|
-
translateX = Math.min(Math.max(0, translateX -
|
|
4467
|
+
translateX = xStart + (width - xSize) * Math.abs(offsetLeft) / (Math.abs(offsetLeft) + Math.abs(offsetRight));
|
|
4468
|
+
translateX = Math.min(Math.max(0, translateX - xStart), width - xSize);
|
|
4180
4469
|
}
|
|
4181
|
-
const yStart = lineSize
|
|
4470
|
+
const yStart = lineSize;
|
|
4182
4471
|
const yEnd = height - ySize - lineSize;
|
|
4183
4472
|
let translateY = yStart;
|
|
4184
4473
|
if (offsetTop > 0) {
|
|
@@ -4186,8 +4475,8 @@ var iDrawCore = function(exports) {
|
|
|
4186
4475
|
} else if (offsetBottom > 0) {
|
|
4187
4476
|
translateY = yEnd;
|
|
4188
4477
|
} else if (offsetTop <= 0 && ySize > 0 && !(offsetTop === 0 && offsetBottom === 0)) {
|
|
4189
|
-
translateY =
|
|
4190
|
-
translateY = Math.min(Math.max(0, translateY -
|
|
4478
|
+
translateY = yStart + (height - ySize) * Math.abs(offsetTop) / (Math.abs(offsetTop) + Math.abs(offsetBottom));
|
|
4479
|
+
translateY = Math.min(Math.max(0, translateY - yStart), height - ySize);
|
|
4191
4480
|
}
|
|
4192
4481
|
const xThumbRect = {
|
|
4193
4482
|
x: translateX,
|
|
@@ -4207,7 +4496,8 @@ var iDrawCore = function(exports) {
|
|
|
4207
4496
|
ySize,
|
|
4208
4497
|
translateY,
|
|
4209
4498
|
translateX,
|
|
4210
|
-
|
|
4499
|
+
thumbColor: scrollConfig.thumbColor,
|
|
4500
|
+
scrollBarColor: scrollConfig.scrollBarColor,
|
|
4211
4501
|
xThumbRect,
|
|
4212
4502
|
yThumbRect
|
|
4213
4503
|
};
|
|
@@ -4215,47 +4505,54 @@ var iDrawCore = function(exports) {
|
|
|
4215
4505
|
}
|
|
4216
4506
|
function drawScrollerThumb(ctx, opts) {
|
|
4217
4507
|
let { x: x2, y: y2, h: h2, w: w2 } = opts;
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4508
|
+
ctx.save();
|
|
4509
|
+
ctx.shadowColor = "#FFFFFF";
|
|
4510
|
+
ctx.shadowOffsetX = 0;
|
|
4511
|
+
ctx.shadowOffsetY = 0;
|
|
4512
|
+
ctx.shadowBlur = 1;
|
|
4513
|
+
{
|
|
4514
|
+
const { color: color2, axis } = opts;
|
|
4515
|
+
if (axis === "X") {
|
|
4516
|
+
y2 = y2 + h2 / 4 + 0;
|
|
4517
|
+
h2 = h2 / 2;
|
|
4518
|
+
} else if (axis === "Y") {
|
|
4519
|
+
x2 = x2 + w2 / 4 + 0;
|
|
4520
|
+
w2 = w2 / 2;
|
|
4521
|
+
}
|
|
4522
|
+
let r = opts.r;
|
|
4523
|
+
r = Math.min(r, w2 / 2, h2 / 2);
|
|
4524
|
+
if (w2 < r * 2 || h2 < r * 2) {
|
|
4525
|
+
r = 0;
|
|
4526
|
+
}
|
|
4527
|
+
ctx.globalAlpha = scrollerThumbAlpha;
|
|
4528
|
+
ctx.beginPath();
|
|
4529
|
+
ctx.moveTo(x2 + r, y2);
|
|
4530
|
+
ctx.arcTo(x2 + w2, y2, x2 + w2, y2 + h2, r);
|
|
4531
|
+
ctx.arcTo(x2 + w2, y2 + h2, x2, y2 + h2, r);
|
|
4532
|
+
ctx.arcTo(x2, y2 + h2, x2, y2, r);
|
|
4533
|
+
ctx.arcTo(x2, y2, x2 + w2, y2, r);
|
|
4534
|
+
ctx.closePath();
|
|
4535
|
+
ctx.fillStyle = color2;
|
|
4536
|
+
ctx.fill();
|
|
4537
|
+
ctx.globalAlpha = 1;
|
|
4538
|
+
ctx.beginPath();
|
|
4539
|
+
ctx.lineWidth = 1;
|
|
4540
|
+
ctx.strokeStyle = color2;
|
|
4541
|
+
ctx.setLineDash([]);
|
|
4542
|
+
ctx.moveTo(x2 + r, y2);
|
|
4543
|
+
ctx.arcTo(x2 + w2, y2, x2 + w2, y2 + h2, r);
|
|
4544
|
+
ctx.arcTo(x2 + w2, y2 + h2, x2, y2 + h2, r);
|
|
4545
|
+
ctx.arcTo(x2, y2 + h2, x2, y2, r);
|
|
4546
|
+
ctx.arcTo(x2, y2, x2 + w2, y2, r);
|
|
4547
|
+
ctx.closePath();
|
|
4548
|
+
ctx.stroke();
|
|
4549
|
+
}
|
|
4550
|
+
ctx.restore();
|
|
4253
4551
|
}
|
|
4254
4552
|
function drawScrollerInfo(helperContext, opts) {
|
|
4255
4553
|
const ctx = helperContext;
|
|
4256
4554
|
const { viewScaleInfo, viewSizeInfo, scrollInfo } = opts;
|
|
4257
4555
|
const { activeThumbType, prevPoint, activePoint } = scrollInfo;
|
|
4258
|
-
const { width, height } = viewSizeInfo;
|
|
4259
4556
|
const wrapper = calcScrollerInfo(viewScaleInfo, viewSizeInfo);
|
|
4260
4557
|
let xThumbRect = { ...wrapper.xThumbRect };
|
|
4261
4558
|
let yThumbRect = { ...wrapper.yThumbRect };
|
|
@@ -4268,27 +4565,17 @@ var iDrawCore = function(exports) {
|
|
|
4268
4565
|
yThumbRect.y = yThumbRect.y + (activePoint.y - prevPoint.y);
|
|
4269
4566
|
}
|
|
4270
4567
|
}
|
|
4271
|
-
{
|
|
4272
|
-
ctx.globalAlpha = scrollerAlpha;
|
|
4273
|
-
ctx.fillStyle = wrapper.color;
|
|
4274
|
-
ctx.fillRect(0, height - wrapper.lineSize, width, wrapper.lineSize);
|
|
4275
|
-
}
|
|
4276
4568
|
drawScrollerThumb(ctx, {
|
|
4277
4569
|
axis: "X",
|
|
4278
4570
|
...xThumbRect,
|
|
4279
4571
|
r: wrapper.lineSize / 2,
|
|
4280
|
-
color: wrapper.
|
|
4572
|
+
color: wrapper.thumbColor
|
|
4281
4573
|
});
|
|
4282
|
-
{
|
|
4283
|
-
ctx.globalAlpha = scrollerAlpha;
|
|
4284
|
-
ctx.fillStyle = wrapper.color;
|
|
4285
|
-
ctx.fillRect(width - wrapper.lineSize, 0, wrapper.lineSize, height);
|
|
4286
|
-
}
|
|
4287
4574
|
drawScrollerThumb(ctx, {
|
|
4288
4575
|
axis: "Y",
|
|
4289
4576
|
...yThumbRect,
|
|
4290
4577
|
r: wrapper.lineSize / 2,
|
|
4291
|
-
color: wrapper.
|
|
4578
|
+
color: wrapper.thumbColor
|
|
4292
4579
|
});
|
|
4293
4580
|
ctx.globalAlpha = 1;
|
|
4294
4581
|
return {
|
|
@@ -4405,9 +4692,10 @@ var iDrawCore = function(exports) {
|
|
|
4405
4692
|
}
|
|
4406
4693
|
};
|
|
4407
4694
|
};
|
|
4695
|
+
const middlewareEventScale = "@middleware/scale";
|
|
4408
4696
|
const MiddlewareScaler = (opts) => {
|
|
4409
4697
|
const key2 = "SCALE";
|
|
4410
|
-
const { viewer, sharer } = opts;
|
|
4698
|
+
const { viewer, sharer, eventHub } = opts;
|
|
4411
4699
|
return {
|
|
4412
4700
|
mode: key2,
|
|
4413
4701
|
isDefault: true,
|
|
@@ -4423,6 +4711,218 @@ var iDrawCore = function(exports) {
|
|
|
4423
4711
|
const { moveX, moveY } = viewer.scale({ scale: newScaleNum, point });
|
|
4424
4712
|
viewer.scroll({ moveX, moveY });
|
|
4425
4713
|
viewer.drawFrame();
|
|
4714
|
+
const scaleNum = formatNumber(scale);
|
|
4715
|
+
eventHub.trigger(middlewareEventScale, { scale: scaleNum });
|
|
4716
|
+
}
|
|
4717
|
+
};
|
|
4718
|
+
};
|
|
4719
|
+
const rulerSize = 16;
|
|
4720
|
+
const background = "#FFFFFFA8";
|
|
4721
|
+
const borderColor = "#00000080";
|
|
4722
|
+
const scaleColor = "#000000";
|
|
4723
|
+
const textColor = "#00000080";
|
|
4724
|
+
const fontFamily = "monospace";
|
|
4725
|
+
const fontSize = 10;
|
|
4726
|
+
const fontWeight = 100;
|
|
4727
|
+
const gridColor = "#AAAAAA30";
|
|
4728
|
+
const gridKeyColor = "#AAAAAA70";
|
|
4729
|
+
function calcRulerScaleList(opts) {
|
|
4730
|
+
const { scale, viewLength, viewOffset } = opts;
|
|
4731
|
+
const list = [];
|
|
4732
|
+
let rulerUnit = 10;
|
|
4733
|
+
rulerUnit = formatNumber(rulerUnit / scale, { decimalPlaces: 0 });
|
|
4734
|
+
rulerUnit = Math.max(1, Math.min(rulerUnit, 1e3));
|
|
4735
|
+
const rulerKeyUnit = rulerUnit * 10;
|
|
4736
|
+
const rulerSubKeyUnit = rulerUnit * 5;
|
|
4737
|
+
let index = 0;
|
|
4738
|
+
const viewUnit = rulerUnit * scale;
|
|
4739
|
+
const startNum = 0 - viewOffset;
|
|
4740
|
+
const startPosition = 0;
|
|
4741
|
+
const remainderNum = startNum % viewUnit;
|
|
4742
|
+
const firstNum = (startNum - remainderNum + viewUnit) / scale;
|
|
4743
|
+
const firstPosition = startPosition + (viewUnit - remainderNum);
|
|
4744
|
+
while (firstPosition + index * viewUnit < viewLength) {
|
|
4745
|
+
const num = formatNumber(firstNum + index * rulerUnit, { decimalPlaces: 0 });
|
|
4746
|
+
const position = formatNumber(firstPosition + index * viewUnit, { decimalPlaces: 0 });
|
|
4747
|
+
const rulerScale = {
|
|
4748
|
+
num,
|
|
4749
|
+
position,
|
|
4750
|
+
showNum: num % rulerKeyUnit === 0,
|
|
4751
|
+
isKeyNum: num % rulerKeyUnit === 0,
|
|
4752
|
+
isSubKeyNum: num % rulerSubKeyUnit === 0
|
|
4753
|
+
};
|
|
4754
|
+
list.push(rulerScale);
|
|
4755
|
+
index++;
|
|
4756
|
+
}
|
|
4757
|
+
return list;
|
|
4758
|
+
}
|
|
4759
|
+
function calcXRulerScaleList(opts) {
|
|
4760
|
+
const { viewScaleInfo, viewSizeInfo } = opts;
|
|
4761
|
+
const { scale, offsetLeft } = viewScaleInfo;
|
|
4762
|
+
const { width } = viewSizeInfo;
|
|
4763
|
+
return calcRulerScaleList({
|
|
4764
|
+
axis: "X",
|
|
4765
|
+
scale,
|
|
4766
|
+
viewLength: width,
|
|
4767
|
+
viewOffset: offsetLeft
|
|
4768
|
+
});
|
|
4769
|
+
}
|
|
4770
|
+
function calcYRulerScaleList(opts) {
|
|
4771
|
+
const { viewScaleInfo, viewSizeInfo } = opts;
|
|
4772
|
+
const { scale, offsetTop } = viewScaleInfo;
|
|
4773
|
+
const { height } = viewSizeInfo;
|
|
4774
|
+
return calcRulerScaleList({
|
|
4775
|
+
axis: "Y",
|
|
4776
|
+
scale,
|
|
4777
|
+
viewLength: height,
|
|
4778
|
+
viewOffset: offsetTop
|
|
4779
|
+
});
|
|
4780
|
+
}
|
|
4781
|
+
function drawXRuler(ctx, opts) {
|
|
4782
|
+
const { scaleList } = opts;
|
|
4783
|
+
const scaleDrawStart = rulerSize;
|
|
4784
|
+
const scaleDrawEnd = rulerSize * 4 / 5;
|
|
4785
|
+
const subKeyScaleDrawEnd = rulerSize * 2 / 5;
|
|
4786
|
+
const keyScaleDrawEnd = rulerSize * 1 / 5;
|
|
4787
|
+
const fontStart = rulerSize / 5;
|
|
4788
|
+
for (let i = 0; i < scaleList.length; i++) {
|
|
4789
|
+
const item = scaleList[i];
|
|
4790
|
+
if (item.position < rulerSize) {
|
|
4791
|
+
continue;
|
|
4792
|
+
}
|
|
4793
|
+
ctx.beginPath();
|
|
4794
|
+
ctx.moveTo(item.position, scaleDrawStart);
|
|
4795
|
+
ctx.lineTo(item.position, item.isKeyNum ? keyScaleDrawEnd : item.isSubKeyNum ? subKeyScaleDrawEnd : scaleDrawEnd);
|
|
4796
|
+
ctx.closePath();
|
|
4797
|
+
ctx.fillStyle = scaleColor;
|
|
4798
|
+
ctx.stroke();
|
|
4799
|
+
if (item.isKeyNum) {
|
|
4800
|
+
ctx.fillStyle = textColor;
|
|
4801
|
+
ctx.textBaseline = "top";
|
|
4802
|
+
ctx.$setFont({
|
|
4803
|
+
fontWeight,
|
|
4804
|
+
fontSize,
|
|
4805
|
+
fontFamily
|
|
4806
|
+
});
|
|
4807
|
+
ctx.fillText(`${item.num}`, item.position + fontStart, fontStart);
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4810
|
+
}
|
|
4811
|
+
function drawYRuler(ctx, opts) {
|
|
4812
|
+
const { scaleList } = opts;
|
|
4813
|
+
const scaleDrawStart = rulerSize;
|
|
4814
|
+
const scaleDrawEnd = rulerSize * 4 / 5;
|
|
4815
|
+
const subKeyScaleDrawEnd = rulerSize * 2 / 5;
|
|
4816
|
+
const keyScaleDrawEnd = rulerSize * 1 / 5;
|
|
4817
|
+
const fontStart = rulerSize / 5;
|
|
4818
|
+
for (let i = 0; i < scaleList.length; i++) {
|
|
4819
|
+
const item = scaleList[i];
|
|
4820
|
+
if (item.position < rulerSize) {
|
|
4821
|
+
continue;
|
|
4822
|
+
}
|
|
4823
|
+
ctx.beginPath();
|
|
4824
|
+
ctx.moveTo(scaleDrawStart, item.position);
|
|
4825
|
+
ctx.lineTo(item.isKeyNum ? keyScaleDrawEnd : item.isSubKeyNum ? subKeyScaleDrawEnd : scaleDrawEnd, item.position);
|
|
4826
|
+
ctx.closePath();
|
|
4827
|
+
ctx.fillStyle = scaleColor;
|
|
4828
|
+
ctx.stroke();
|
|
4829
|
+
if (item.showNum === true) {
|
|
4830
|
+
const textX = fontStart;
|
|
4831
|
+
const textY = item.position + fontStart;
|
|
4832
|
+
const numText = `${item.num}`;
|
|
4833
|
+
rotateByCenter(ctx, -90, { x: textX, y: textY }, () => {
|
|
4834
|
+
ctx.fillStyle = textColor;
|
|
4835
|
+
ctx.textBaseline = "top";
|
|
4836
|
+
ctx.$setFont({
|
|
4837
|
+
fontWeight,
|
|
4838
|
+
fontSize,
|
|
4839
|
+
fontFamily
|
|
4840
|
+
});
|
|
4841
|
+
ctx.fillText(numText, fontStart + fontSize, item.position + fontStart);
|
|
4842
|
+
});
|
|
4843
|
+
}
|
|
4844
|
+
}
|
|
4845
|
+
}
|
|
4846
|
+
function drawRulerBackground(ctx, opts) {
|
|
4847
|
+
const { viewSizeInfo } = opts;
|
|
4848
|
+
const { width, height } = viewSizeInfo;
|
|
4849
|
+
ctx.beginPath();
|
|
4850
|
+
ctx.moveTo(0, 0);
|
|
4851
|
+
ctx.lineTo(width + 1, 0);
|
|
4852
|
+
ctx.lineTo(width + 1, rulerSize);
|
|
4853
|
+
ctx.lineTo(rulerSize, rulerSize);
|
|
4854
|
+
ctx.lineTo(rulerSize, height + 1);
|
|
4855
|
+
ctx.lineTo(0, height + 1);
|
|
4856
|
+
ctx.lineTo(0, 0);
|
|
4857
|
+
ctx.closePath();
|
|
4858
|
+
ctx.fillStyle = background;
|
|
4859
|
+
ctx.fill();
|
|
4860
|
+
ctx.strokeStyle = borderColor;
|
|
4861
|
+
ctx.stroke();
|
|
4862
|
+
}
|
|
4863
|
+
function drawUnderGrid(ctx, opts) {
|
|
4864
|
+
const { xList, yList, viewSizeInfo } = opts;
|
|
4865
|
+
const { width, height } = viewSizeInfo;
|
|
4866
|
+
for (let i = 0; i < xList.length; i++) {
|
|
4867
|
+
const item = xList[i];
|
|
4868
|
+
ctx.beginPath();
|
|
4869
|
+
ctx.moveTo(item.position, 0);
|
|
4870
|
+
ctx.lineTo(item.position, height);
|
|
4871
|
+
if (item.isKeyNum === true || item.isSubKeyNum === true) {
|
|
4872
|
+
ctx.strokeStyle = gridKeyColor;
|
|
4873
|
+
} else {
|
|
4874
|
+
ctx.strokeStyle = gridColor;
|
|
4875
|
+
}
|
|
4876
|
+
ctx.lineWidth = 1;
|
|
4877
|
+
ctx.closePath();
|
|
4878
|
+
ctx.stroke();
|
|
4879
|
+
}
|
|
4880
|
+
for (let i = 0; i < yList.length; i++) {
|
|
4881
|
+
const item = yList[i];
|
|
4882
|
+
ctx.beginPath();
|
|
4883
|
+
ctx.moveTo(0, item.position);
|
|
4884
|
+
ctx.lineTo(width, item.position);
|
|
4885
|
+
if (item.isKeyNum === true || item.isSubKeyNum === true) {
|
|
4886
|
+
ctx.strokeStyle = gridKeyColor;
|
|
4887
|
+
} else {
|
|
4888
|
+
ctx.strokeStyle = gridColor;
|
|
4889
|
+
}
|
|
4890
|
+
ctx.lineWidth = 1;
|
|
4891
|
+
ctx.closePath();
|
|
4892
|
+
ctx.stroke();
|
|
4893
|
+
}
|
|
4894
|
+
}
|
|
4895
|
+
const middlewareEventRuler = "@middleware/show-ruler";
|
|
4896
|
+
const MiddlewareRuler = (opts) => {
|
|
4897
|
+
const key2 = "RULE";
|
|
4898
|
+
const { viewContent, viewer, eventHub } = opts;
|
|
4899
|
+
const { helperContext, underContext } = viewContent;
|
|
4900
|
+
let showRuler = true;
|
|
4901
|
+
eventHub.on(middlewareEventRuler, (e) => {
|
|
4902
|
+
if (typeof (e == null ? void 0 : e.show) === "boolean") {
|
|
4903
|
+
showRuler = e.show;
|
|
4904
|
+
viewer.drawFrame();
|
|
4905
|
+
}
|
|
4906
|
+
});
|
|
4907
|
+
return {
|
|
4908
|
+
mode: key2,
|
|
4909
|
+
isDefault: true,
|
|
4910
|
+
beforeDrawFrame: ({ snapshot }) => {
|
|
4911
|
+
if (showRuler === true) {
|
|
4912
|
+
const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
|
|
4913
|
+
const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
|
|
4914
|
+
drawRulerBackground(helperContext, { viewScaleInfo, viewSizeInfo });
|
|
4915
|
+
const xList = calcXRulerScaleList({ viewScaleInfo, viewSizeInfo });
|
|
4916
|
+
drawXRuler(helperContext, { scaleList: xList });
|
|
4917
|
+
const yList = calcYRulerScaleList({ viewScaleInfo, viewSizeInfo });
|
|
4918
|
+
drawYRuler(helperContext, { scaleList: yList });
|
|
4919
|
+
drawUnderGrid(underContext, {
|
|
4920
|
+
xList,
|
|
4921
|
+
yList,
|
|
4922
|
+
viewScaleInfo,
|
|
4923
|
+
viewSizeInfo
|
|
4924
|
+
});
|
|
4925
|
+
}
|
|
4426
4926
|
}
|
|
4427
4927
|
};
|
|
4428
4928
|
};
|
|
@@ -4464,6 +4964,8 @@ var iDrawCore = function(exports) {
|
|
|
4464
4964
|
}
|
|
4465
4965
|
scale(opts) {
|
|
4466
4966
|
this._board.scale(opts);
|
|
4967
|
+
const viewer = this._board.getViewer();
|
|
4968
|
+
viewer.drawFrame();
|
|
4467
4969
|
}
|
|
4468
4970
|
resize(newViewSize) {
|
|
4469
4971
|
const { _board: board } = this;
|
|
@@ -4491,9 +4993,13 @@ var iDrawCore = function(exports) {
|
|
|
4491
4993
|
}
|
|
4492
4994
|
}
|
|
4493
4995
|
exports.Core = Core;
|
|
4996
|
+
exports.MiddlewareRuler = MiddlewareRuler;
|
|
4494
4997
|
exports.MiddlewareScaler = MiddlewareScaler;
|
|
4495
4998
|
exports.MiddlewareScroller = MiddlewareScroller;
|
|
4496
4999
|
exports.MiddlewareSelector = MiddlewareSelector;
|
|
5000
|
+
exports.middlewareEventRuler = middlewareEventRuler;
|
|
5001
|
+
exports.middlewareEventScale = middlewareEventScale;
|
|
5002
|
+
exports.middlewareEventSelect = middlewareEventSelect;
|
|
4497
5003
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4498
5004
|
return exports;
|
|
4499
5005
|
}({});
|