@visactor/vchart 1.12.6 → 1.12.7
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/build/es5/index.js +2 -2
- package/build/index.js +1011 -864
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/base/base-chart.d.ts +1 -0
- package/cjs/chart/base/base-chart.js +15 -9
- package/cjs/chart/base/base-chart.js.map +1 -1
- package/cjs/chart/chart-meta/data.d.ts +1 -2
- package/cjs/chart/chart-meta/data.js +11 -11
- package/cjs/chart/chart-meta/data.js.map +1 -1
- package/cjs/compile/compilable-base.js +2 -1
- package/cjs/compile/util.js +1 -2
- package/cjs/component/axis/cartesian/axis.js +4 -2
- package/cjs/component/axis/cartesian/axis.js.map +1 -1
- package/cjs/component/axis/polar/interface/spec.js.map +1 -1
- package/cjs/component/data-zoom/data-filter-base-component.js +10 -7
- package/cjs/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/cjs/component/data-zoom/util.js +11 -3
- package/cjs/component/data-zoom/util.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/vchart.js +2 -5
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/data/initialize.d.ts +1 -2
- package/cjs/data/initialize.js +5 -5
- package/cjs/data/initialize.js.map +1 -1
- package/cjs/plugin/chart/media-query/media-query.d.ts +1 -0
- package/cjs/plugin/chart/media-query/media-query.js +3 -1
- package/cjs/plugin/chart/media-query/media-query.js.map +1 -1
- package/cjs/plugin/chart/plugin-service.d.ts +2 -0
- package/cjs/plugin/chart/plugin-service.js +5 -0
- package/cjs/plugin/chart/plugin-service.js.map +1 -1
- package/cjs/series/base/base-series.js +3 -4
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/funnel/funnel.d.ts +1 -0
- package/cjs/series/funnel/funnel.js +7 -6
- package/cjs/series/funnel/funnel.js.map +1 -1
- package/cjs/series/funnel/interface.d.ts +3 -1
- package/cjs/series/funnel/interface.js.map +1 -1
- package/cjs/theme/builtin/common/series/linear-progress.js +4 -1
- package/cjs/theme/builtin/common/series/linear-progress.js.map +1 -1
- package/cjs/theme/builtin/dark/color-scheme.js +2 -1
- package/cjs/theme/builtin/dark/color-scheme.js.map +1 -1
- package/cjs/theme/builtin/light/color-scheme.js +2 -1
- package/cjs/theme/builtin/light/color-scheme.js.map +1 -1
- package/esm/chart/base/base-chart.d.ts +1 -0
- package/esm/chart/base/base-chart.js +16 -10
- package/esm/chart/base/base-chart.js.map +1 -1
- package/esm/chart/chart-meta/data.d.ts +1 -2
- package/esm/chart/chart-meta/data.js +12 -10
- package/esm/chart/chart-meta/data.js.map +1 -1
- package/esm/compile/compilable-base.js +2 -1
- package/esm/compile/util.js +1 -2
- package/esm/component/axis/cartesian/axis.js +5 -3
- package/esm/component/axis/cartesian/axis.js.map +1 -1
- package/esm/component/axis/polar/interface/spec.js.map +1 -1
- package/esm/component/data-zoom/data-filter-base-component.js +7 -6
- package/esm/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/esm/component/data-zoom/util.js +11 -2
- package/esm/component/data-zoom/util.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/core/vchart.js +2 -5
- package/esm/core/vchart.js.map +1 -1
- package/esm/data/initialize.d.ts +1 -2
- package/esm/data/initialize.js +6 -7
- package/esm/data/initialize.js.map +1 -1
- package/esm/plugin/chart/media-query/media-query.d.ts +1 -0
- package/esm/plugin/chart/media-query/media-query.js +3 -1
- package/esm/plugin/chart/media-query/media-query.js.map +1 -1
- package/esm/plugin/chart/plugin-service.d.ts +2 -0
- package/esm/plugin/chart/plugin-service.js +5 -0
- package/esm/plugin/chart/plugin-service.js.map +1 -1
- package/esm/series/base/base-series.js +3 -4
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/funnel/funnel.d.ts +1 -0
- package/esm/series/funnel/funnel.js +7 -6
- package/esm/series/funnel/funnel.js.map +1 -1
- package/esm/series/funnel/interface.d.ts +3 -1
- package/esm/series/funnel/interface.js.map +1 -1
- package/esm/theme/builtin/common/series/linear-progress.js +4 -1
- package/esm/theme/builtin/common/series/linear-progress.js.map +1 -1
- package/esm/theme/builtin/dark/color-scheme.js +2 -1
- package/esm/theme/builtin/dark/color-scheme.js.map +1 -1
- package/esm/theme/builtin/light/color-scheme.js +2 -1
- package/esm/theme/builtin/light/color-scheme.js.map +1 -1
- package/package.json +17 -17
package/build/index.js
CHANGED
|
@@ -1167,6 +1167,602 @@
|
|
|
1167
1167
|
}
|
|
1168
1168
|
}
|
|
1169
1169
|
|
|
1170
|
+
function degreeToRadian(degree) {
|
|
1171
|
+
return degree * (Math.PI / 180);
|
|
1172
|
+
}
|
|
1173
|
+
function radianToDegree(radian) {
|
|
1174
|
+
return 180 * radian / Math.PI;
|
|
1175
|
+
}
|
|
1176
|
+
const clampRadian = function () {
|
|
1177
|
+
let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
1178
|
+
if (angle < 0) for (; angle < -tau$1;) angle += tau$1;else if (angle > 0) for (; angle > tau$1;) angle -= tau$1;
|
|
1179
|
+
return angle;
|
|
1180
|
+
};
|
|
1181
|
+
const clampAngleByRadian = clampRadian;
|
|
1182
|
+
function polarToCartesian(center, radius, angleInRadian) {
|
|
1183
|
+
return radius ? {
|
|
1184
|
+
x: center.x + radius * Math.cos(angleInRadian),
|
|
1185
|
+
y: center.y + radius * Math.sin(angleInRadian)
|
|
1186
|
+
} : {
|
|
1187
|
+
x: center.x,
|
|
1188
|
+
y: center.y
|
|
1189
|
+
};
|
|
1190
|
+
}
|
|
1191
|
+
function cartesianToPolar(point) {
|
|
1192
|
+
let center = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
1193
|
+
x: 0,
|
|
1194
|
+
y: 0
|
|
1195
|
+
};
|
|
1196
|
+
let startAngle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1197
|
+
let endAngle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 2 * Math.PI;
|
|
1198
|
+
const {
|
|
1199
|
+
x: x,
|
|
1200
|
+
y: y
|
|
1201
|
+
} = point,
|
|
1202
|
+
{
|
|
1203
|
+
x: centerX,
|
|
1204
|
+
y: centerY
|
|
1205
|
+
} = center;
|
|
1206
|
+
let dx = x - centerX,
|
|
1207
|
+
dy = y - centerY;
|
|
1208
|
+
const radius = Math.sqrt(dx * dx + dy * dy);
|
|
1209
|
+
if (0 === radius) return {
|
|
1210
|
+
radius: 0,
|
|
1211
|
+
angle: 0
|
|
1212
|
+
};
|
|
1213
|
+
dx /= radius, dy /= radius;
|
|
1214
|
+
let radian = Math.atan2(dy, dx);
|
|
1215
|
+
if (radian < startAngle) for (; radian <= startAngle;) radian += 2 * Math.PI;
|
|
1216
|
+
if (radian > endAngle) for (; radian >= endAngle;) radian -= 2 * Math.PI;
|
|
1217
|
+
return {
|
|
1218
|
+
radius: radius,
|
|
1219
|
+
angle: radian
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1222
|
+
function getAngleByPoint(center, point) {
|
|
1223
|
+
return Math.atan2(point.y - center.y, point.x - center.x);
|
|
1224
|
+
}
|
|
1225
|
+
function normalizeAngle(angle) {
|
|
1226
|
+
for (; angle < 0;) angle += 2 * Math.PI;
|
|
1227
|
+
for (; angle >= 2 * Math.PI;) angle -= 2 * Math.PI;
|
|
1228
|
+
return angle;
|
|
1229
|
+
}
|
|
1230
|
+
function findBoundaryAngles(startAngle, endAngle) {
|
|
1231
|
+
const deltaAngle = Math.abs(endAngle - startAngle);
|
|
1232
|
+
if (deltaAngle >= 2 * Math.PI || 2 * Math.PI - deltaAngle < 1e-6) return [0, Math.PI / 2, Math.PI, 1.5 * Math.PI];
|
|
1233
|
+
const normalMin = normalizeAngle(Math.min(startAngle, endAngle)),
|
|
1234
|
+
normalMax = normalMin + deltaAngle,
|
|
1235
|
+
steps = [normalMin, normalMax];
|
|
1236
|
+
let directionAngle = Math.floor(normalMin / Math.PI) * Math.PI / 2;
|
|
1237
|
+
for (; directionAngle < normalMax;) directionAngle > normalMin && steps.push(directionAngle), directionAngle += Math.PI / 2;
|
|
1238
|
+
return steps;
|
|
1239
|
+
}
|
|
1240
|
+
function calculateMaxRadius(rect, center, startAngle, endAngle) {
|
|
1241
|
+
const {
|
|
1242
|
+
x: x,
|
|
1243
|
+
y: y
|
|
1244
|
+
} = center,
|
|
1245
|
+
steps = findBoundaryAngles(startAngle, endAngle),
|
|
1246
|
+
{
|
|
1247
|
+
width: width,
|
|
1248
|
+
height: height
|
|
1249
|
+
} = rect,
|
|
1250
|
+
radiusList = [];
|
|
1251
|
+
return steps.forEach(step => {
|
|
1252
|
+
const sin = Math.sin(step),
|
|
1253
|
+
cos = Math.cos(step);
|
|
1254
|
+
1 === sin ? radiusList.push(height - y) : -1 === sin ? radiusList.push(y) : 1 === cos ? radiusList.push(width - x) : -1 === cos ? radiusList.push(x) : (sin > 0 ? radiusList.push(Math.abs((height - y) / cos)) : radiusList.push(Math.abs(y / cos)), cos > 0 ? radiusList.push(Math.abs((width - x) / sin)) : radiusList.push(Math.abs(x / sin)));
|
|
1255
|
+
}), Math.min.apply(null, radiusList);
|
|
1256
|
+
}
|
|
1257
|
+
function computeQuadrant(angle) {
|
|
1258
|
+
return (angle = normalizeAngle(angle)) > 0 && angle <= Math.PI / 2 ? 2 : angle > Math.PI / 2 && angle <= Math.PI ? 3 : angle > Math.PI && angle <= 3 * Math.PI / 2 ? 4 : 1;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
function sub(out, v1, v2) {
|
|
1262
|
+
out[0] = v1[0] - v2[0], out[1] = v1[1] - v2[1];
|
|
1263
|
+
}
|
|
1264
|
+
function isIntersect(left1, right1, left2, right2) {
|
|
1265
|
+
let min1 = left1[0],
|
|
1266
|
+
max1 = right1[0],
|
|
1267
|
+
min2 = left2[0],
|
|
1268
|
+
max2 = right2[0];
|
|
1269
|
+
return max1 < min1 && ([min1, max1] = [max1, min1]), max2 < min2 && ([max2, min2] = [min2, max2]), !(max1 < min2 || max2 < min1) && (min1 = left1[1], max1 = right1[1], min2 = left2[1], max2 = right2[1], max1 < min1 && ([min1, max1] = [max1, min1]), max2 < min2 && ([max2, min2] = [min2, max2]), !(max1 < min2 || max2 < min1));
|
|
1270
|
+
}
|
|
1271
|
+
function getIntersectPoint(left1, right1, left2, right2) {
|
|
1272
|
+
if (!isIntersect(left1, right1, left2, right2)) return !1;
|
|
1273
|
+
const dir1 = [0, 0],
|
|
1274
|
+
dir2 = [0, 0],
|
|
1275
|
+
tempVec = [0, 0];
|
|
1276
|
+
if (sub(dir1, right1, left1), sub(dir2, right2, left2), fuzzyEqualVec(dir1, dir2)) return !0;
|
|
1277
|
+
sub(tempVec, left2, left1);
|
|
1278
|
+
const t = crossProduct$1(tempVec, dir2) / crossProduct$1(dir1, dir2);
|
|
1279
|
+
return t >= 0 && t <= 1 && [left1[0] + dir1[0] * t, left1[1] + dir1[1] * t];
|
|
1280
|
+
}
|
|
1281
|
+
function getRectIntersect(bbox1, bbox2, format) {
|
|
1282
|
+
if (null === bbox1) return bbox2;
|
|
1283
|
+
if (null === bbox2) return bbox1;
|
|
1284
|
+
const {
|
|
1285
|
+
x11: x11,
|
|
1286
|
+
x12: x12,
|
|
1287
|
+
y11: y11,
|
|
1288
|
+
y12: y12,
|
|
1289
|
+
x21: x21,
|
|
1290
|
+
x22: x22,
|
|
1291
|
+
y21: y21,
|
|
1292
|
+
y22: y22
|
|
1293
|
+
} = formatTwoBBox(bbox1, bbox2, format);
|
|
1294
|
+
return x11 >= x22 || x12 <= x21 || y11 >= y22 || y12 <= y21 ? {
|
|
1295
|
+
x1: 0,
|
|
1296
|
+
y1: 0,
|
|
1297
|
+
x2: 0,
|
|
1298
|
+
y2: 0
|
|
1299
|
+
} : {
|
|
1300
|
+
x1: Math.max(x11, x21),
|
|
1301
|
+
y1: Math.max(y11, y21),
|
|
1302
|
+
x2: Math.min(x12, x22),
|
|
1303
|
+
y2: Math.min(y12, y22)
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1306
|
+
var InnerBBox;
|
|
1307
|
+
!function (InnerBBox) {
|
|
1308
|
+
InnerBBox[InnerBBox.NONE = 0] = "NONE", InnerBBox[InnerBBox.BBOX1 = 1] = "BBOX1", InnerBBox[InnerBBox.BBOX2 = 2] = "BBOX2";
|
|
1309
|
+
}(InnerBBox || (InnerBBox = {}));
|
|
1310
|
+
const formatTwoBBox = (bbox1, bbox2, format) => {
|
|
1311
|
+
let x11 = bbox1.x1,
|
|
1312
|
+
x12 = bbox1.x2,
|
|
1313
|
+
y11 = bbox1.y1,
|
|
1314
|
+
y12 = bbox1.y2,
|
|
1315
|
+
x21 = bbox2.x1,
|
|
1316
|
+
x22 = bbox2.x2,
|
|
1317
|
+
y21 = bbox2.y1,
|
|
1318
|
+
y22 = bbox2.y2;
|
|
1319
|
+
return format && (x11 > x12 && ([x11, x12] = [x12, x11]), y11 > y12 && ([y11, y12] = [y12, y11]), x21 > x22 && ([x21, x22] = [x22, x21]), y21 > y22 && ([y21, y22] = [y22, y21])), {
|
|
1320
|
+
x11: x11,
|
|
1321
|
+
x12: x12,
|
|
1322
|
+
y11: y11,
|
|
1323
|
+
y12: y12,
|
|
1324
|
+
x21: x21,
|
|
1325
|
+
x22: x22,
|
|
1326
|
+
y21: y21,
|
|
1327
|
+
y22: y22
|
|
1328
|
+
};
|
|
1329
|
+
};
|
|
1330
|
+
function rectInsideAnotherRect(bbox1, bbox2, format) {
|
|
1331
|
+
if (!bbox1 || !bbox2) return InnerBBox.NONE;
|
|
1332
|
+
const {
|
|
1333
|
+
x11: x11,
|
|
1334
|
+
x12: x12,
|
|
1335
|
+
y11: y11,
|
|
1336
|
+
y12: y12,
|
|
1337
|
+
x21: x21,
|
|
1338
|
+
x22: x22,
|
|
1339
|
+
y21: y21,
|
|
1340
|
+
y22: y22
|
|
1341
|
+
} = formatTwoBBox(bbox1, bbox2, format);
|
|
1342
|
+
return x11 > x21 && x12 < x22 && y11 > y21 && y12 < y22 ? InnerBBox.BBOX1 : x21 > x11 && x22 < x12 && y21 > y11 && y22 < y12 ? InnerBBox.BBOX2 : InnerBBox.NONE;
|
|
1343
|
+
}
|
|
1344
|
+
function isRectIntersect(bbox1, bbox2, format) {
|
|
1345
|
+
if (bbox1 && bbox2) {
|
|
1346
|
+
if (!format) return !(bbox1.x1 > bbox2.x2 || bbox1.x2 < bbox2.x1 || bbox1.y1 > bbox2.y2 || bbox1.y2 < bbox2.y1);
|
|
1347
|
+
const {
|
|
1348
|
+
x11: x11,
|
|
1349
|
+
x12: x12,
|
|
1350
|
+
y11: y11,
|
|
1351
|
+
y12: y12,
|
|
1352
|
+
x21: x21,
|
|
1353
|
+
x22: x22,
|
|
1354
|
+
y21: y21,
|
|
1355
|
+
y22: y22
|
|
1356
|
+
} = formatTwoBBox(bbox1, bbox2, !0);
|
|
1357
|
+
return !(x11 > x22 || x12 < x21 || y11 > y22 || y12 < y21);
|
|
1358
|
+
}
|
|
1359
|
+
return !0;
|
|
1360
|
+
}
|
|
1361
|
+
function pointInRect(point, bbox, format) {
|
|
1362
|
+
if (!bbox) return !0;
|
|
1363
|
+
if (!format) return point.x >= bbox.x1 && point.x <= bbox.x2 && point.y >= bbox.y1 && point.y <= bbox.y2;
|
|
1364
|
+
let x11 = bbox.x1,
|
|
1365
|
+
x12 = bbox.x2,
|
|
1366
|
+
y11 = bbox.y1,
|
|
1367
|
+
y12 = bbox.y2;
|
|
1368
|
+
return x11 > x12 && ([x11, x12] = [x12, x11]), y11 > y12 && ([y11, y12] = [y12, y11]), point.x >= x11 && point.x <= x12 && point.y >= y11 && point.y <= y12;
|
|
1369
|
+
}
|
|
1370
|
+
function getProjectionRadius(checkAxis, axis) {
|
|
1371
|
+
return Math.abs(axis[0] * checkAxis[0] + axis[1] * checkAxis[1]);
|
|
1372
|
+
}
|
|
1373
|
+
function rotatePoint(_ref, rad) {
|
|
1374
|
+
let {
|
|
1375
|
+
x: x,
|
|
1376
|
+
y: y
|
|
1377
|
+
} = _ref;
|
|
1378
|
+
let origin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
1379
|
+
x: 0,
|
|
1380
|
+
y: 0
|
|
1381
|
+
};
|
|
1382
|
+
return {
|
|
1383
|
+
x: (x - origin.x) * Math.cos(rad) - (y - origin.y) * Math.sin(rad) + origin.x,
|
|
1384
|
+
y: (x - origin.x) * Math.sin(rad) + (y - origin.y) * Math.cos(rad) + origin.y
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
function getCenterPoint(box) {
|
|
1388
|
+
return {
|
|
1389
|
+
x: (box.x1 + box.x2) / 2,
|
|
1390
|
+
y: (box.y1 + box.y2) / 2
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
function toRect$1(box, isDeg) {
|
|
1394
|
+
const deg = isDeg ? degreeToRadian(box.angle) : box.angle,
|
|
1395
|
+
cp = getCenterPoint(box);
|
|
1396
|
+
return [rotatePoint({
|
|
1397
|
+
x: box.x1,
|
|
1398
|
+
y: box.y1
|
|
1399
|
+
}, deg, cp), rotatePoint({
|
|
1400
|
+
x: box.x2,
|
|
1401
|
+
y: box.y1
|
|
1402
|
+
}, deg, cp), rotatePoint({
|
|
1403
|
+
x: box.x2,
|
|
1404
|
+
y: box.y2
|
|
1405
|
+
}, deg, cp), rotatePoint({
|
|
1406
|
+
x: box.x1,
|
|
1407
|
+
y: box.y2
|
|
1408
|
+
}, deg, cp)];
|
|
1409
|
+
}
|
|
1410
|
+
function isRotateAABBIntersect(box1, box2) {
|
|
1411
|
+
let isDeg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
|
1412
|
+
let ctx = arguments.length > 3 ? arguments[3] : undefined;
|
|
1413
|
+
const rect1 = toRect$1(box1, isDeg),
|
|
1414
|
+
rect2 = toRect$1(box2, isDeg),
|
|
1415
|
+
vector = (start, end) => [end.x - start.x, end.y - start.y];
|
|
1416
|
+
ctx && (ctx.save(), ctx.fillStyle = "red", ctx.globalAlpha = .6, rect1.forEach((item, index) => {
|
|
1417
|
+
0 === index ? ctx.moveTo(item.x, item.y) : ctx.lineTo(item.x, item.y);
|
|
1418
|
+
}), ctx.fill(), ctx.restore(), ctx.save(), ctx.fillStyle = "green", ctx.globalAlpha = .6, rect2.forEach((item, index) => {
|
|
1419
|
+
0 === index ? ctx.moveTo(item.x, item.y) : ctx.lineTo(item.x, item.y);
|
|
1420
|
+
}), ctx.fill(), ctx.restore());
|
|
1421
|
+
const p1 = getCenterPoint(box1),
|
|
1422
|
+
p2 = getCenterPoint(box2);
|
|
1423
|
+
ctx && ctx.fillRect(p1.x, p1.y, 2, 2), ctx && ctx.fillRect(p2.x, p2.y, 2, 2);
|
|
1424
|
+
const vp1p2 = vector(p1, p2),
|
|
1425
|
+
AB = vector(rect1[0], rect1[1]),
|
|
1426
|
+
BC = vector(rect1[1], rect1[2]),
|
|
1427
|
+
A1B1 = vector(rect2[0], rect2[1]),
|
|
1428
|
+
B1C1 = vector(rect2[1], rect2[2]),
|
|
1429
|
+
deg11 = isDeg ? degreeToRadian(box1.angle) : box1.angle;
|
|
1430
|
+
let deg12 = isDeg ? degreeToRadian(90 - box1.angle) : box1.angle + halfPi$2;
|
|
1431
|
+
const deg21 = isDeg ? degreeToRadian(box2.angle) : box2.angle;
|
|
1432
|
+
let deg22 = isDeg ? degreeToRadian(90 - box2.angle) : box2.angle + halfPi$2;
|
|
1433
|
+
deg12 > pi2 && (deg12 -= pi2), deg22 > pi2 && (deg22 -= pi2);
|
|
1434
|
+
const isCover = (checkAxisRadius, deg, targetAxis1, targetAxis2) => {
|
|
1435
|
+
const checkAxis = [Math.cos(deg), Math.sin(deg)];
|
|
1436
|
+
return checkAxisRadius + (getProjectionRadius(checkAxis, targetAxis1) + getProjectionRadius(checkAxis, targetAxis2)) / 2 > getProjectionRadius(checkAxis, vp1p2);
|
|
1437
|
+
};
|
|
1438
|
+
return isCover((box1.x2 - box1.x1) / 2, deg11, A1B1, B1C1) && isCover((box1.y2 - box1.y1) / 2, deg12, A1B1, B1C1) && isCover((box2.x2 - box2.x1) / 2, deg21, AB, BC) && isCover((box2.y2 - box2.y1) / 2, deg22, AB, BC);
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
let x1$1, y1$1, x2, y2;
|
|
1442
|
+
function getAABBFromPoints(points) {
|
|
1443
|
+
return x1$1 = 1 / 0, y1$1 = 1 / 0, x2 = -1 / 0, y2 = -1 / 0, points.forEach(point => {
|
|
1444
|
+
x1$1 > point.x && (x1$1 = point.x), x2 < point.x && (x2 = point.x), y1$1 > point.y && (y1$1 = point.y), y2 < point.y && (y2 = point.y);
|
|
1445
|
+
}), {
|
|
1446
|
+
x1: x1$1,
|
|
1447
|
+
y1: y1$1,
|
|
1448
|
+
x2: x2,
|
|
1449
|
+
y2: y2
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
const EPSILON$1 = 1e-8;
|
|
1454
|
+
function lineIntersectPolygon(a1x, a1y, a2x, a2y, points) {
|
|
1455
|
+
for (let i = 0, p2 = points[points.length - 1]; i < points.length; i++) {
|
|
1456
|
+
const p = points[i];
|
|
1457
|
+
if (isIntersect([a1x, a1y], [a2x, a2y], [p.x, p.y], [p2.x, p2.y])) return !0;
|
|
1458
|
+
p2 = p;
|
|
1459
|
+
}
|
|
1460
|
+
return !1;
|
|
1461
|
+
}
|
|
1462
|
+
function polygonContainPoint(points, x, y) {
|
|
1463
|
+
let w = 0,
|
|
1464
|
+
p = points[0];
|
|
1465
|
+
if (!p) return !1;
|
|
1466
|
+
for (let i = 1; i < points.length; i++) {
|
|
1467
|
+
const p2 = points[i];
|
|
1468
|
+
w += isPointInLine(p.x, p.y, p2.x, p2.y, x, y), p = p2;
|
|
1469
|
+
}
|
|
1470
|
+
const p0 = points[0];
|
|
1471
|
+
return isAroundEqual$1(p.x, p0.x) && isAroundEqual$1(p.y, p0.y) || (w += isPointInLine(p.x, p.y, p0.x, p0.y, x, y)), 0 !== w;
|
|
1472
|
+
}
|
|
1473
|
+
function isPointInLine(x0, y0, x1, y1, x, y) {
|
|
1474
|
+
if (y > y0 && y > y1 || y < y0 && y < y1) return 0;
|
|
1475
|
+
if (y1 === y0) return 0;
|
|
1476
|
+
const t = (y - y0) / (y1 - y0);
|
|
1477
|
+
let dir = y1 < y0 ? 1 : -1;
|
|
1478
|
+
1 !== t && 0 !== t || (dir = y1 < y0 ? .5 : -.5);
|
|
1479
|
+
const x_ = t * (x1 - x0) + x0;
|
|
1480
|
+
return x_ === x ? 1 / 0 : x_ > x ? dir : 0;
|
|
1481
|
+
}
|
|
1482
|
+
function isAroundEqual$1(a, b) {
|
|
1483
|
+
return Math.abs(a - b) < EPSILON$1;
|
|
1484
|
+
}
|
|
1485
|
+
function polygonIntersectPolygon(pointsA, pointsB) {
|
|
1486
|
+
for (let i = 0; i < pointsB.length; i++) {
|
|
1487
|
+
if (polygonContainPoint(pointsA, pointsB[i].x, pointsB[i].y)) return !0;
|
|
1488
|
+
if (i > 0 && lineIntersectPolygon(pointsB[i - 1].x, pointsB[i - 1].y, pointsB[i].x, pointsB[i].y, pointsA)) return !0;
|
|
1489
|
+
}
|
|
1490
|
+
return !1;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
const eastAsianCharacterInfo = character => {
|
|
1494
|
+
let x = character.charCodeAt(0),
|
|
1495
|
+
y = 2 === character.length ? character.charCodeAt(1) : 0,
|
|
1496
|
+
codePoint = x;
|
|
1497
|
+
return 55296 <= x && x <= 56319 && 56320 <= y && y <= 57343 && (x &= 1023, y &= 1023, codePoint = x << 10 | y, codePoint += 65536), 12288 === codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 ? "F" : 8361 === codePoint || 65377 <= codePoint && codePoint <= 65470 || 65474 <= codePoint && codePoint <= 65479 || 65482 <= codePoint && codePoint <= 65487 || 65490 <= codePoint && codePoint <= 65495 || 65498 <= codePoint && codePoint <= 65500 || 65512 <= codePoint && codePoint <= 65518 ? "H" : 4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141 ? "W" : 32 <= codePoint && codePoint <= 126 || 162 <= codePoint && codePoint <= 163 || 165 <= codePoint && codePoint <= 166 || 172 === codePoint || 175 === codePoint || 10214 <= codePoint && codePoint <= 10221 || 10629 <= codePoint && codePoint <= 10630 ? "Na" : 161 === codePoint || 164 === codePoint || 167 <= codePoint && codePoint <= 168 || 170 === codePoint || 173 <= codePoint && codePoint <= 174 || 176 <= codePoint && codePoint <= 180 || 182 <= codePoint && codePoint <= 186 || 188 <= codePoint && codePoint <= 191 || 198 === codePoint || 208 === codePoint || 215 <= codePoint && codePoint <= 216 || 222 <= codePoint && codePoint <= 225 || 230 === codePoint || 232 <= codePoint && codePoint <= 234 || 236 <= codePoint && codePoint <= 237 || 240 === codePoint || 242 <= codePoint && codePoint <= 243 || 247 <= codePoint && codePoint <= 250 || 252 === codePoint || 254 === codePoint || 257 === codePoint || 273 === codePoint || 275 === codePoint || 283 === codePoint || 294 <= codePoint && codePoint <= 295 || 299 === codePoint || 305 <= codePoint && codePoint <= 307 || 312 === codePoint || 319 <= codePoint && codePoint <= 322 || 324 === codePoint || 328 <= codePoint && codePoint <= 331 || 333 === codePoint || 338 <= codePoint && codePoint <= 339 || 358 <= codePoint && codePoint <= 359 || 363 === codePoint || 462 === codePoint || 464 === codePoint || 466 === codePoint || 468 === codePoint || 470 === codePoint || 472 === codePoint || 474 === codePoint || 476 === codePoint || 593 === codePoint || 609 === codePoint || 708 === codePoint || 711 === codePoint || 713 <= codePoint && codePoint <= 715 || 717 === codePoint || 720 === codePoint || 728 <= codePoint && codePoint <= 731 || 733 === codePoint || 735 === codePoint || 768 <= codePoint && codePoint <= 879 || 913 <= codePoint && codePoint <= 929 || 931 <= codePoint && codePoint <= 937 || 945 <= codePoint && codePoint <= 961 || 963 <= codePoint && codePoint <= 969 || 1025 === codePoint || 1040 <= codePoint && codePoint <= 1103 || 1105 === codePoint || 8208 === codePoint || 8211 <= codePoint && codePoint <= 8214 || 8216 <= codePoint && codePoint <= 8217 || 8220 <= codePoint && codePoint <= 8221 || 8224 <= codePoint && codePoint <= 8226 || 8228 <= codePoint && codePoint <= 8231 || 8240 === codePoint || 8242 <= codePoint && codePoint <= 8243 || 8245 === codePoint || 8251 === codePoint || 8254 === codePoint || 8308 === codePoint || 8319 === codePoint || 8321 <= codePoint && codePoint <= 8324 || 8364 === codePoint || 8451 === codePoint || 8453 === codePoint || 8457 === codePoint || 8467 === codePoint || 8470 === codePoint || 8481 <= codePoint && codePoint <= 8482 || 8486 === codePoint || 8491 === codePoint || 8531 <= codePoint && codePoint <= 8532 || 8539 <= codePoint && codePoint <= 8542 || 8544 <= codePoint && codePoint <= 8555 || 8560 <= codePoint && codePoint <= 8569 || 8585 === codePoint || 8592 <= codePoint && codePoint <= 8601 || 8632 <= codePoint && codePoint <= 8633 || 8658 === codePoint || 8660 === codePoint || 8679 === codePoint || 8704 === codePoint || 8706 <= codePoint && codePoint <= 8707 || 8711 <= codePoint && codePoint <= 8712 || 8715 === codePoint || 8719 === codePoint || 8721 === codePoint || 8725 === codePoint || 8730 === codePoint || 8733 <= codePoint && codePoint <= 8736 || 8739 === codePoint || 8741 === codePoint || 8743 <= codePoint && codePoint <= 8748 || 8750 === codePoint || 8756 <= codePoint && codePoint <= 8759 || 8764 <= codePoint && codePoint <= 8765 || 8776 === codePoint || 8780 === codePoint || 8786 === codePoint || 8800 <= codePoint && codePoint <= 8801 || 8804 <= codePoint && codePoint <= 8807 || 8810 <= codePoint && codePoint <= 8811 || 8814 <= codePoint && codePoint <= 8815 || 8834 <= codePoint && codePoint <= 8835 || 8838 <= codePoint && codePoint <= 8839 || 8853 === codePoint || 8857 === codePoint || 8869 === codePoint || 8895 === codePoint || 8978 === codePoint || 9312 <= codePoint && codePoint <= 9449 || 9451 <= codePoint && codePoint <= 9547 || 9552 <= codePoint && codePoint <= 9587 || 9600 <= codePoint && codePoint <= 9615 || 9618 <= codePoint && codePoint <= 9621 || 9632 <= codePoint && codePoint <= 9633 || 9635 <= codePoint && codePoint <= 9641 || 9650 <= codePoint && codePoint <= 9651 || 9654 <= codePoint && codePoint <= 9655 || 9660 <= codePoint && codePoint <= 9661 || 9664 <= codePoint && codePoint <= 9665 || 9670 <= codePoint && codePoint <= 9672 || 9675 === codePoint || 9678 <= codePoint && codePoint <= 9681 || 9698 <= codePoint && codePoint <= 9701 || 9711 === codePoint || 9733 <= codePoint && codePoint <= 9734 || 9737 === codePoint || 9742 <= codePoint && codePoint <= 9743 || 9748 <= codePoint && codePoint <= 9749 || 9756 === codePoint || 9758 === codePoint || 9792 === codePoint || 9794 === codePoint || 9824 <= codePoint && codePoint <= 9825 || 9827 <= codePoint && codePoint <= 9829 || 9831 <= codePoint && codePoint <= 9834 || 9836 <= codePoint && codePoint <= 9837 || 9839 === codePoint || 9886 <= codePoint && codePoint <= 9887 || 9918 <= codePoint && codePoint <= 9919 || 9924 <= codePoint && codePoint <= 9933 || 9935 <= codePoint && codePoint <= 9953 || 9955 === codePoint || 9960 <= codePoint && codePoint <= 9983 || 10045 === codePoint || 10071 === codePoint || 10102 <= codePoint && codePoint <= 10111 || 11093 <= codePoint && codePoint <= 11097 || 12872 <= codePoint && codePoint <= 12879 || 57344 <= codePoint && codePoint <= 63743 || 65024 <= codePoint && codePoint <= 65039 || 65533 === codePoint || 127232 <= codePoint && codePoint <= 127242 || 127248 <= codePoint && codePoint <= 127277 || 127280 <= codePoint && codePoint <= 127337 || 127344 <= codePoint && codePoint <= 127386 || 917760 <= codePoint && codePoint <= 917999 || 983040 <= codePoint && codePoint <= 1048573 || 1048576 <= codePoint && codePoint <= 1114109 ? "A" : "N";
|
|
1498
|
+
};
|
|
1499
|
+
|
|
1500
|
+
function getContextFont(text) {
|
|
1501
|
+
let defaultAttr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1502
|
+
let fontSizeScale = arguments.length > 2 ? arguments[2] : undefined;
|
|
1503
|
+
fontSizeScale || (fontSizeScale = 1);
|
|
1504
|
+
const {
|
|
1505
|
+
fontStyle = defaultAttr.fontStyle,
|
|
1506
|
+
fontVariant = defaultAttr.fontVariant,
|
|
1507
|
+
fontWeight = defaultAttr.fontWeight,
|
|
1508
|
+
fontSize = defaultAttr.fontSize,
|
|
1509
|
+
fontFamily = defaultAttr.fontFamily
|
|
1510
|
+
} = text;
|
|
1511
|
+
return (fontStyle ? fontStyle + " " : "") + (fontVariant ? fontVariant + " " : "") + (fontWeight ? fontWeight + " " : "") + fontSize * fontSizeScale + "px " + (fontFamily || "sans-serif");
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
class TextMeasure {
|
|
1515
|
+
constructor(option, textSpec) {
|
|
1516
|
+
this._numberCharSize = null, this._fullCharSize = null, this._letterCharSize = null, this._specialCharSizeMap = {}, this._canvas = null, this._context = null, this._contextSaved = !1, this._notSupportCanvas = !1, this._notSupportVRender = !1, this._userSpec = {}, this.specialCharSet = "-/: .,@%'\"~", this._option = option, this._userSpec = null != textSpec ? textSpec : {}, this.textSpec = this._initSpec(), isValid$1(option.specialCharSet) && (this.specialCharSet = option.specialCharSet), this._standardMethod = isValid$1(option.getTextBounds) ? this.fullMeasure.bind(this) : this.measureWithNaiveCanvas.bind(this);
|
|
1517
|
+
}
|
|
1518
|
+
initContext() {
|
|
1519
|
+
if (this._notSupportCanvas) return !1;
|
|
1520
|
+
if (isNil$1(this._canvas) && (isValid$1(this._option.getCanvasForMeasure) && (this._canvas = this._option.getCanvasForMeasure()), isNil$1(this._canvas) && "undefined" != typeof window && void 0 !== window.document && globalThis && isValid$1(globalThis.document) && (this._canvas = globalThis.document.createElement("canvas"))), isNil$1(this._context) && isValid$1(this._canvas)) {
|
|
1521
|
+
const context = this._canvas.getContext("2d");
|
|
1522
|
+
isValid$1(context) && (context.save(), context.font = getContextFont(this.textSpec), this._contextSaved = !0, this._context = context);
|
|
1523
|
+
}
|
|
1524
|
+
return !isNil$1(this._context) || (this._notSupportCanvas = !0, !1);
|
|
1525
|
+
}
|
|
1526
|
+
_initSpec() {
|
|
1527
|
+
var _a, _b, _c;
|
|
1528
|
+
const {
|
|
1529
|
+
defaultFontParams = {}
|
|
1530
|
+
} = this._option,
|
|
1531
|
+
{
|
|
1532
|
+
fontStyle = defaultFontParams.fontStyle,
|
|
1533
|
+
fontVariant = defaultFontParams.fontVariant,
|
|
1534
|
+
fontWeight = null !== (_a = defaultFontParams.fontWeight) && void 0 !== _a ? _a : "normal",
|
|
1535
|
+
fontSize = null !== (_b = defaultFontParams.fontSize) && void 0 !== _b ? _b : 12,
|
|
1536
|
+
fontFamily = null !== (_c = defaultFontParams.fontFamily) && void 0 !== _c ? _c : "sans-serif",
|
|
1537
|
+
align: align,
|
|
1538
|
+
textAlign = null != align ? align : "center",
|
|
1539
|
+
baseline: baseline,
|
|
1540
|
+
textBaseline = null != baseline ? baseline : "middle",
|
|
1541
|
+
ellipsis: ellipsis,
|
|
1542
|
+
limit: limit
|
|
1543
|
+
} = this._userSpec;
|
|
1544
|
+
let {
|
|
1545
|
+
lineHeight = fontSize
|
|
1546
|
+
} = this._userSpec;
|
|
1547
|
+
if (isString$1(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
1548
|
+
const scale = Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100;
|
|
1549
|
+
lineHeight = fontSize * scale;
|
|
1550
|
+
}
|
|
1551
|
+
return {
|
|
1552
|
+
fontStyle: fontStyle,
|
|
1553
|
+
fontVariant: fontVariant,
|
|
1554
|
+
fontFamily: fontFamily,
|
|
1555
|
+
fontSize: fontSize,
|
|
1556
|
+
fontWeight: fontWeight,
|
|
1557
|
+
textAlign: textAlign,
|
|
1558
|
+
textBaseline: textBaseline,
|
|
1559
|
+
ellipsis: ellipsis,
|
|
1560
|
+
limit: limit,
|
|
1561
|
+
lineHeight: lineHeight
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
measure(text, method) {
|
|
1565
|
+
switch (method) {
|
|
1566
|
+
case "vrender":
|
|
1567
|
+
case "canopus":
|
|
1568
|
+
return this.fullMeasure(text);
|
|
1569
|
+
case "canvas":
|
|
1570
|
+
return this.measureWithNaiveCanvas(text);
|
|
1571
|
+
case "simple":
|
|
1572
|
+
return this.quickMeasureWithoutCanvas(text);
|
|
1573
|
+
default:
|
|
1574
|
+
return this.quickMeasure(text);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
fullMeasure(text) {
|
|
1578
|
+
if (isNil$1(text)) return {
|
|
1579
|
+
width: 0,
|
|
1580
|
+
height: 0
|
|
1581
|
+
};
|
|
1582
|
+
if (isNil$1(this._option.getTextBounds) || !this._notSupportVRender) return this.measureWithNaiveCanvas(text);
|
|
1583
|
+
const {
|
|
1584
|
+
fontFamily: fontFamily,
|
|
1585
|
+
fontSize: fontSize,
|
|
1586
|
+
fontWeight: fontWeight,
|
|
1587
|
+
textAlign: textAlign,
|
|
1588
|
+
textBaseline: textBaseline,
|
|
1589
|
+
ellipsis: ellipsis,
|
|
1590
|
+
limit: limit,
|
|
1591
|
+
lineHeight: lineHeight
|
|
1592
|
+
} = this.textSpec;
|
|
1593
|
+
let size;
|
|
1594
|
+
try {
|
|
1595
|
+
const bounds = this._option.getTextBounds({
|
|
1596
|
+
text: text,
|
|
1597
|
+
fontFamily: fontFamily,
|
|
1598
|
+
fontSize: fontSize,
|
|
1599
|
+
fontWeight: fontWeight,
|
|
1600
|
+
textAlign: textAlign,
|
|
1601
|
+
textBaseline: textBaseline,
|
|
1602
|
+
ellipsis: !!ellipsis,
|
|
1603
|
+
maxLineWidth: limit || 1 / 0,
|
|
1604
|
+
lineHeight: lineHeight
|
|
1605
|
+
});
|
|
1606
|
+
size = {
|
|
1607
|
+
width: bounds.width(),
|
|
1608
|
+
height: bounds.height()
|
|
1609
|
+
};
|
|
1610
|
+
} catch (e) {
|
|
1611
|
+
this._notSupportVRender = !0, size = this.measureWithNaiveCanvas(text);
|
|
1612
|
+
}
|
|
1613
|
+
return size;
|
|
1614
|
+
}
|
|
1615
|
+
measureWithNaiveCanvas(text) {
|
|
1616
|
+
return this._measureReduce(text, this._measureWithNaiveCanvas.bind(this));
|
|
1617
|
+
}
|
|
1618
|
+
_measureWithNaiveCanvas(text) {
|
|
1619
|
+
var _a;
|
|
1620
|
+
if (!this.initContext()) return this._quickMeasureWithoutCanvas(text);
|
|
1621
|
+
const metrics = this._context.measureText(text),
|
|
1622
|
+
{
|
|
1623
|
+
fontSize: fontSize,
|
|
1624
|
+
lineHeight: lineHeight
|
|
1625
|
+
} = this.textSpec;
|
|
1626
|
+
return {
|
|
1627
|
+
width: metrics.width,
|
|
1628
|
+
height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize
|
|
1629
|
+
};
|
|
1630
|
+
}
|
|
1631
|
+
quickMeasure(text) {
|
|
1632
|
+
return this._measureReduce(text, this._quickMeasure.bind(this));
|
|
1633
|
+
}
|
|
1634
|
+
_quickMeasure(text) {
|
|
1635
|
+
const totalSize = {
|
|
1636
|
+
width: 0,
|
|
1637
|
+
height: 0
|
|
1638
|
+
};
|
|
1639
|
+
for (let i = 0; i < text.length; i++) {
|
|
1640
|
+
const char = text[i];
|
|
1641
|
+
let size = this._measureSpecialChar(char);
|
|
1642
|
+
isNil$1(size) && TextMeasure.NUMBERS_CHAR_SET.includes(char) && (size = this._measureNumberChar()), isNil$1(size) && ["F", "W"].includes(eastAsianCharacterInfo(char)) && (size = this._measureFullSizeChar()), isNil$1(size) && (size = this._measureLetterChar()), totalSize.width += size.width, totalSize.height = Math.max(totalSize.height, size.height);
|
|
1643
|
+
}
|
|
1644
|
+
return totalSize;
|
|
1645
|
+
}
|
|
1646
|
+
quickMeasureWithoutCanvas(text) {
|
|
1647
|
+
return this._measureReduce(text, this._quickMeasureWithoutCanvas.bind(this));
|
|
1648
|
+
}
|
|
1649
|
+
_quickMeasureWithoutCanvas(text) {
|
|
1650
|
+
var _a;
|
|
1651
|
+
const totalSize = {
|
|
1652
|
+
width: 0,
|
|
1653
|
+
height: 0
|
|
1654
|
+
},
|
|
1655
|
+
{
|
|
1656
|
+
fontSize: fontSize,
|
|
1657
|
+
lineHeight: lineHeight
|
|
1658
|
+
} = this.textSpec;
|
|
1659
|
+
for (let i = 0; i < text.length; i++) {
|
|
1660
|
+
const char = text[i],
|
|
1661
|
+
size = ["F", "W"].includes(eastAsianCharacterInfo(char)) ? 1 : .53;
|
|
1662
|
+
totalSize.width += size * fontSize;
|
|
1663
|
+
}
|
|
1664
|
+
return totalSize.height = null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize, totalSize;
|
|
1665
|
+
}
|
|
1666
|
+
_measureReduce(text, processor) {
|
|
1667
|
+
var _a;
|
|
1668
|
+
const {
|
|
1669
|
+
fontSize: fontSize,
|
|
1670
|
+
lineHeight: lineHeight
|
|
1671
|
+
} = this.textSpec,
|
|
1672
|
+
defaultResult = {
|
|
1673
|
+
width: 0,
|
|
1674
|
+
height: 0
|
|
1675
|
+
};
|
|
1676
|
+
if (isNil$1(text)) return defaultResult;
|
|
1677
|
+
if (isArray$1(text)) {
|
|
1678
|
+
const textArr = text.filter(isValid$1).map(s => s.toString());
|
|
1679
|
+
return 0 === textArr.length ? defaultResult : 1 === textArr.length ? processor(textArr[0]) : {
|
|
1680
|
+
width: textArr.reduce((maxWidth, cur) => Math.max(maxWidth, processor(cur).width), 0),
|
|
1681
|
+
height: textArr.length * ((null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize) + 1) + 1
|
|
1682
|
+
};
|
|
1683
|
+
}
|
|
1684
|
+
return processor(text.toString());
|
|
1685
|
+
}
|
|
1686
|
+
_measureNumberChar() {
|
|
1687
|
+
if (isNil$1(this._numberCharSize)) {
|
|
1688
|
+
const numberBounds = this._standardMethod(TextMeasure.NUMBERS_CHAR_SET);
|
|
1689
|
+
this._numberCharSize = {
|
|
1690
|
+
width: numberBounds.width / TextMeasure.NUMBERS_CHAR_SET.length,
|
|
1691
|
+
height: numberBounds.height
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
return this._numberCharSize;
|
|
1695
|
+
}
|
|
1696
|
+
_measureFullSizeChar() {
|
|
1697
|
+
return isNil$1(this._fullCharSize) && (this._fullCharSize = this._standardMethod(TextMeasure.FULL_SIZE_CHAR)), this._fullCharSize;
|
|
1698
|
+
}
|
|
1699
|
+
_measureLetterChar() {
|
|
1700
|
+
if (isNil$1(this._letterCharSize)) {
|
|
1701
|
+
const alphabetBounds = this._standardMethod(TextMeasure.ALPHABET_CHAR_SET);
|
|
1702
|
+
this._letterCharSize = {
|
|
1703
|
+
width: alphabetBounds.width / TextMeasure.ALPHABET_CHAR_SET.length,
|
|
1704
|
+
height: alphabetBounds.height
|
|
1705
|
+
};
|
|
1706
|
+
}
|
|
1707
|
+
return this._letterCharSize;
|
|
1708
|
+
}
|
|
1709
|
+
_measureSpecialChar(char) {
|
|
1710
|
+
return isValid$1(this._specialCharSizeMap[char]) ? this._specialCharSizeMap[char] : this.specialCharSet.includes(char) ? (this._specialCharSizeMap[char] = this._standardMethod(char), this._specialCharSizeMap[char]) : null;
|
|
1711
|
+
}
|
|
1712
|
+
release() {
|
|
1713
|
+
isValid$1(this._canvas) && (this._canvas = null), isValid$1(this._context) && (this._contextSaved && (this._context.restore(), this._contextSaved = !1), this._context = null);
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
TextMeasure.ALPHABET_CHAR_SET = "abcdefghijklmnopqrstuvwxyz", TextMeasure.NUMBERS_CHAR_SET = "0123456789", TextMeasure.FULL_SIZE_CHAR = "字";
|
|
1717
|
+
|
|
1718
|
+
const calculateAnchorOfBounds = (bounds, anchorType) => {
|
|
1719
|
+
const {
|
|
1720
|
+
x1: x1,
|
|
1721
|
+
x2: x2,
|
|
1722
|
+
y1: y1,
|
|
1723
|
+
y2: y2
|
|
1724
|
+
} = bounds,
|
|
1725
|
+
rectWidth = Math.abs(x2 - x1),
|
|
1726
|
+
rectHeight = Math.abs(y2 - y1);
|
|
1727
|
+
let anchorX = (x1 + x2) / 2,
|
|
1728
|
+
anchorY = (y1 + y2) / 2,
|
|
1729
|
+
sx = 0,
|
|
1730
|
+
sy = 0;
|
|
1731
|
+
switch (anchorType) {
|
|
1732
|
+
case "top":
|
|
1733
|
+
case "inside-top":
|
|
1734
|
+
sy = -.5;
|
|
1735
|
+
break;
|
|
1736
|
+
case "bottom":
|
|
1737
|
+
case "inside-bottom":
|
|
1738
|
+
sy = .5;
|
|
1739
|
+
break;
|
|
1740
|
+
case "left":
|
|
1741
|
+
case "inside-left":
|
|
1742
|
+
sx = -.5;
|
|
1743
|
+
break;
|
|
1744
|
+
case "right":
|
|
1745
|
+
case "inside-right":
|
|
1746
|
+
sx = .5;
|
|
1747
|
+
break;
|
|
1748
|
+
case "top-right":
|
|
1749
|
+
sx = .5, sy = -.5;
|
|
1750
|
+
break;
|
|
1751
|
+
case "top-left":
|
|
1752
|
+
sx = -.5, sy = -.5;
|
|
1753
|
+
break;
|
|
1754
|
+
case "bottom-right":
|
|
1755
|
+
sx = .5, sy = .5;
|
|
1756
|
+
break;
|
|
1757
|
+
case "bottom-left":
|
|
1758
|
+
sx = -.5, sy = .5;
|
|
1759
|
+
}
|
|
1760
|
+
return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
|
|
1761
|
+
x: anchorX,
|
|
1762
|
+
y: anchorY
|
|
1763
|
+
};
|
|
1764
|
+
};
|
|
1765
|
+
|
|
1170
1766
|
function transformBoundsWithMatrix(out, bounds, matrix) {
|
|
1171
1767
|
const {
|
|
1172
1768
|
x1: x1,
|
|
@@ -1305,96 +1901,22 @@
|
|
|
1305
1901
|
}
|
|
1306
1902
|
}
|
|
1307
1903
|
class AABBBounds extends Bounds {}
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
y: center.y + radius * Math.sin(angleInRadian)
|
|
1325
|
-
} : {
|
|
1326
|
-
x: center.x,
|
|
1327
|
-
y: center.y
|
|
1328
|
-
};
|
|
1329
|
-
}
|
|
1330
|
-
function cartesianToPolar(point) {
|
|
1331
|
-
let center = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
1332
|
-
x: 0,
|
|
1333
|
-
y: 0
|
|
1334
|
-
};
|
|
1335
|
-
let startAngle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1336
|
-
let endAngle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 2 * Math.PI;
|
|
1337
|
-
const {
|
|
1338
|
-
x: x,
|
|
1339
|
-
y: y
|
|
1340
|
-
} = point,
|
|
1341
|
-
{
|
|
1342
|
-
x: centerX,
|
|
1343
|
-
y: centerY
|
|
1344
|
-
} = center;
|
|
1345
|
-
let dx = x - centerX,
|
|
1346
|
-
dy = y - centerY;
|
|
1347
|
-
const radius = Math.sqrt(dx * dx + dy * dy);
|
|
1348
|
-
if (0 === radius) return {
|
|
1349
|
-
radius: 0,
|
|
1350
|
-
angle: 0
|
|
1351
|
-
};
|
|
1352
|
-
dx /= radius, dy /= radius;
|
|
1353
|
-
let radian = Math.atan2(dy, dx);
|
|
1354
|
-
if (radian < startAngle) for (; radian <= startAngle;) radian += 2 * Math.PI;
|
|
1355
|
-
if (radian > endAngle) for (; radian >= endAngle;) radian -= 2 * Math.PI;
|
|
1356
|
-
return {
|
|
1357
|
-
radius: radius,
|
|
1358
|
-
angle: radian
|
|
1359
|
-
};
|
|
1360
|
-
}
|
|
1361
|
-
function getAngleByPoint(center, point) {
|
|
1362
|
-
return Math.atan2(point.y - center.y, point.x - center.x);
|
|
1363
|
-
}
|
|
1364
|
-
function normalizeAngle(angle) {
|
|
1365
|
-
for (; angle < 0;) angle += 2 * Math.PI;
|
|
1366
|
-
for (; angle >= 2 * Math.PI;) angle -= 2 * Math.PI;
|
|
1367
|
-
return angle;
|
|
1368
|
-
}
|
|
1369
|
-
function findBoundaryAngles(startAngle, endAngle) {
|
|
1370
|
-
const deltaAngle = Math.abs(endAngle - startAngle);
|
|
1371
|
-
if (deltaAngle >= 2 * Math.PI || 2 * Math.PI - deltaAngle < 1e-6) return [0, Math.PI / 2, Math.PI, 1.5 * Math.PI];
|
|
1372
|
-
const normalMin = normalizeAngle(Math.min(startAngle, endAngle)),
|
|
1373
|
-
normalMax = normalMin + deltaAngle,
|
|
1374
|
-
steps = [normalMin, normalMax];
|
|
1375
|
-
let directionAngle = Math.floor(normalMin / Math.PI) * Math.PI / 2;
|
|
1376
|
-
for (; directionAngle < normalMax;) directionAngle > normalMin && steps.push(directionAngle), directionAngle += Math.PI / 2;
|
|
1377
|
-
return steps;
|
|
1378
|
-
}
|
|
1379
|
-
function calculateMaxRadius(rect, center, startAngle, endAngle) {
|
|
1380
|
-
const {
|
|
1381
|
-
x: x,
|
|
1382
|
-
y: y
|
|
1383
|
-
} = center,
|
|
1384
|
-
steps = findBoundaryAngles(startAngle, endAngle),
|
|
1385
|
-
{
|
|
1386
|
-
width: width,
|
|
1387
|
-
height: height
|
|
1388
|
-
} = rect,
|
|
1389
|
-
radiusList = [];
|
|
1390
|
-
return steps.forEach(step => {
|
|
1391
|
-
const sin = Math.sin(step),
|
|
1392
|
-
cos = Math.cos(step);
|
|
1393
|
-
1 === sin ? radiusList.push(height - y) : -1 === sin ? radiusList.push(y) : 1 === cos ? radiusList.push(width - x) : -1 === cos ? radiusList.push(x) : (sin > 0 ? radiusList.push(Math.abs((height - y) / cos)) : radiusList.push(Math.abs(y / cos)), cos > 0 ? radiusList.push(Math.abs((width - x) / sin)) : radiusList.push(Math.abs(x / sin)));
|
|
1394
|
-
}), Math.min.apply(null, radiusList);
|
|
1395
|
-
}
|
|
1396
|
-
function computeQuadrant(angle) {
|
|
1397
|
-
return (angle = normalizeAngle(angle)) > 0 && angle <= Math.PI / 2 ? 2 : angle > Math.PI / 2 && angle <= Math.PI ? 3 : angle > Math.PI && angle <= 3 * Math.PI / 2 ? 4 : 1;
|
|
1904
|
+
class OBBBounds extends Bounds {
|
|
1905
|
+
constructor(bounds) {
|
|
1906
|
+
let angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1907
|
+
super(bounds), bounds && (this.angle = angle);
|
|
1908
|
+
}
|
|
1909
|
+
intersects(b) {
|
|
1910
|
+
return isRotateAABBIntersect(this, b);
|
|
1911
|
+
}
|
|
1912
|
+
setValue() {
|
|
1913
|
+
let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
1914
|
+
let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1915
|
+
let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1916
|
+
let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
1917
|
+
let angle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
1918
|
+
return super.setValue(x1, y1, x2, y2), this.angle = angle, this;
|
|
1919
|
+
}
|
|
1398
1920
|
}
|
|
1399
1921
|
|
|
1400
1922
|
class Matrix {
|
|
@@ -1935,619 +2457,114 @@
|
|
|
1935
2457
|
}
|
|
1936
2458
|
setOpacity() {
|
|
1937
2459
|
let o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
1938
|
-
return this.color.opacity = o, this;
|
|
1939
|
-
}
|
|
1940
|
-
getLuminance() {
|
|
1941
|
-
return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
|
|
1942
|
-
}
|
|
1943
|
-
getLuminance2() {
|
|
1944
|
-
return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
|
|
1945
|
-
}
|
|
1946
|
-
getLuminance3() {
|
|
1947
|
-
return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
|
|
1948
|
-
}
|
|
1949
|
-
clone() {
|
|
1950
|
-
return new Color(this.color.toString());
|
|
1951
|
-
}
|
|
1952
|
-
copyGammaToLinear(color) {
|
|
1953
|
-
let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
1954
|
-
return this.color.r = Math.pow(color.color.r, gammaFactor), this.color.g = Math.pow(color.color.g, gammaFactor), this.color.b = Math.pow(color.color.b, gammaFactor), this;
|
|
1955
|
-
}
|
|
1956
|
-
copyLinearToGamma(color) {
|
|
1957
|
-
let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
1958
|
-
const safeInverse = gammaFactor > 0 ? 1 / gammaFactor : 1;
|
|
1959
|
-
return this.color.r = Math.pow(color.color.r, safeInverse), this.color.g = Math.pow(color.color.g, safeInverse), this.color.b = Math.pow(color.color.b, safeInverse), this;
|
|
1960
|
-
}
|
|
1961
|
-
convertGammaToLinear(gammaFactor) {
|
|
1962
|
-
return this.copyGammaToLinear(this, gammaFactor), this;
|
|
1963
|
-
}
|
|
1964
|
-
convertLinearToGamma(gammaFactor) {
|
|
1965
|
-
return this.copyLinearToGamma(this, gammaFactor), this;
|
|
1966
|
-
}
|
|
1967
|
-
copySRGBToLinear(color) {
|
|
1968
|
-
return this.color.r = SRGBToLinear(color.color.r), this.color.g = SRGBToLinear(color.color.g), this.color.b = SRGBToLinear(color.color.b), this;
|
|
1969
|
-
}
|
|
1970
|
-
copyLinearToSRGB(color) {
|
|
1971
|
-
return this.color.r = LinearToSRGB(color.color.r), this.color.g = LinearToSRGB(color.color.g), this.color.b = LinearToSRGB(color.color.b), this;
|
|
1972
|
-
}
|
|
1973
|
-
convertSRGBToLinear() {
|
|
1974
|
-
return this.copySRGBToLinear(this), this;
|
|
1975
|
-
}
|
|
1976
|
-
convertLinearToSRGB() {
|
|
1977
|
-
return this.copyLinearToSRGB(this), this;
|
|
1978
|
-
}
|
|
1979
|
-
}
|
|
1980
|
-
class RGB {
|
|
1981
|
-
constructor(r, g, b, opacity) {
|
|
1982
|
-
this.r = isNaN(+r) ? 255 : Math.max(0, Math.min(255, +r)), this.g = isNaN(+g) ? 255 : Math.max(0, Math.min(255, +g)), this.b = isNaN(+b) ? 255 : Math.max(0, Math.min(255, +b)), isValid$1(opacity) ? this.opacity = isNaN(+opacity) ? 1 : Math.max(0, Math.min(1, +opacity)) : this.opacity = 1;
|
|
1983
|
-
}
|
|
1984
|
-
formatHex() {
|
|
1985
|
-
return `#${hex(this.r) + hex(this.g) + hex(this.b) + (1 === this.opacity ? "" : hex(255 * this.opacity))}`;
|
|
1986
|
-
}
|
|
1987
|
-
formatRgb() {
|
|
1988
|
-
const opacity = this.opacity;
|
|
1989
|
-
return `${1 === opacity ? "rgb(" : "rgba("}${this.r},${this.g},${this.b}${1 === opacity ? ")" : `,${opacity})`}`;
|
|
1990
|
-
}
|
|
1991
|
-
formatHsl() {
|
|
1992
|
-
const opacity = this.opacity,
|
|
1993
|
-
{
|
|
1994
|
-
h: h,
|
|
1995
|
-
s: s,
|
|
1996
|
-
l: l
|
|
1997
|
-
} = rgbToHsl(this.r, this.g, this.b);
|
|
1998
|
-
return `${1 === opacity ? "hsl(" : "hsla("}${h},${s}%,${l}%${1 === opacity ? ")" : `,${opacity})`}`;
|
|
1999
|
-
}
|
|
2000
|
-
toString() {
|
|
2001
|
-
return this.formatHex();
|
|
2002
|
-
}
|
|
2003
|
-
}
|
|
2004
|
-
|
|
2005
|
-
function hexToRgb(str) {
|
|
2006
|
-
let r = "",
|
|
2007
|
-
g = "",
|
|
2008
|
-
b = "";
|
|
2009
|
-
const strtIndex = "#" === str[0] ? 1 : 0;
|
|
2010
|
-
for (let i = strtIndex; i < str.length; i++) "#" !== str[i] && (i < strtIndex + 2 ? r += str[i] : i < strtIndex + 4 ? g += str[i] : i < strtIndex + 6 && (b += str[i]));
|
|
2011
|
-
return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16)];
|
|
2012
|
-
}
|
|
2013
|
-
|
|
2014
|
-
function rgbToHex(r, g, b) {
|
|
2015
|
-
return Number((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
function interpolateRgb$1(colorA, colorB) {
|
|
2019
|
-
const redA = colorA.r,
|
|
2020
|
-
redB = colorB.r,
|
|
2021
|
-
greenA = colorA.g,
|
|
2022
|
-
greenB = colorB.g,
|
|
2023
|
-
blueA = colorA.b,
|
|
2024
|
-
blueB = colorB.b,
|
|
2025
|
-
opacityA = colorA.opacity,
|
|
2026
|
-
opacityB = colorB.opacity;
|
|
2027
|
-
return t => {
|
|
2028
|
-
const r = Math.round(redA * (1 - t) + redB * t),
|
|
2029
|
-
g = Math.round(greenA * (1 - t) + greenB * t),
|
|
2030
|
-
b = Math.round(blueA * (1 - t) + blueB * t);
|
|
2031
|
-
return new RGB(r, g, b, opacityA * (1 - t) + opacityB * t);
|
|
2032
|
-
};
|
|
2033
|
-
}
|
|
2034
|
-
|
|
2035
|
-
var ColorUtil = /*#__PURE__*/Object.freeze({
|
|
2036
|
-
__proto__: null,
|
|
2037
|
-
Color: Color,
|
|
2038
|
-
DEFAULT_COLORS: DEFAULT_COLORS,
|
|
2039
|
-
RGB: RGB,
|
|
2040
|
-
hexToRgb: hexToRgb,
|
|
2041
|
-
hslToRgb: hslToRgb,
|
|
2042
|
-
interpolateRgb: interpolateRgb$1,
|
|
2043
|
-
rgbToHex: rgbToHex,
|
|
2044
|
-
rgbToHsl: rgbToHsl
|
|
2045
|
-
});
|
|
2046
|
-
|
|
2047
|
-
function sub(out, v1, v2) {
|
|
2048
|
-
out[0] = v1[0] - v2[0], out[1] = v1[1] - v2[1];
|
|
2049
|
-
}
|
|
2050
|
-
function isIntersect(left1, right1, left2, right2) {
|
|
2051
|
-
let min1 = left1[0],
|
|
2052
|
-
max1 = right1[0],
|
|
2053
|
-
min2 = left2[0],
|
|
2054
|
-
max2 = right2[0];
|
|
2055
|
-
return max1 < min1 && ([min1, max1] = [max1, min1]), max2 < min2 && ([max2, min2] = [min2, max2]), !(max1 < min2 || max2 < min1) && (min1 = left1[1], max1 = right1[1], min2 = left2[1], max2 = right2[1], max1 < min1 && ([min1, max1] = [max1, min1]), max2 < min2 && ([max2, min2] = [min2, max2]), !(max1 < min2 || max2 < min1));
|
|
2056
|
-
}
|
|
2057
|
-
function getIntersectPoint(left1, right1, left2, right2) {
|
|
2058
|
-
if (!isIntersect(left1, right1, left2, right2)) return !1;
|
|
2059
|
-
const dir1 = [0, 0],
|
|
2060
|
-
dir2 = [0, 0],
|
|
2061
|
-
tempVec = [0, 0];
|
|
2062
|
-
if (sub(dir1, right1, left1), sub(dir2, right2, left2), fuzzyEqualVec(dir1, dir2)) return !0;
|
|
2063
|
-
sub(tempVec, left2, left1);
|
|
2064
|
-
const t = crossProduct$1(tempVec, dir2) / crossProduct$1(dir1, dir2);
|
|
2065
|
-
return t >= 0 && t <= 1 && [left1[0] + dir1[0] * t, left1[1] + dir1[1] * t];
|
|
2066
|
-
}
|
|
2067
|
-
function getRectIntersect(bbox1, bbox2, format) {
|
|
2068
|
-
if (null === bbox1) return bbox2;
|
|
2069
|
-
if (null === bbox2) return bbox1;
|
|
2070
|
-
const {
|
|
2071
|
-
x11: x11,
|
|
2072
|
-
x12: x12,
|
|
2073
|
-
y11: y11,
|
|
2074
|
-
y12: y12,
|
|
2075
|
-
x21: x21,
|
|
2076
|
-
x22: x22,
|
|
2077
|
-
y21: y21,
|
|
2078
|
-
y22: y22
|
|
2079
|
-
} = formatTwoBBox(bbox1, bbox2, format);
|
|
2080
|
-
return x11 >= x22 || x12 <= x21 || y11 >= y22 || y12 <= y21 ? {
|
|
2081
|
-
x1: 0,
|
|
2082
|
-
y1: 0,
|
|
2083
|
-
x2: 0,
|
|
2084
|
-
y2: 0
|
|
2085
|
-
} : {
|
|
2086
|
-
x1: Math.max(x11, x21),
|
|
2087
|
-
y1: Math.max(y11, y21),
|
|
2088
|
-
x2: Math.min(x12, x22),
|
|
2089
|
-
y2: Math.min(y12, y22)
|
|
2090
|
-
};
|
|
2091
|
-
}
|
|
2092
|
-
var InnerBBox;
|
|
2093
|
-
!function (InnerBBox) {
|
|
2094
|
-
InnerBBox[InnerBBox.NONE = 0] = "NONE", InnerBBox[InnerBBox.BBOX1 = 1] = "BBOX1", InnerBBox[InnerBBox.BBOX2 = 2] = "BBOX2";
|
|
2095
|
-
}(InnerBBox || (InnerBBox = {}));
|
|
2096
|
-
const formatTwoBBox = (bbox1, bbox2, format) => {
|
|
2097
|
-
let x11 = bbox1.x1,
|
|
2098
|
-
x12 = bbox1.x2,
|
|
2099
|
-
y11 = bbox1.y1,
|
|
2100
|
-
y12 = bbox1.y2,
|
|
2101
|
-
x21 = bbox2.x1,
|
|
2102
|
-
x22 = bbox2.x2,
|
|
2103
|
-
y21 = bbox2.y1,
|
|
2104
|
-
y22 = bbox2.y2;
|
|
2105
|
-
return format && (x11 > x12 && ([x11, x12] = [x12, x11]), y11 > y12 && ([y11, y12] = [y12, y11]), x21 > x22 && ([x21, x22] = [x22, x21]), y21 > y22 && ([y21, y22] = [y22, y21])), {
|
|
2106
|
-
x11: x11,
|
|
2107
|
-
x12: x12,
|
|
2108
|
-
y11: y11,
|
|
2109
|
-
y12: y12,
|
|
2110
|
-
x21: x21,
|
|
2111
|
-
x22: x22,
|
|
2112
|
-
y21: y21,
|
|
2113
|
-
y22: y22
|
|
2114
|
-
};
|
|
2115
|
-
};
|
|
2116
|
-
function rectInsideAnotherRect(bbox1, bbox2, format) {
|
|
2117
|
-
if (!bbox1 || !bbox2) return InnerBBox.NONE;
|
|
2118
|
-
const {
|
|
2119
|
-
x11: x11,
|
|
2120
|
-
x12: x12,
|
|
2121
|
-
y11: y11,
|
|
2122
|
-
y12: y12,
|
|
2123
|
-
x21: x21,
|
|
2124
|
-
x22: x22,
|
|
2125
|
-
y21: y21,
|
|
2126
|
-
y22: y22
|
|
2127
|
-
} = formatTwoBBox(bbox1, bbox2, format);
|
|
2128
|
-
return x11 > x21 && x12 < x22 && y11 > y21 && y12 < y22 ? InnerBBox.BBOX1 : x21 > x11 && x22 < x12 && y21 > y11 && y22 < y12 ? InnerBBox.BBOX2 : InnerBBox.NONE;
|
|
2129
|
-
}
|
|
2130
|
-
function isRectIntersect(bbox1, bbox2, format) {
|
|
2131
|
-
if (bbox1 && bbox2) {
|
|
2132
|
-
if (!format) return !(bbox1.x1 > bbox2.x2 || bbox1.x2 < bbox2.x1 || bbox1.y1 > bbox2.y2 || bbox1.y2 < bbox2.y1);
|
|
2133
|
-
const {
|
|
2134
|
-
x11: x11,
|
|
2135
|
-
x12: x12,
|
|
2136
|
-
y11: y11,
|
|
2137
|
-
y12: y12,
|
|
2138
|
-
x21: x21,
|
|
2139
|
-
x22: x22,
|
|
2140
|
-
y21: y21,
|
|
2141
|
-
y22: y22
|
|
2142
|
-
} = formatTwoBBox(bbox1, bbox2, !0);
|
|
2143
|
-
return !(x11 > x22 || x12 < x21 || y11 > y22 || y12 < y21);
|
|
2144
|
-
}
|
|
2145
|
-
return !0;
|
|
2146
|
-
}
|
|
2147
|
-
function pointInRect(point, bbox, format) {
|
|
2148
|
-
if (!bbox) return !0;
|
|
2149
|
-
if (!format) return point.x >= bbox.x1 && point.x <= bbox.x2 && point.y >= bbox.y1 && point.y <= bbox.y2;
|
|
2150
|
-
let x11 = bbox.x1,
|
|
2151
|
-
x12 = bbox.x2,
|
|
2152
|
-
y11 = bbox.y1,
|
|
2153
|
-
y12 = bbox.y2;
|
|
2154
|
-
return x11 > x12 && ([x11, x12] = [x12, x11]), y11 > y12 && ([y11, y12] = [y12, y11]), point.x >= x11 && point.x <= x12 && point.y >= y11 && point.y <= y12;
|
|
2155
|
-
}
|
|
2156
|
-
function getProjectionRadius(checkAxis, axis) {
|
|
2157
|
-
return Math.abs(axis[0] * checkAxis[0] + axis[1] * checkAxis[1]);
|
|
2158
|
-
}
|
|
2159
|
-
function rotate$1(_ref, deg) {
|
|
2160
|
-
let {
|
|
2161
|
-
x: x,
|
|
2162
|
-
y: y
|
|
2163
|
-
} = _ref;
|
|
2164
|
-
let origin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
2165
|
-
x: 0,
|
|
2166
|
-
y: 0
|
|
2167
|
-
};
|
|
2168
|
-
return {
|
|
2169
|
-
x: (x - origin.x) * Math.cos(deg) + (y - origin.y) * Math.sin(deg) + origin.x,
|
|
2170
|
-
y: (x - origin.x) * Math.sin(deg) + (origin.y - y) * Math.cos(deg) + origin.y
|
|
2171
|
-
};
|
|
2172
|
-
}
|
|
2173
|
-
function getCenterPoint(box) {
|
|
2174
|
-
return {
|
|
2175
|
-
x: (box.x1 + box.x2) / 2,
|
|
2176
|
-
y: (box.y1 + box.y2) / 2
|
|
2177
|
-
};
|
|
2178
|
-
}
|
|
2179
|
-
function toRect$1(box, isDeg) {
|
|
2180
|
-
const deg = isDeg ? box.angle : degreeToRadian(box.angle),
|
|
2181
|
-
cp = getCenterPoint(box);
|
|
2182
|
-
return [rotate$1({
|
|
2183
|
-
x: box.x1,
|
|
2184
|
-
y: box.y1
|
|
2185
|
-
}, deg, cp), rotate$1({
|
|
2186
|
-
x: box.x2,
|
|
2187
|
-
y: box.y1
|
|
2188
|
-
}, deg, cp), rotate$1({
|
|
2189
|
-
x: box.x2,
|
|
2190
|
-
y: box.y2
|
|
2191
|
-
}, deg, cp), rotate$1({
|
|
2192
|
-
x: box.x1,
|
|
2193
|
-
y: box.y2
|
|
2194
|
-
}, deg, cp)];
|
|
2195
|
-
}
|
|
2196
|
-
function isRotateAABBIntersect(box1, box2) {
|
|
2197
|
-
let isDeg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
|
2198
|
-
let ctx = arguments.length > 3 ? arguments[3] : undefined;
|
|
2199
|
-
const rect1 = toRect$1(box1, isDeg),
|
|
2200
|
-
rect2 = toRect$1(box2, isDeg),
|
|
2201
|
-
vector = (start, end) => [end.x - start.x, end.y - start.y];
|
|
2202
|
-
ctx && (ctx.save(), ctx.fillStyle = "red", ctx.globalAlpha = .6, rect1.forEach((item, index) => {
|
|
2203
|
-
0 === index ? ctx.moveTo(item.x, item.y) : ctx.lineTo(item.x, item.y);
|
|
2204
|
-
}), ctx.fill(), ctx.restore(), ctx.save(), ctx.fillStyle = "green", ctx.globalAlpha = .6, rect2.forEach((item, index) => {
|
|
2205
|
-
0 === index ? ctx.moveTo(item.x, item.y) : ctx.lineTo(item.x, item.y);
|
|
2206
|
-
}), ctx.fill(), ctx.restore());
|
|
2207
|
-
const p1 = getCenterPoint(box1),
|
|
2208
|
-
p2 = getCenterPoint(box2);
|
|
2209
|
-
ctx && ctx.fillRect(p1.x, p1.y, 2, 2), ctx && ctx.fillRect(p2.x, p2.y, 2, 2);
|
|
2210
|
-
const vp1p2 = vector(p1, p2),
|
|
2211
|
-
AB = vector(rect1[0], rect1[1]),
|
|
2212
|
-
BC = vector(rect1[1], rect1[2]),
|
|
2213
|
-
A1B1 = vector(rect2[0], rect2[1]),
|
|
2214
|
-
B1C1 = vector(rect2[1], rect2[2]),
|
|
2215
|
-
deg11 = isDeg ? box1.angle : degreeToRadian(box1.angle);
|
|
2216
|
-
let deg12 = isDeg ? box1.angle + halfPi$2 : degreeToRadian(90 - box1.angle);
|
|
2217
|
-
const deg21 = isDeg ? box2.angle : degreeToRadian(box2.angle);
|
|
2218
|
-
let deg22 = isDeg ? box2.angle + halfPi$2 : degreeToRadian(90 - box2.angle);
|
|
2219
|
-
deg12 > pi2 && (deg12 -= pi2), deg22 > pi2 && (deg22 -= pi2);
|
|
2220
|
-
const isCover = (checkAxisRadius, deg, targetAxis1, targetAxis2) => {
|
|
2221
|
-
const checkAxis = [Math.cos(deg), Math.sin(deg)];
|
|
2222
|
-
return checkAxisRadius + (getProjectionRadius(checkAxis, targetAxis1) + getProjectionRadius(checkAxis, targetAxis2)) / 2 > getProjectionRadius(checkAxis, vp1p2);
|
|
2223
|
-
};
|
|
2224
|
-
return isCover((box1.x2 - box1.x1) / 2, deg11, A1B1, B1C1) && isCover((box1.y2 - box1.y1) / 2, deg12, A1B1, B1C1) && isCover((box2.x2 - box2.x1) / 2, deg21, AB, BC) && isCover((box2.y2 - box2.y1) / 2, deg22, AB, BC);
|
|
2225
|
-
}
|
|
2226
|
-
|
|
2227
|
-
let x1$1, y1$1, x2, y2;
|
|
2228
|
-
function getAABBFromPoints(points) {
|
|
2229
|
-
return x1$1 = 1 / 0, y1$1 = 1 / 0, x2 = -1 / 0, y2 = -1 / 0, points.forEach(point => {
|
|
2230
|
-
x1$1 > point.x && (x1$1 = point.x), x2 < point.x && (x2 = point.x), y1$1 > point.y && (y1$1 = point.y), y2 < point.y && (y2 = point.y);
|
|
2231
|
-
}), {
|
|
2232
|
-
x1: x1$1,
|
|
2233
|
-
y1: y1$1,
|
|
2234
|
-
x2: x2,
|
|
2235
|
-
y2: y2
|
|
2236
|
-
};
|
|
2237
|
-
}
|
|
2238
|
-
|
|
2239
|
-
const EPSILON$1 = 1e-8;
|
|
2240
|
-
function lineIntersectPolygon(a1x, a1y, a2x, a2y, points) {
|
|
2241
|
-
for (let i = 0, p2 = points[points.length - 1]; i < points.length; i++) {
|
|
2242
|
-
const p = points[i];
|
|
2243
|
-
if (isIntersect([a1x, a1y], [a2x, a2y], [p.x, p.y], [p2.x, p2.y])) return !0;
|
|
2244
|
-
p2 = p;
|
|
2245
|
-
}
|
|
2246
|
-
return !1;
|
|
2247
|
-
}
|
|
2248
|
-
function polygonContainPoint(points, x, y) {
|
|
2249
|
-
let w = 0,
|
|
2250
|
-
p = points[0];
|
|
2251
|
-
if (!p) return !1;
|
|
2252
|
-
for (let i = 1; i < points.length; i++) {
|
|
2253
|
-
const p2 = points[i];
|
|
2254
|
-
w += isPointInLine(p.x, p.y, p2.x, p2.y, x, y), p = p2;
|
|
2255
|
-
}
|
|
2256
|
-
const p0 = points[0];
|
|
2257
|
-
return isAroundEqual$1(p.x, p0.x) && isAroundEqual$1(p.y, p0.y) || (w += isPointInLine(p.x, p.y, p0.x, p0.y, x, y)), 0 !== w;
|
|
2258
|
-
}
|
|
2259
|
-
function isPointInLine(x0, y0, x1, y1, x, y) {
|
|
2260
|
-
if (y > y0 && y > y1 || y < y0 && y < y1) return 0;
|
|
2261
|
-
if (y1 === y0) return 0;
|
|
2262
|
-
const t = (y - y0) / (y1 - y0);
|
|
2263
|
-
let dir = y1 < y0 ? 1 : -1;
|
|
2264
|
-
1 !== t && 0 !== t || (dir = y1 < y0 ? .5 : -.5);
|
|
2265
|
-
const x_ = t * (x1 - x0) + x0;
|
|
2266
|
-
return x_ === x ? 1 / 0 : x_ > x ? dir : 0;
|
|
2267
|
-
}
|
|
2268
|
-
function isAroundEqual$1(a, b) {
|
|
2269
|
-
return Math.abs(a - b) < EPSILON$1;
|
|
2270
|
-
}
|
|
2271
|
-
function polygonIntersectPolygon(pointsA, pointsB) {
|
|
2272
|
-
for (let i = 0; i < pointsB.length; i++) {
|
|
2273
|
-
if (polygonContainPoint(pointsA, pointsB[i].x, pointsB[i].y)) return !0;
|
|
2274
|
-
if (i > 0 && lineIntersectPolygon(pointsB[i - 1].x, pointsB[i - 1].y, pointsB[i].x, pointsB[i].y, pointsA)) return !0;
|
|
2460
|
+
return this.color.opacity = o, this;
|
|
2275
2461
|
}
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
const eastAsianCharacterInfo = character => {
|
|
2280
|
-
let x = character.charCodeAt(0),
|
|
2281
|
-
y = 2 === character.length ? character.charCodeAt(1) : 0,
|
|
2282
|
-
codePoint = x;
|
|
2283
|
-
return 55296 <= x && x <= 56319 && 56320 <= y && y <= 57343 && (x &= 1023, y &= 1023, codePoint = x << 10 | y, codePoint += 65536), 12288 === codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 ? "F" : 8361 === codePoint || 65377 <= codePoint && codePoint <= 65470 || 65474 <= codePoint && codePoint <= 65479 || 65482 <= codePoint && codePoint <= 65487 || 65490 <= codePoint && codePoint <= 65495 || 65498 <= codePoint && codePoint <= 65500 || 65512 <= codePoint && codePoint <= 65518 ? "H" : 4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141 ? "W" : 32 <= codePoint && codePoint <= 126 || 162 <= codePoint && codePoint <= 163 || 165 <= codePoint && codePoint <= 166 || 172 === codePoint || 175 === codePoint || 10214 <= codePoint && codePoint <= 10221 || 10629 <= codePoint && codePoint <= 10630 ? "Na" : 161 === codePoint || 164 === codePoint || 167 <= codePoint && codePoint <= 168 || 170 === codePoint || 173 <= codePoint && codePoint <= 174 || 176 <= codePoint && codePoint <= 180 || 182 <= codePoint && codePoint <= 186 || 188 <= codePoint && codePoint <= 191 || 198 === codePoint || 208 === codePoint || 215 <= codePoint && codePoint <= 216 || 222 <= codePoint && codePoint <= 225 || 230 === codePoint || 232 <= codePoint && codePoint <= 234 || 236 <= codePoint && codePoint <= 237 || 240 === codePoint || 242 <= codePoint && codePoint <= 243 || 247 <= codePoint && codePoint <= 250 || 252 === codePoint || 254 === codePoint || 257 === codePoint || 273 === codePoint || 275 === codePoint || 283 === codePoint || 294 <= codePoint && codePoint <= 295 || 299 === codePoint || 305 <= codePoint && codePoint <= 307 || 312 === codePoint || 319 <= codePoint && codePoint <= 322 || 324 === codePoint || 328 <= codePoint && codePoint <= 331 || 333 === codePoint || 338 <= codePoint && codePoint <= 339 || 358 <= codePoint && codePoint <= 359 || 363 === codePoint || 462 === codePoint || 464 === codePoint || 466 === codePoint || 468 === codePoint || 470 === codePoint || 472 === codePoint || 474 === codePoint || 476 === codePoint || 593 === codePoint || 609 === codePoint || 708 === codePoint || 711 === codePoint || 713 <= codePoint && codePoint <= 715 || 717 === codePoint || 720 === codePoint || 728 <= codePoint && codePoint <= 731 || 733 === codePoint || 735 === codePoint || 768 <= codePoint && codePoint <= 879 || 913 <= codePoint && codePoint <= 929 || 931 <= codePoint && codePoint <= 937 || 945 <= codePoint && codePoint <= 961 || 963 <= codePoint && codePoint <= 969 || 1025 === codePoint || 1040 <= codePoint && codePoint <= 1103 || 1105 === codePoint || 8208 === codePoint || 8211 <= codePoint && codePoint <= 8214 || 8216 <= codePoint && codePoint <= 8217 || 8220 <= codePoint && codePoint <= 8221 || 8224 <= codePoint && codePoint <= 8226 || 8228 <= codePoint && codePoint <= 8231 || 8240 === codePoint || 8242 <= codePoint && codePoint <= 8243 || 8245 === codePoint || 8251 === codePoint || 8254 === codePoint || 8308 === codePoint || 8319 === codePoint || 8321 <= codePoint && codePoint <= 8324 || 8364 === codePoint || 8451 === codePoint || 8453 === codePoint || 8457 === codePoint || 8467 === codePoint || 8470 === codePoint || 8481 <= codePoint && codePoint <= 8482 || 8486 === codePoint || 8491 === codePoint || 8531 <= codePoint && codePoint <= 8532 || 8539 <= codePoint && codePoint <= 8542 || 8544 <= codePoint && codePoint <= 8555 || 8560 <= codePoint && codePoint <= 8569 || 8585 === codePoint || 8592 <= codePoint && codePoint <= 8601 || 8632 <= codePoint && codePoint <= 8633 || 8658 === codePoint || 8660 === codePoint || 8679 === codePoint || 8704 === codePoint || 8706 <= codePoint && codePoint <= 8707 || 8711 <= codePoint && codePoint <= 8712 || 8715 === codePoint || 8719 === codePoint || 8721 === codePoint || 8725 === codePoint || 8730 === codePoint || 8733 <= codePoint && codePoint <= 8736 || 8739 === codePoint || 8741 === codePoint || 8743 <= codePoint && codePoint <= 8748 || 8750 === codePoint || 8756 <= codePoint && codePoint <= 8759 || 8764 <= codePoint && codePoint <= 8765 || 8776 === codePoint || 8780 === codePoint || 8786 === codePoint || 8800 <= codePoint && codePoint <= 8801 || 8804 <= codePoint && codePoint <= 8807 || 8810 <= codePoint && codePoint <= 8811 || 8814 <= codePoint && codePoint <= 8815 || 8834 <= codePoint && codePoint <= 8835 || 8838 <= codePoint && codePoint <= 8839 || 8853 === codePoint || 8857 === codePoint || 8869 === codePoint || 8895 === codePoint || 8978 === codePoint || 9312 <= codePoint && codePoint <= 9449 || 9451 <= codePoint && codePoint <= 9547 || 9552 <= codePoint && codePoint <= 9587 || 9600 <= codePoint && codePoint <= 9615 || 9618 <= codePoint && codePoint <= 9621 || 9632 <= codePoint && codePoint <= 9633 || 9635 <= codePoint && codePoint <= 9641 || 9650 <= codePoint && codePoint <= 9651 || 9654 <= codePoint && codePoint <= 9655 || 9660 <= codePoint && codePoint <= 9661 || 9664 <= codePoint && codePoint <= 9665 || 9670 <= codePoint && codePoint <= 9672 || 9675 === codePoint || 9678 <= codePoint && codePoint <= 9681 || 9698 <= codePoint && codePoint <= 9701 || 9711 === codePoint || 9733 <= codePoint && codePoint <= 9734 || 9737 === codePoint || 9742 <= codePoint && codePoint <= 9743 || 9748 <= codePoint && codePoint <= 9749 || 9756 === codePoint || 9758 === codePoint || 9792 === codePoint || 9794 === codePoint || 9824 <= codePoint && codePoint <= 9825 || 9827 <= codePoint && codePoint <= 9829 || 9831 <= codePoint && codePoint <= 9834 || 9836 <= codePoint && codePoint <= 9837 || 9839 === codePoint || 9886 <= codePoint && codePoint <= 9887 || 9918 <= codePoint && codePoint <= 9919 || 9924 <= codePoint && codePoint <= 9933 || 9935 <= codePoint && codePoint <= 9953 || 9955 === codePoint || 9960 <= codePoint && codePoint <= 9983 || 10045 === codePoint || 10071 === codePoint || 10102 <= codePoint && codePoint <= 10111 || 11093 <= codePoint && codePoint <= 11097 || 12872 <= codePoint && codePoint <= 12879 || 57344 <= codePoint && codePoint <= 63743 || 65024 <= codePoint && codePoint <= 65039 || 65533 === codePoint || 127232 <= codePoint && codePoint <= 127242 || 127248 <= codePoint && codePoint <= 127277 || 127280 <= codePoint && codePoint <= 127337 || 127344 <= codePoint && codePoint <= 127386 || 917760 <= codePoint && codePoint <= 917999 || 983040 <= codePoint && codePoint <= 1048573 || 1048576 <= codePoint && codePoint <= 1114109 ? "A" : "N";
|
|
2284
|
-
};
|
|
2285
|
-
|
|
2286
|
-
function getContextFont(text) {
|
|
2287
|
-
let defaultAttr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2288
|
-
let fontSizeScale = arguments.length > 2 ? arguments[2] : undefined;
|
|
2289
|
-
fontSizeScale || (fontSizeScale = 1);
|
|
2290
|
-
const {
|
|
2291
|
-
fontStyle = defaultAttr.fontStyle,
|
|
2292
|
-
fontVariant = defaultAttr.fontVariant,
|
|
2293
|
-
fontWeight = defaultAttr.fontWeight,
|
|
2294
|
-
fontSize = defaultAttr.fontSize,
|
|
2295
|
-
fontFamily = defaultAttr.fontFamily
|
|
2296
|
-
} = text;
|
|
2297
|
-
return (fontStyle ? fontStyle + " " : "") + (fontVariant ? fontVariant + " " : "") + (fontWeight ? fontWeight + " " : "") + fontSize * fontSizeScale + "px " + (fontFamily || "sans-serif");
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
|
-
class TextMeasure {
|
|
2301
|
-
constructor(option, textSpec) {
|
|
2302
|
-
this._numberCharSize = null, this._fullCharSize = null, this._letterCharSize = null, this._specialCharSizeMap = {}, this._canvas = null, this._context = null, this._contextSaved = !1, this._notSupportCanvas = !1, this._notSupportVRender = !1, this._userSpec = {}, this.specialCharSet = "-/: .,@%'\"~", this._option = option, this._userSpec = null != textSpec ? textSpec : {}, this.textSpec = this._initSpec(), isValid$1(option.specialCharSet) && (this.specialCharSet = option.specialCharSet), this._standardMethod = isValid$1(option.getTextBounds) ? this.fullMeasure.bind(this) : this.measureWithNaiveCanvas.bind(this);
|
|
2462
|
+
getLuminance() {
|
|
2463
|
+
return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
|
|
2303
2464
|
}
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
if (isNil$1(this._canvas) && (isValid$1(this._option.getCanvasForMeasure) && (this._canvas = this._option.getCanvasForMeasure()), isNil$1(this._canvas) && "undefined" != typeof window && void 0 !== window.document && globalThis && isValid$1(globalThis.document) && (this._canvas = globalThis.document.createElement("canvas"))), isNil$1(this._context) && isValid$1(this._canvas)) {
|
|
2307
|
-
const context = this._canvas.getContext("2d");
|
|
2308
|
-
isValid$1(context) && (context.save(), context.font = getContextFont(this.textSpec), this._contextSaved = !0, this._context = context);
|
|
2309
|
-
}
|
|
2310
|
-
return !isNil$1(this._context) || (this._notSupportCanvas = !0, !1);
|
|
2465
|
+
getLuminance2() {
|
|
2466
|
+
return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
|
|
2311
2467
|
}
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
const {
|
|
2315
|
-
defaultFontParams = {}
|
|
2316
|
-
} = this._option,
|
|
2317
|
-
{
|
|
2318
|
-
fontStyle = defaultFontParams.fontStyle,
|
|
2319
|
-
fontVariant = defaultFontParams.fontVariant,
|
|
2320
|
-
fontWeight = null !== (_a = defaultFontParams.fontWeight) && void 0 !== _a ? _a : "normal",
|
|
2321
|
-
fontSize = null !== (_b = defaultFontParams.fontSize) && void 0 !== _b ? _b : 12,
|
|
2322
|
-
fontFamily = null !== (_c = defaultFontParams.fontFamily) && void 0 !== _c ? _c : "sans-serif",
|
|
2323
|
-
align: align,
|
|
2324
|
-
textAlign = null != align ? align : "center",
|
|
2325
|
-
baseline: baseline,
|
|
2326
|
-
textBaseline = null != baseline ? baseline : "middle",
|
|
2327
|
-
ellipsis: ellipsis,
|
|
2328
|
-
limit: limit
|
|
2329
|
-
} = this._userSpec;
|
|
2330
|
-
let {
|
|
2331
|
-
lineHeight = fontSize
|
|
2332
|
-
} = this._userSpec;
|
|
2333
|
-
if (isString$1(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
2334
|
-
const scale = Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100;
|
|
2335
|
-
lineHeight = fontSize * scale;
|
|
2336
|
-
}
|
|
2337
|
-
return {
|
|
2338
|
-
fontStyle: fontStyle,
|
|
2339
|
-
fontVariant: fontVariant,
|
|
2340
|
-
fontFamily: fontFamily,
|
|
2341
|
-
fontSize: fontSize,
|
|
2342
|
-
fontWeight: fontWeight,
|
|
2343
|
-
textAlign: textAlign,
|
|
2344
|
-
textBaseline: textBaseline,
|
|
2345
|
-
ellipsis: ellipsis,
|
|
2346
|
-
limit: limit,
|
|
2347
|
-
lineHeight: lineHeight
|
|
2348
|
-
};
|
|
2468
|
+
getLuminance3() {
|
|
2469
|
+
return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
|
|
2349
2470
|
}
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
case "vrender":
|
|
2353
|
-
case "canopus":
|
|
2354
|
-
return this.fullMeasure(text);
|
|
2355
|
-
case "canvas":
|
|
2356
|
-
return this.measureWithNaiveCanvas(text);
|
|
2357
|
-
case "simple":
|
|
2358
|
-
return this.quickMeasureWithoutCanvas(text);
|
|
2359
|
-
default:
|
|
2360
|
-
return this.quickMeasure(text);
|
|
2361
|
-
}
|
|
2471
|
+
clone() {
|
|
2472
|
+
return new Color(this.color.toString());
|
|
2362
2473
|
}
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
height: 0
|
|
2367
|
-
};
|
|
2368
|
-
if (isNil$1(this._option.getTextBounds) || !this._notSupportVRender) return this.measureWithNaiveCanvas(text);
|
|
2369
|
-
const {
|
|
2370
|
-
fontFamily: fontFamily,
|
|
2371
|
-
fontSize: fontSize,
|
|
2372
|
-
fontWeight: fontWeight,
|
|
2373
|
-
textAlign: textAlign,
|
|
2374
|
-
textBaseline: textBaseline,
|
|
2375
|
-
ellipsis: ellipsis,
|
|
2376
|
-
limit: limit,
|
|
2377
|
-
lineHeight: lineHeight
|
|
2378
|
-
} = this.textSpec;
|
|
2379
|
-
let size;
|
|
2380
|
-
try {
|
|
2381
|
-
const bounds = this._option.getTextBounds({
|
|
2382
|
-
text: text,
|
|
2383
|
-
fontFamily: fontFamily,
|
|
2384
|
-
fontSize: fontSize,
|
|
2385
|
-
fontWeight: fontWeight,
|
|
2386
|
-
textAlign: textAlign,
|
|
2387
|
-
textBaseline: textBaseline,
|
|
2388
|
-
ellipsis: !!ellipsis,
|
|
2389
|
-
maxLineWidth: limit || 1 / 0,
|
|
2390
|
-
lineHeight: lineHeight
|
|
2391
|
-
});
|
|
2392
|
-
size = {
|
|
2393
|
-
width: bounds.width(),
|
|
2394
|
-
height: bounds.height()
|
|
2395
|
-
};
|
|
2396
|
-
} catch (e) {
|
|
2397
|
-
this._notSupportVRender = !0, size = this.measureWithNaiveCanvas(text);
|
|
2398
|
-
}
|
|
2399
|
-
return size;
|
|
2474
|
+
copyGammaToLinear(color) {
|
|
2475
|
+
let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
2476
|
+
return this.color.r = Math.pow(color.color.r, gammaFactor), this.color.g = Math.pow(color.color.g, gammaFactor), this.color.b = Math.pow(color.color.b, gammaFactor), this;
|
|
2400
2477
|
}
|
|
2401
|
-
|
|
2402
|
-
|
|
2478
|
+
copyLinearToGamma(color) {
|
|
2479
|
+
let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
2480
|
+
const safeInverse = gammaFactor > 0 ? 1 / gammaFactor : 1;
|
|
2481
|
+
return this.color.r = Math.pow(color.color.r, safeInverse), this.color.g = Math.pow(color.color.g, safeInverse), this.color.b = Math.pow(color.color.b, safeInverse), this;
|
|
2403
2482
|
}
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
if (!this.initContext()) return this._quickMeasureWithoutCanvas(text);
|
|
2407
|
-
const metrics = this._context.measureText(text),
|
|
2408
|
-
{
|
|
2409
|
-
fontSize: fontSize,
|
|
2410
|
-
lineHeight: lineHeight
|
|
2411
|
-
} = this.textSpec;
|
|
2412
|
-
return {
|
|
2413
|
-
width: metrics.width,
|
|
2414
|
-
height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize
|
|
2415
|
-
};
|
|
2483
|
+
convertGammaToLinear(gammaFactor) {
|
|
2484
|
+
return this.copyGammaToLinear(this, gammaFactor), this;
|
|
2416
2485
|
}
|
|
2417
|
-
|
|
2418
|
-
return this.
|
|
2486
|
+
convertLinearToGamma(gammaFactor) {
|
|
2487
|
+
return this.copyLinearToGamma(this, gammaFactor), this;
|
|
2419
2488
|
}
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
width: 0,
|
|
2423
|
-
height: 0
|
|
2424
|
-
};
|
|
2425
|
-
for (let i = 0; i < text.length; i++) {
|
|
2426
|
-
const char = text[i];
|
|
2427
|
-
let size = this._measureSpecialChar(char);
|
|
2428
|
-
isNil$1(size) && TextMeasure.NUMBERS_CHAR_SET.includes(char) && (size = this._measureNumberChar()), isNil$1(size) && ["F", "W"].includes(eastAsianCharacterInfo(char)) && (size = this._measureFullSizeChar()), isNil$1(size) && (size = this._measureLetterChar()), totalSize.width += size.width, totalSize.height = Math.max(totalSize.height, size.height);
|
|
2429
|
-
}
|
|
2430
|
-
return totalSize;
|
|
2489
|
+
copySRGBToLinear(color) {
|
|
2490
|
+
return this.color.r = SRGBToLinear(color.color.r), this.color.g = SRGBToLinear(color.color.g), this.color.b = SRGBToLinear(color.color.b), this;
|
|
2431
2491
|
}
|
|
2432
|
-
|
|
2433
|
-
return this.
|
|
2492
|
+
copyLinearToSRGB(color) {
|
|
2493
|
+
return this.color.r = LinearToSRGB(color.color.r), this.color.g = LinearToSRGB(color.color.g), this.color.b = LinearToSRGB(color.color.b), this;
|
|
2434
2494
|
}
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
const totalSize = {
|
|
2438
|
-
width: 0,
|
|
2439
|
-
height: 0
|
|
2440
|
-
},
|
|
2441
|
-
{
|
|
2442
|
-
fontSize: fontSize,
|
|
2443
|
-
lineHeight: lineHeight
|
|
2444
|
-
} = this.textSpec;
|
|
2445
|
-
for (let i = 0; i < text.length; i++) {
|
|
2446
|
-
const char = text[i],
|
|
2447
|
-
size = ["F", "W"].includes(eastAsianCharacterInfo(char)) ? 1 : .53;
|
|
2448
|
-
totalSize.width += size * fontSize;
|
|
2449
|
-
}
|
|
2450
|
-
return totalSize.height = null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize, totalSize;
|
|
2495
|
+
convertSRGBToLinear() {
|
|
2496
|
+
return this.copySRGBToLinear(this), this;
|
|
2451
2497
|
}
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
const {
|
|
2455
|
-
fontSize: fontSize,
|
|
2456
|
-
lineHeight: lineHeight
|
|
2457
|
-
} = this.textSpec,
|
|
2458
|
-
defaultResult = {
|
|
2459
|
-
width: 0,
|
|
2460
|
-
height: 0
|
|
2461
|
-
};
|
|
2462
|
-
if (isNil$1(text)) return defaultResult;
|
|
2463
|
-
if (isArray$1(text)) {
|
|
2464
|
-
const textArr = text.filter(isValid$1).map(s => s.toString());
|
|
2465
|
-
return 0 === textArr.length ? defaultResult : 1 === textArr.length ? processor(textArr[0]) : {
|
|
2466
|
-
width: textArr.reduce((maxWidth, cur) => Math.max(maxWidth, processor(cur).width), 0),
|
|
2467
|
-
height: textArr.length * ((null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize) + 1) + 1
|
|
2468
|
-
};
|
|
2469
|
-
}
|
|
2470
|
-
return processor(text.toString());
|
|
2498
|
+
convertLinearToSRGB() {
|
|
2499
|
+
return this.copyLinearToSRGB(this), this;
|
|
2471
2500
|
}
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
width: numberBounds.width / TextMeasure.NUMBERS_CHAR_SET.length,
|
|
2477
|
-
height: numberBounds.height
|
|
2478
|
-
};
|
|
2479
|
-
}
|
|
2480
|
-
return this._numberCharSize;
|
|
2501
|
+
}
|
|
2502
|
+
class RGB {
|
|
2503
|
+
constructor(r, g, b, opacity) {
|
|
2504
|
+
this.r = isNaN(+r) ? 255 : Math.max(0, Math.min(255, +r)), this.g = isNaN(+g) ? 255 : Math.max(0, Math.min(255, +g)), this.b = isNaN(+b) ? 255 : Math.max(0, Math.min(255, +b)), isValid$1(opacity) ? this.opacity = isNaN(+opacity) ? 1 : Math.max(0, Math.min(1, +opacity)) : this.opacity = 1;
|
|
2481
2505
|
}
|
|
2482
|
-
|
|
2483
|
-
return
|
|
2506
|
+
formatHex() {
|
|
2507
|
+
return `#${hex(this.r) + hex(this.g) + hex(this.b) + (1 === this.opacity ? "" : hex(255 * this.opacity))}`;
|
|
2484
2508
|
}
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
this._letterCharSize = {
|
|
2489
|
-
width: alphabetBounds.width / TextMeasure.ALPHABET_CHAR_SET.length,
|
|
2490
|
-
height: alphabetBounds.height
|
|
2491
|
-
};
|
|
2492
|
-
}
|
|
2493
|
-
return this._letterCharSize;
|
|
2509
|
+
formatRgb() {
|
|
2510
|
+
const opacity = this.opacity;
|
|
2511
|
+
return `${1 === opacity ? "rgb(" : "rgba("}${this.r},${this.g},${this.b}${1 === opacity ? ")" : `,${opacity})`}`;
|
|
2494
2512
|
}
|
|
2495
|
-
|
|
2496
|
-
|
|
2513
|
+
formatHsl() {
|
|
2514
|
+
const opacity = this.opacity,
|
|
2515
|
+
{
|
|
2516
|
+
h: h,
|
|
2517
|
+
s: s,
|
|
2518
|
+
l: l
|
|
2519
|
+
} = rgbToHsl(this.r, this.g, this.b);
|
|
2520
|
+
return `${1 === opacity ? "hsl(" : "hsla("}${h},${s}%,${l}%${1 === opacity ? ")" : `,${opacity})`}`;
|
|
2497
2521
|
}
|
|
2498
|
-
|
|
2499
|
-
|
|
2522
|
+
toString() {
|
|
2523
|
+
return this.formatHex();
|
|
2500
2524
|
}
|
|
2501
2525
|
}
|
|
2502
|
-
TextMeasure.ALPHABET_CHAR_SET = "abcdefghijklmnopqrstuvwxyz", TextMeasure.NUMBERS_CHAR_SET = "0123456789", TextMeasure.FULL_SIZE_CHAR = "字";
|
|
2503
2526
|
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
case "inside-right":
|
|
2532
|
-
sx = .5;
|
|
2533
|
-
break;
|
|
2534
|
-
case "top-right":
|
|
2535
|
-
sx = .5, sy = -.5;
|
|
2536
|
-
break;
|
|
2537
|
-
case "top-left":
|
|
2538
|
-
sx = -.5, sy = -.5;
|
|
2539
|
-
break;
|
|
2540
|
-
case "bottom-right":
|
|
2541
|
-
sx = .5, sy = .5;
|
|
2542
|
-
break;
|
|
2543
|
-
case "bottom-left":
|
|
2544
|
-
sx = -.5, sy = .5;
|
|
2545
|
-
}
|
|
2546
|
-
return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
|
|
2547
|
-
x: anchorX,
|
|
2548
|
-
y: anchorY
|
|
2527
|
+
function hexToRgb(str) {
|
|
2528
|
+
let r = "",
|
|
2529
|
+
g = "",
|
|
2530
|
+
b = "";
|
|
2531
|
+
const strtIndex = "#" === str[0] ? 1 : 0;
|
|
2532
|
+
for (let i = strtIndex; i < str.length; i++) "#" !== str[i] && (i < strtIndex + 2 ? r += str[i] : i < strtIndex + 4 ? g += str[i] : i < strtIndex + 6 && (b += str[i]));
|
|
2533
|
+
return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16)];
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2536
|
+
function rgbToHex(r, g, b) {
|
|
2537
|
+
return Number((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
function interpolateRgb$1(colorA, colorB) {
|
|
2541
|
+
const redA = colorA.r,
|
|
2542
|
+
redB = colorB.r,
|
|
2543
|
+
greenA = colorA.g,
|
|
2544
|
+
greenB = colorB.g,
|
|
2545
|
+
blueA = colorA.b,
|
|
2546
|
+
blueB = colorB.b,
|
|
2547
|
+
opacityA = colorA.opacity,
|
|
2548
|
+
opacityB = colorB.opacity;
|
|
2549
|
+
return t => {
|
|
2550
|
+
const r = Math.round(redA * (1 - t) + redB * t),
|
|
2551
|
+
g = Math.round(greenA * (1 - t) + greenB * t),
|
|
2552
|
+
b = Math.round(blueA * (1 - t) + blueB * t);
|
|
2553
|
+
return new RGB(r, g, b, opacityA * (1 - t) + opacityB * t);
|
|
2549
2554
|
};
|
|
2550
|
-
}
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
var ColorUtil = /*#__PURE__*/Object.freeze({
|
|
2558
|
+
__proto__: null,
|
|
2559
|
+
Color: Color,
|
|
2560
|
+
DEFAULT_COLORS: DEFAULT_COLORS,
|
|
2561
|
+
RGB: RGB,
|
|
2562
|
+
hexToRgb: hexToRgb,
|
|
2563
|
+
hslToRgb: hslToRgb,
|
|
2564
|
+
interpolateRgb: interpolateRgb$1,
|
|
2565
|
+
rgbToHex: rgbToHex,
|
|
2566
|
+
rgbToHsl: rgbToHsl
|
|
2567
|
+
});
|
|
2551
2568
|
|
|
2552
2569
|
function normalizePadding$1(padding) {
|
|
2553
2570
|
if (isValidNumber$1(padding)) return [padding, padding, padding, padding];
|
|
@@ -12411,8 +12428,9 @@
|
|
|
12411
12428
|
}), this.clipRange && (out.clipRange = this.clipRange + (1 - this.clipRange) * ratio), this.segmentsCache && this.to.segments) {
|
|
12412
12429
|
let start = 0;
|
|
12413
12430
|
out.segments = this.to.segments.map((segment, index) => {
|
|
12414
|
-
const
|
|
12415
|
-
|
|
12431
|
+
const end = start + this.segmentsCache[index],
|
|
12432
|
+
points = this.points.slice(start, end);
|
|
12433
|
+
return start = end, Object.assign(Object.assign({}, segment), {
|
|
12416
12434
|
points: points
|
|
12417
12435
|
});
|
|
12418
12436
|
});
|
|
@@ -13839,6 +13857,9 @@
|
|
|
13839
13857
|
get AABBBounds() {
|
|
13840
13858
|
return this.tryUpdateAABBBounds("imprecise" === this.attribute.boundsMode);
|
|
13841
13859
|
}
|
|
13860
|
+
get OBBBounds() {
|
|
13861
|
+
return this.tryUpdateOBBBounds();
|
|
13862
|
+
}
|
|
13842
13863
|
get globalAABBBounds() {
|
|
13843
13864
|
return this.tryUpdateGlobalAABBBounds();
|
|
13844
13865
|
}
|
|
@@ -13851,7 +13872,7 @@
|
|
|
13851
13872
|
constructor() {
|
|
13852
13873
|
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13853
13874
|
var _a;
|
|
13854
|
-
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
|
|
13875
|
+
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
|
|
13855
13876
|
}
|
|
13856
13877
|
setMode(mode) {
|
|
13857
13878
|
"3d" === mode ? this.set3dMode() : this.set2dMode();
|
|
@@ -13885,13 +13906,22 @@
|
|
|
13885
13906
|
const bounds = this.doUpdateAABBBounds(full);
|
|
13886
13907
|
return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), bounds;
|
|
13887
13908
|
}
|
|
13909
|
+
tryUpdateOBBBounds() {
|
|
13910
|
+
if (this._OBBBounds || (this._OBBBounds = new OBBBounds()), this.tryUpdateAABBBounds(), this.updateOBBBoundsStamp === this.updateAABBBoundsStamp) return this._OBBBounds;
|
|
13911
|
+
if (this.updateOBBBoundsStamp = this.updateAABBBoundsStamp, !this.valid) return this._OBBBounds.clear(), this._OBBBounds;
|
|
13912
|
+
return this.doUpdateOBBBounds();
|
|
13913
|
+
}
|
|
13888
13914
|
combindShadowAABBBounds(bounds) {
|
|
13889
13915
|
if (this.shadowRoot) {
|
|
13890
13916
|
const b = this.shadowRoot.AABBBounds.clone();
|
|
13891
13917
|
bounds.union(b);
|
|
13892
13918
|
}
|
|
13893
13919
|
}
|
|
13920
|
+
doUpdateOBBBounds() {
|
|
13921
|
+
return this._OBBBounds;
|
|
13922
|
+
}
|
|
13894
13923
|
doUpdateAABBBounds(full) {
|
|
13924
|
+
this.updateAABBBoundsStamp++;
|
|
13895
13925
|
const graphicTheme = this.getGraphicTheme();
|
|
13896
13926
|
this._AABBBounds.clear();
|
|
13897
13927
|
const attribute = this.attribute,
|
|
@@ -14868,6 +14898,7 @@
|
|
|
14868
14898
|
}), application.graphicService.updateTempAABBBounds(aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, this), originalAABBBounds.copy(aabbBounds), originalAABBBounds;
|
|
14869
14899
|
}
|
|
14870
14900
|
doUpdateAABBBounds() {
|
|
14901
|
+
this.updateAABBBoundsStamp++;
|
|
14871
14902
|
const bounds = super.doUpdateAABBBounds();
|
|
14872
14903
|
return this.parent && this.parent.addChildUpdateBoundTag(), this._emitCustomEvent("AAABBBoundsChange"), bounds;
|
|
14873
14904
|
}
|
|
@@ -18692,7 +18723,10 @@
|
|
|
18692
18723
|
}
|
|
18693
18724
|
beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) {
|
|
18694
18725
|
const baseGraphic = graphic.baseGraphic;
|
|
18695
|
-
|
|
18726
|
+
let intree = !!baseGraphic.stage,
|
|
18727
|
+
_g = baseGraphic.parent;
|
|
18728
|
+
for (; intree && _g && _g.stage !== _g;) intree = !!_g.stage, _g = _g.parent;
|
|
18729
|
+
if (!intree) {
|
|
18696
18730
|
const interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
|
|
18697
18731
|
if (interactiveLayer) {
|
|
18698
18732
|
this.getShadowRoot(interactiveLayer).removeChild(graphic);
|
|
@@ -19041,6 +19075,35 @@
|
|
|
19041
19075
|
getGraphicTheme() {
|
|
19042
19076
|
return getTheme$1(this).text;
|
|
19043
19077
|
}
|
|
19078
|
+
doUpdateOBBBounds() {
|
|
19079
|
+
const graphicTheme = this.getGraphicTheme();
|
|
19080
|
+
this._OBBBounds.clear();
|
|
19081
|
+
const attribute = this.attribute,
|
|
19082
|
+
{
|
|
19083
|
+
angle = graphicTheme.angle
|
|
19084
|
+
} = attribute;
|
|
19085
|
+
if (!angle) {
|
|
19086
|
+
const b = this.AABBBounds;
|
|
19087
|
+
return this._OBBBounds.setValue(b.x1, b.y1, b.x2, b.y2), this._OBBBounds;
|
|
19088
|
+
}
|
|
19089
|
+
this.obbText || (this.obbText = new Text({})), this.obbText.setAttributes(Object.assign(Object.assign({}, attribute), {
|
|
19090
|
+
angle: 0
|
|
19091
|
+
}));
|
|
19092
|
+
const bounds1 = this.obbText.AABBBounds,
|
|
19093
|
+
{
|
|
19094
|
+
x: x,
|
|
19095
|
+
y: y
|
|
19096
|
+
} = attribute,
|
|
19097
|
+
boundsCenter = {
|
|
19098
|
+
x: (bounds1.x1 + bounds1.x2) / 2,
|
|
19099
|
+
y: (bounds1.y1 + bounds1.y2) / 2
|
|
19100
|
+
},
|
|
19101
|
+
center = rotatePoint(boundsCenter, angle, {
|
|
19102
|
+
x: x,
|
|
19103
|
+
y: y
|
|
19104
|
+
});
|
|
19105
|
+
return this._OBBBounds.copy(bounds1), this._OBBBounds.translate(center.x - boundsCenter.x, center.y - boundsCenter.y), this._OBBBounds.angle = angle, this._OBBBounds;
|
|
19106
|
+
}
|
|
19044
19107
|
updateAABBBounds(attribute, textTheme, aabbBounds) {
|
|
19045
19108
|
const {
|
|
19046
19109
|
text = textTheme.text
|
|
@@ -20357,7 +20420,7 @@
|
|
|
20357
20420
|
}), aabbBounds;
|
|
20358
20421
|
}
|
|
20359
20422
|
doUpdateAABBBounds() {
|
|
20360
|
-
this._AABBBounds.clear();
|
|
20423
|
+
this.updateAABBBoundsStamp++, this._AABBBounds.clear();
|
|
20361
20424
|
const bounds = this.updateAABBBounds(this.attribute, this.getGraphicTheme(), this._AABBBounds);
|
|
20362
20425
|
return this.clearUpdateBoundTag(), bounds;
|
|
20363
20426
|
}
|
|
@@ -21520,13 +21583,14 @@
|
|
|
21520
21583
|
return super.needUpdateTag(key, ARC_UPDATE_TAG_KEY);
|
|
21521
21584
|
}
|
|
21522
21585
|
toCustomPath() {
|
|
21586
|
+
var _a, _b, _c, _d;
|
|
21523
21587
|
const attribute = this.attribute,
|
|
21524
21588
|
{
|
|
21525
21589
|
startAngle: startAngle,
|
|
21526
21590
|
endAngle: endAngle
|
|
21527
21591
|
} = this.getParsedAngle();
|
|
21528
|
-
let innerRadius = attribute.innerRadius - (attribute.innerPadding
|
|
21529
|
-
outerRadius = attribute.outerRadius - (attribute.outerPadding
|
|
21592
|
+
let innerRadius = (null !== (_a = attribute.innerRadius) && void 0 !== _a ? _a : 0) - (null !== (_b = attribute.innerPadding) && void 0 !== _b ? _b : 0),
|
|
21593
|
+
outerRadius = (null !== (_c = attribute.outerRadius) && void 0 !== _c ? _c : 0) - (null !== (_d = attribute.outerPadding) && void 0 !== _d ? _d : 0);
|
|
21530
21594
|
const deltaAngle = abs$1(endAngle - startAngle),
|
|
21531
21595
|
clockwise = endAngle > startAngle;
|
|
21532
21596
|
if (outerRadius < innerRadius) {
|
|
@@ -30106,7 +30170,7 @@
|
|
|
30106
30170
|
const {
|
|
30107
30171
|
width: width,
|
|
30108
30172
|
height: height
|
|
30109
|
-
} = this.
|
|
30173
|
+
} = this.getSliderRenderBounds();
|
|
30110
30174
|
return "vertical" === direction ? (currentPos = y, delta = currentPos - this._prePos, currentScrollValue = delta / height) : (currentPos = x, delta = currentPos - this._prePos, currentScrollValue = delta / width), [currentPos, currentScrollValue];
|
|
30111
30175
|
}, this._onSliderPointerMove = e => {
|
|
30112
30176
|
const {
|
|
@@ -30194,7 +30258,7 @@
|
|
|
30194
30258
|
height: height
|
|
30195
30259
|
}, railStyle), "rect");
|
|
30196
30260
|
this._rail = rail;
|
|
30197
|
-
const sliderRenderBounds = this.
|
|
30261
|
+
const sliderRenderBounds = this.getSliderRenderBounds(),
|
|
30198
30262
|
sliderPos = this._getSliderPos(clampRange$1(range, limitRange[0], limitRange[1])),
|
|
30199
30263
|
sliderSize = sliderPos[1] - sliderPos[0];
|
|
30200
30264
|
let sliderAttribute;
|
|
@@ -30222,7 +30286,7 @@
|
|
|
30222
30286
|
y: containerAABBBounds.y1
|
|
30223
30287
|
};
|
|
30224
30288
|
}
|
|
30225
|
-
|
|
30289
|
+
getSliderRenderBounds() {
|
|
30226
30290
|
if (this._sliderRenderBounds) return this._sliderRenderBounds;
|
|
30227
30291
|
const {
|
|
30228
30292
|
width: width,
|
|
@@ -30249,7 +30313,7 @@
|
|
|
30249
30313
|
const {
|
|
30250
30314
|
width: width,
|
|
30251
30315
|
height: height
|
|
30252
|
-
} = this.
|
|
30316
|
+
} = this.getSliderRenderBounds();
|
|
30253
30317
|
return "horizontal" === direction ? height : width;
|
|
30254
30318
|
}
|
|
30255
30319
|
return 0;
|
|
@@ -30263,7 +30327,7 @@
|
|
|
30263
30327
|
height: height,
|
|
30264
30328
|
x1: x1,
|
|
30265
30329
|
y1: y1
|
|
30266
|
-
} = this.
|
|
30330
|
+
} = this.getSliderRenderBounds();
|
|
30267
30331
|
return "horizontal" === direction ? [width * range[0] + x1, width * range[1] + x1] : [height * range[0] + y1, height * range[1] + y1];
|
|
30268
30332
|
}
|
|
30269
30333
|
_getScrollRange() {
|
|
@@ -30278,7 +30342,7 @@
|
|
|
30278
30342
|
height: height,
|
|
30279
30343
|
x1: x1,
|
|
30280
30344
|
y1: y1
|
|
30281
|
-
} = this.
|
|
30345
|
+
} = this.getSliderRenderBounds(),
|
|
30282
30346
|
sliderSize = this._sliderSize;
|
|
30283
30347
|
return "horizontal" === direction ? clampRange$1([x1 + min * width, x1 + max * width], x1, width - sliderSize) : clampRange$1([y1 + min * height, y1 + max * height], y1, height - sliderSize);
|
|
30284
30348
|
}
|
|
@@ -32354,45 +32418,33 @@
|
|
|
32354
32418
|
const baseMark = this.getRelatedGraphic(label.attribute),
|
|
32355
32419
|
backgroundColor = baseMark.attribute.fill,
|
|
32356
32420
|
foregroundColor = label.attribute.fill,
|
|
32357
|
-
baseColor = backgroundColor,
|
|
32358
32421
|
invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode),
|
|
32359
32422
|
similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
|
|
32360
|
-
if (outsideEnable) {
|
|
32361
|
-
const fill = smartInvertStrategy(fillStrategy,
|
|
32423
|
+
if (outsideEnable || this._canPlaceInside(label.AABBBounds, baseMark.AABBBounds)) {
|
|
32424
|
+
const fill = smartInvertStrategy(fillStrategy, backgroundColor, invertColor, similarColor);
|
|
32362
32425
|
if (fill && label.setAttributes({
|
|
32363
32426
|
fill: fill
|
|
32364
32427
|
}), 0 === label.attribute.lineWidth) continue;
|
|
32365
|
-
const stroke = smartInvertStrategy(strokeStrategy,
|
|
32428
|
+
const stroke = smartInvertStrategy(strokeStrategy, backgroundColor, invertColor, similarColor);
|
|
32366
32429
|
stroke && label.setAttributes({
|
|
32367
32430
|
stroke: stroke
|
|
32368
32431
|
});
|
|
32369
|
-
} else {
|
|
32370
|
-
if (
|
|
32371
|
-
|
|
32372
|
-
|
|
32373
|
-
fill: fill
|
|
32374
|
-
}), 0 === label.attribute.lineWidth) continue;
|
|
32375
|
-
const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
|
|
32376
|
-
stroke && label.setAttributes({
|
|
32377
|
-
stroke: stroke
|
|
32378
|
-
});
|
|
32379
|
-
} else {
|
|
32380
|
-
if (0 === label.attribute.lineWidth) continue;
|
|
32381
|
-
if (label.attribute.stroke) {
|
|
32382
|
-
label.setAttributes({
|
|
32383
|
-
fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors, mode)
|
|
32384
|
-
});
|
|
32385
|
-
continue;
|
|
32386
|
-
}
|
|
32387
|
-
const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
|
|
32388
|
-
fill && label.setAttributes({
|
|
32389
|
-
fill: fill
|
|
32390
|
-
});
|
|
32391
|
-
const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
|
|
32392
|
-
stroke && label.setAttributes({
|
|
32393
|
-
stroke: stroke
|
|
32432
|
+
} else if (label.AABBBounds && baseMark.AABBBounds && baseMark.AABBBounds.intersects(label.AABBBounds)) {
|
|
32433
|
+
if (0 === label.attribute.lineWidth) continue;
|
|
32434
|
+
if (label.attribute.stroke) {
|
|
32435
|
+
label.setAttributes({
|
|
32436
|
+
fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors, mode)
|
|
32394
32437
|
});
|
|
32438
|
+
continue;
|
|
32395
32439
|
}
|
|
32440
|
+
const fill = smartInvertStrategy(fillStrategy, backgroundColor, invertColor, similarColor);
|
|
32441
|
+
fill && label.setAttributes({
|
|
32442
|
+
fill: fill
|
|
32443
|
+
});
|
|
32444
|
+
const stroke = smartInvertStrategy(strokeStrategy, backgroundColor, invertColor, similarColor);
|
|
32445
|
+
stroke && label.setAttributes({
|
|
32446
|
+
stroke: stroke
|
|
32447
|
+
});
|
|
32396
32448
|
}
|
|
32397
32449
|
}
|
|
32398
32450
|
}
|
|
@@ -32825,7 +32877,7 @@
|
|
|
32825
32877
|
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height),
|
|
32826
32878
|
flag = isQuadrantLeft(quadrant) ? -1 : 1;
|
|
32827
32879
|
let cx = 0,
|
|
32828
|
-
limit = (flag > 0 ? plotLayout_x2 - pointB.x : pointB.x - plotLayout_x1) - this._line2MinLength - spaceWidth;
|
|
32880
|
+
limit = (flag > 0 ? plotLayout_x2 - pointB.x + this._alignOffset : pointB.x - plotLayout_x1 - this._alignOffset) - this._line2MinLength - spaceWidth;
|
|
32829
32881
|
"labelLine" === labelLayoutAlign && (cx = (radius + line1MinLength + this._line2MinLength) * flag + center.x, limit = (flag > 0 ? plotLayout_x2 - cx : cx - plotLayout_x1) - spaceWidth);
|
|
32830
32882
|
const text = this._getFormatLabelText(arc.refDatum, limit);
|
|
32831
32883
|
arc.labelText = text;
|
|
@@ -33933,49 +33985,6 @@
|
|
|
33933
33985
|
}
|
|
33934
33986
|
}
|
|
33935
33987
|
|
|
33936
|
-
function rotate(x, y, deg, originX, originY) {
|
|
33937
|
-
return {
|
|
33938
|
-
x: (x - originX) * Math.cos(deg) + (y - originY) * Math.sin(deg) + originX,
|
|
33939
|
-
y: (x - originX) * Math.sin(deg) + (originY - y) * Math.cos(deg) + originY
|
|
33940
|
-
};
|
|
33941
|
-
}
|
|
33942
|
-
function genNormalBounds(item) {
|
|
33943
|
-
const bounds = item.AABBBounds;
|
|
33944
|
-
return {
|
|
33945
|
-
x1: bounds.x1,
|
|
33946
|
-
x2: bounds.x2,
|
|
33947
|
-
y1: bounds.y1,
|
|
33948
|
-
y2: bounds.y2,
|
|
33949
|
-
centerX: item.attribute.x,
|
|
33950
|
-
centerY: item.attribute.y,
|
|
33951
|
-
angle: item.attribute.angle
|
|
33952
|
-
};
|
|
33953
|
-
}
|
|
33954
|
-
function genRotateBounds(items) {
|
|
33955
|
-
items.forEach(item => {
|
|
33956
|
-
if (item.rotatedBounds || !item.attribute.angle) return;
|
|
33957
|
-
const bounds = genNormalBounds(item),
|
|
33958
|
-
rotatedCenter = rotate(bounds.centerX, bounds.centerY, bounds.angle, item.attribute.x, item.attribute.y),
|
|
33959
|
-
deltaX = rotatedCenter.x - bounds.centerX,
|
|
33960
|
-
deltaY = rotatedCenter.y - bounds.centerY;
|
|
33961
|
-
bounds.x1 += deltaX, bounds.x2 += deltaX, bounds.y1 += deltaY, bounds.y2 += deltaY, bounds.centerX += deltaX, bounds.centerY += deltaY, item.rotatedBounds = bounds;
|
|
33962
|
-
});
|
|
33963
|
-
}
|
|
33964
|
-
function itemIntersect(item1, item2) {
|
|
33965
|
-
return isRectIntersect(item1.AABBBounds, item2.AABBBounds, !1) && (!item1.rotatedBounds || !item2.rotatedBounds || isRotateAABBIntersect(item1.rotatedBounds, item2.rotatedBounds, !0));
|
|
33966
|
-
}
|
|
33967
|
-
const DELTA_ANGLE = Math.sin(Math.PI / 10);
|
|
33968
|
-
function isAngleVertical(angle) {
|
|
33969
|
-
const hasAngle = !isNil$1(angle) && 0 !== angle,
|
|
33970
|
-
cos = hasAngle ? Math.cos(angle) : 1;
|
|
33971
|
-
return hasAngle && Math.abs(cos) <= DELTA_ANGLE;
|
|
33972
|
-
}
|
|
33973
|
-
function isAngleHorizontal(angle) {
|
|
33974
|
-
const hasAngle = !isNil$1(angle) && 0 !== angle,
|
|
33975
|
-
sin = hasAngle ? Math.sin(angle) : 0;
|
|
33976
|
-
return !hasAngle || Math.abs(sin) <= DELTA_ANGLE;
|
|
33977
|
-
}
|
|
33978
|
-
|
|
33979
33988
|
const methods$2 = {
|
|
33980
33989
|
parity: function (items) {
|
|
33981
33990
|
return items.filter((item, i) => i % 2 ? item.setAttribute("opacity", 0) : 1);
|
|
@@ -33986,16 +33995,16 @@
|
|
|
33986
33995
|
}
|
|
33987
33996
|
};
|
|
33988
33997
|
function intersect$1(textA, textB, sep) {
|
|
33989
|
-
|
|
33990
|
-
b = textB.
|
|
33991
|
-
return
|
|
33998
|
+
let a = textA.OBBBounds,
|
|
33999
|
+
b = textB.OBBBounds;
|
|
34000
|
+
return a && b && !a.empty() && !b.empty() ? a.intersects(b) : (a = textA.AABBBounds, b = textB.AABBBounds, sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2));
|
|
33992
34001
|
}
|
|
33993
34002
|
function hasOverlap$2(items, pad) {
|
|
33994
34003
|
for (let b, i = 1, n = items.length, a = items[0]; i < n; a = b, ++i) if (intersect$1(a, b = items[i], pad)) return !0;
|
|
33995
34004
|
}
|
|
33996
34005
|
function hasBounds(item) {
|
|
33997
|
-
|
|
33998
|
-
return
|
|
34006
|
+
let bounds;
|
|
34007
|
+
return bounds = item.OBBBounds.empty() ? item.AABBBounds : item.OBBBounds, bounds.width() > 1 && bounds.height() > 1;
|
|
33999
34008
|
}
|
|
34000
34009
|
function reset$1(items) {
|
|
34001
34010
|
return items.forEach(item => item.setAttribute("opacity", 1)), items;
|
|
@@ -34005,7 +34014,7 @@
|
|
|
34005
34014
|
const source = labels.filter(hasBounds);
|
|
34006
34015
|
if (isEmpty(source)) return;
|
|
34007
34016
|
let items;
|
|
34008
|
-
items = reset$1(source)
|
|
34017
|
+
items = reset$1(source);
|
|
34009
34018
|
const {
|
|
34010
34019
|
method = "parity",
|
|
34011
34020
|
separation: sep = 0
|
|
@@ -34031,6 +34040,50 @@
|
|
|
34031
34040
|
});
|
|
34032
34041
|
}
|
|
34033
34042
|
|
|
34043
|
+
function genNormalBounds(item) {
|
|
34044
|
+
const bounds = item.AABBBounds;
|
|
34045
|
+
return {
|
|
34046
|
+
x1: bounds.x1,
|
|
34047
|
+
x2: bounds.x2,
|
|
34048
|
+
y1: bounds.y1,
|
|
34049
|
+
y2: bounds.y2,
|
|
34050
|
+
centerX: item.attribute.x,
|
|
34051
|
+
centerY: item.attribute.y,
|
|
34052
|
+
angle: item.attribute.angle
|
|
34053
|
+
};
|
|
34054
|
+
}
|
|
34055
|
+
function genRotateBounds(items) {
|
|
34056
|
+
items.forEach(item => {
|
|
34057
|
+
if (item.rotatedBounds || !item.attribute.angle) return;
|
|
34058
|
+
const bounds = genNormalBounds(item),
|
|
34059
|
+
rotatedCenter = rotatePoint({
|
|
34060
|
+
x: item.attribute.x,
|
|
34061
|
+
y: item.attribute.y
|
|
34062
|
+
}, bounds.angle, {
|
|
34063
|
+
x: bounds.centerX,
|
|
34064
|
+
y: bounds.centerY
|
|
34065
|
+
}),
|
|
34066
|
+
deltaX = rotatedCenter.x - bounds.centerX,
|
|
34067
|
+
deltaY = rotatedCenter.y - bounds.centerY;
|
|
34068
|
+
bounds.x1 += deltaX, bounds.x2 += deltaX, bounds.y1 += deltaY, bounds.y2 += deltaY, bounds.centerX += deltaX, bounds.centerY += deltaY, item.rotatedBounds = bounds;
|
|
34069
|
+
});
|
|
34070
|
+
}
|
|
34071
|
+
function itemIntersect(item1, item2) {
|
|
34072
|
+
var _a, _b;
|
|
34073
|
+
return (null === (_a = item1.OBBBounds) || void 0 === _a ? void 0 : _a.empty()) || (null === (_b = item2.OBBBounds) || void 0 === _b ? void 0 : _b.empty()) ? isRectIntersect(item1.AABBBounds, item2.AABBBounds, !1) && (!item1.rotatedBounds || !item2.rotatedBounds || isRotateAABBIntersect(item1.rotatedBounds, item2.rotatedBounds, !0)) : item1.OBBBounds.intersects(item2.OBBBounds);
|
|
34074
|
+
}
|
|
34075
|
+
const DELTA_ANGLE = Math.sin(Math.PI / 10);
|
|
34076
|
+
function isAngleVertical(angle) {
|
|
34077
|
+
const hasAngle = !isNil$1(angle) && 0 !== angle,
|
|
34078
|
+
cos = hasAngle ? Math.cos(angle) : 1;
|
|
34079
|
+
return hasAngle && Math.abs(cos) <= DELTA_ANGLE;
|
|
34080
|
+
}
|
|
34081
|
+
function isAngleHorizontal(angle) {
|
|
34082
|
+
const hasAngle = !isNil$1(angle) && 0 !== angle,
|
|
34083
|
+
sin = hasAngle ? Math.sin(angle) : 0;
|
|
34084
|
+
return !hasAngle || Math.abs(sin) <= DELTA_ANGLE;
|
|
34085
|
+
}
|
|
34086
|
+
|
|
34034
34087
|
function autoRotate(items, rotateConfig) {
|
|
34035
34088
|
if (isEmpty(items)) return;
|
|
34036
34089
|
const {
|
|
@@ -36541,10 +36594,19 @@
|
|
|
36541
36594
|
shape.name = `${name}-line`, shape.id = this._getNodeId(`${name}-path-${id}`), container.add(shape);
|
|
36542
36595
|
}), items.length > 1 && alternateColor) {
|
|
36543
36596
|
const colors = isArray$1(alternateColor) ? alternateColor : [alternateColor, "transparent"],
|
|
36544
|
-
getColor = index => colors[index % colors.length]
|
|
36545
|
-
|
|
36546
|
-
|
|
36547
|
-
|
|
36597
|
+
getColor = index => colors[index % colors.length],
|
|
36598
|
+
originalItems = this.attribute.items,
|
|
36599
|
+
firstItem = originalItems[0],
|
|
36600
|
+
lastItem = originalItems[originalItems.length - 1],
|
|
36601
|
+
noZero = !isNumberClose(firstItem.value, 0) && !isNumberClose(lastItem.value, 0),
|
|
36602
|
+
noOne = !isNumberClose(firstItem.value, 1) && !isNumberClose(lastItem.value, 1),
|
|
36603
|
+
allPoints = [],
|
|
36604
|
+
isDesc = firstItem.value > lastItem.value;
|
|
36605
|
+
(isDesc && noOne || !isDesc && noZero) && allPoints.push(this.getGridPointsByValue(isDesc ? 1 : 0)), items.forEach(item => {
|
|
36606
|
+
allPoints.push(item.points);
|
|
36607
|
+
}), (isDesc && noZero || !isDesc && noOne) && allPoints.push(this.getGridPointsByValue(isDesc ? 0 : 1));
|
|
36608
|
+
for (let index = 0; index < allPoints.length - 1; index++) {
|
|
36609
|
+
const path = getRegionPath(allPoints[index], allPoints[index + 1], gridAttrs),
|
|
36548
36610
|
shape = graphicCreator.path({
|
|
36549
36611
|
path: path,
|
|
36550
36612
|
fill: getColor(index)
|
|
@@ -36621,6 +36683,10 @@
|
|
|
36621
36683
|
}
|
|
36622
36684
|
return gridPoints;
|
|
36623
36685
|
}
|
|
36686
|
+
getGridPointsByValue(value) {
|
|
36687
|
+
const basePoint = this.getTickCoord(value);
|
|
36688
|
+
return this._getGridPoint(this.attribute.type, basePoint);
|
|
36689
|
+
}
|
|
36624
36690
|
getGridAttribute(isSubGrid) {
|
|
36625
36691
|
const {
|
|
36626
36692
|
type: gridType,
|
|
@@ -36634,7 +36700,7 @@
|
|
|
36634
36700
|
const subGridItems = [],
|
|
36635
36701
|
{
|
|
36636
36702
|
count: subCount = 4
|
|
36637
|
-
} =
|
|
36703
|
+
} = gridAttribute;
|
|
36638
36704
|
if (this.data.length >= 2) {
|
|
36639
36705
|
const points = this._getPointsOfSubGrid(tickSegment, alignWithLabel);
|
|
36640
36706
|
for (let i = 0; i < points.length - 1; i++) {
|
|
@@ -36642,22 +36708,21 @@
|
|
|
36642
36708
|
next = points[i + 1];
|
|
36643
36709
|
subGridItems.push({
|
|
36644
36710
|
id: `sub-${i}-0`,
|
|
36645
|
-
points: this.
|
|
36711
|
+
points: this.getGridPointsByValue(pre.value),
|
|
36646
36712
|
datum: {}
|
|
36647
36713
|
});
|
|
36648
36714
|
for (let j = 0; j < subCount; j++) {
|
|
36649
36715
|
const percent = (j + 1) / (subCount + 1),
|
|
36650
|
-
value = (1 - percent) * pre.value + percent * next.value
|
|
36651
|
-
point = this.getTickCoord(value);
|
|
36716
|
+
value = (1 - percent) * pre.value + percent * next.value;
|
|
36652
36717
|
subGridItems.push({
|
|
36653
36718
|
id: `sub-${i}-${j + 1}`,
|
|
36654
|
-
points: this.
|
|
36719
|
+
points: this.getGridPointsByValue(value),
|
|
36655
36720
|
datum: {}
|
|
36656
36721
|
});
|
|
36657
36722
|
}
|
|
36658
36723
|
i === points.length - 2 && subGridItems.push({
|
|
36659
36724
|
id: `sub-${i}-${subCount + 1}`,
|
|
36660
|
-
points: this.
|
|
36725
|
+
points: this.getGridPointsByValue(next.value),
|
|
36661
36726
|
datum: {}
|
|
36662
36727
|
});
|
|
36663
36728
|
}
|
|
@@ -36703,6 +36768,14 @@
|
|
|
36703
36768
|
constructor(attributes, options) {
|
|
36704
36769
|
super((null == options ? void 0 : options.skipDefault) ? attributes : merge$2({}, BaseGrid.defaultAttributes, attributes), options);
|
|
36705
36770
|
}
|
|
36771
|
+
getGridPointsByValue(value) {
|
|
36772
|
+
const basePoint = this.getTickCoord(value),
|
|
36773
|
+
{
|
|
36774
|
+
radius: radius,
|
|
36775
|
+
innerRadius = 0
|
|
36776
|
+
} = this.attribute;
|
|
36777
|
+
return [basePoint, this.getVerticalCoord(basePoint, radius - innerRadius, !0)];
|
|
36778
|
+
}
|
|
36706
36779
|
getGridAttribute(isSubGrid) {
|
|
36707
36780
|
let gridAttribute,
|
|
36708
36781
|
items = [];
|
|
@@ -39885,11 +39958,11 @@
|
|
|
39885
39958
|
focusShape = graphicCreator.symbol(Object.assign(Object.assign({
|
|
39886
39959
|
x: 0,
|
|
39887
39960
|
y: -focusSize / 2 - 1,
|
|
39888
|
-
strokeBoundsBuffer: 0
|
|
39961
|
+
strokeBoundsBuffer: 0,
|
|
39962
|
+
boundsPadding: parsedPadding
|
|
39889
39963
|
}, focusIconStyle), {
|
|
39890
39964
|
visible: !0,
|
|
39891
|
-
pickMode: "imprecise"
|
|
39892
|
-
boundsPadding: parsedPadding
|
|
39965
|
+
pickMode: "imprecise"
|
|
39893
39966
|
})), this._appendDataToShape(focusShape, LEGEND_ELEMENT_NAME.focus, item, itemGroup), focusSpace = focusSize;
|
|
39894
39967
|
}
|
|
39895
39968
|
const text = labelAttr.formatMethod ? labelAttr.formatMethod(label, item, index) : label,
|
|
@@ -40044,6 +40117,20 @@
|
|
|
40044
40117
|
let newPage = value[0] * this._itemContext.totalPage;
|
|
40045
40118
|
return pager.scrollByPosition ? newPage += 1 : newPage = Math.floor(newPage) + 1, newPage;
|
|
40046
40119
|
} : e => e.detail.current,
|
|
40120
|
+
onScroll = e => {
|
|
40121
|
+
e.preventDefault();
|
|
40122
|
+
const scrollComponent = this._pagerComponent,
|
|
40123
|
+
preScrollRange = scrollComponent.getScrollRange(),
|
|
40124
|
+
{
|
|
40125
|
+
direction: direction
|
|
40126
|
+
} = scrollComponent.attribute,
|
|
40127
|
+
{
|
|
40128
|
+
width: width,
|
|
40129
|
+
height: height
|
|
40130
|
+
} = scrollComponent.getSliderRenderBounds(),
|
|
40131
|
+
currentScrollValue = "vertical" === direction ? e.deltaY / height : e.deltaX / width;
|
|
40132
|
+
scrollComponent.setScrollRange([preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue], !0);
|
|
40133
|
+
},
|
|
40047
40134
|
onPaging = e => {
|
|
40048
40135
|
const newPage = pageParser(e);
|
|
40049
40136
|
if (newPage !== this._itemContext.currentPage) {
|
|
@@ -40057,7 +40144,12 @@
|
|
|
40057
40144
|
}, animationDuration, animationEasing) : this._itemsContainer.setAttribute(channel, -(newPage - 1) * pageSize);
|
|
40058
40145
|
}
|
|
40059
40146
|
};
|
|
40060
|
-
this._itemContext.isScrollbar
|
|
40147
|
+
if (this._itemContext.isScrollbar) {
|
|
40148
|
+
if (this._pagerComponent.addEventListener("scrollDrag", onPaging), this._pagerComponent.addEventListener("scrollUp", onPaging), this.attribute.pager.roamScroll) {
|
|
40149
|
+
const THROTTLE_TIME = 50;
|
|
40150
|
+
this.addEventListener("wheel", throttle(onScroll, THROTTLE_TIME));
|
|
40151
|
+
}
|
|
40152
|
+
} else this._pagerComponent.addEventListener("toPrev", onPaging), this._pagerComponent.addEventListener("toNext", onPaging);
|
|
40061
40153
|
}
|
|
40062
40154
|
_renderPager() {
|
|
40063
40155
|
const renderStartY = this._title ? this._title.AABBBounds.height() + get$1(this.attribute, "title.space", 8) : 0,
|
|
@@ -43668,7 +43760,8 @@
|
|
|
43668
43760
|
discreteLegendPagerTextColor: 'rgb(51, 51, 51)',
|
|
43669
43761
|
discreteLegendPagerHandlerColor: 'rgb(47, 69, 84)',
|
|
43670
43762
|
discreteLegendPagerHandlerDisableColor: 'rgb(170, 170, 170)',
|
|
43671
|
-
emptyCircleColor: '#e3e5e8'
|
|
43763
|
+
emptyCircleColor: '#e3e5e8',
|
|
43764
|
+
linearProgressTrackColor: '#E7EBED'
|
|
43672
43765
|
}
|
|
43673
43766
|
}
|
|
43674
43767
|
};
|
|
@@ -43879,7 +43972,7 @@
|
|
|
43879
43972
|
},
|
|
43880
43973
|
track: {
|
|
43881
43974
|
style: {
|
|
43882
|
-
fill: '
|
|
43975
|
+
fill: { type: 'palette', key: 'linearProgressTrackColor' },
|
|
43883
43976
|
fillOpacity: 1
|
|
43884
43977
|
}
|
|
43885
43978
|
}
|
|
@@ -45388,7 +45481,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
45388
45481
|
discreteLegendPagerTextColor: '#BBBDC3',
|
|
45389
45482
|
discreteLegendPagerHandlerColor: '#BBBDC3',
|
|
45390
45483
|
discreteLegendPagerHandlerDisableColor: '#55595F',
|
|
45391
|
-
emptyCircleColor: '#bbbdc3'
|
|
45484
|
+
emptyCircleColor: '#bbbdc3',
|
|
45485
|
+
linearProgressTrackColor: '#404349'
|
|
45392
45486
|
}
|
|
45393
45487
|
}
|
|
45394
45488
|
};
|
|
@@ -48886,19 +48980,27 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
48886
48980
|
}), this.differ.updateToCurrent(), this.needClear = !1);
|
|
48887
48981
|
}
|
|
48888
48982
|
evaluateMainTasks(data, parameters) {
|
|
48889
|
-
var _a;
|
|
48983
|
+
var _a, _b;
|
|
48890
48984
|
if (this.needSkipBeforeLayout() && this.view.getLayoutState() === LayoutState.before) return this;
|
|
48891
48985
|
const stage = null === (_a = this.view.renderer) || void 0 === _a ? void 0 : _a.stage();
|
|
48892
48986
|
this.init(stage, parameters);
|
|
48893
|
-
const transformData = this.evaluateTransform(this._getTransformsBeforeJoin(), null != data ? data : DefaultMarkData, parameters)
|
|
48894
|
-
|
|
48895
|
-
|
|
48987
|
+
const transformData = this.evaluateTransform(this._getTransformsBeforeJoin(), null != data ? data : DefaultMarkData, parameters),
|
|
48988
|
+
progressiveTransform = null == transformData ? void 0 : transformData.progressive;
|
|
48989
|
+
if (progressiveTransform ? this.renderContext = {
|
|
48990
|
+
large: !1
|
|
48991
|
+
} : (this.evaluateGroup(transformData), this.renderContext = this.parseRenderContext(transformData, parameters)), null === (_b = this.renderContext) || void 0 === _b ? void 0 : _b.progressive) this.differ.reset(), this.elementMap.clear(), this.evaluateProgressive();else {
|
|
48992
|
+
let inputData = null;
|
|
48993
|
+
if (progressiveTransform) {
|
|
48994
|
+
if (this.renderContext.parameters = parameters, this.renderContext.beforeTransformProgressive = transformData.progressive, inputData = transformData.progressive.output(), transformData.progressive.canAnimate && transformData.progressive.unfinished()) return this.update(this.spec), this;
|
|
48995
|
+
} else inputData = transformData;
|
|
48996
|
+
this.emit(HOOK_EVENT.BEFORE_MARK_JOIN), this.evaluateJoin(inputData), this.emit(HOOK_EVENT.AFTER_MARK_JOIN), this.emit(HOOK_EVENT.BEFORE_MARK_STATE), this.evaluateState(this.elements, this.spec.state, parameters), this.emit(HOOK_EVENT.AFTER_MARK_STATE), this.emit(HOOK_EVENT.BEFORE_MARK_ENCODE), this.evaluateEncode(this.elements, this._getEncoders(), parameters), this.emit(HOOK_EVENT.AFTER_MARK_ENCODE);
|
|
48997
|
+
}
|
|
48998
|
+
return this.update(this.spec), this;
|
|
48896
48999
|
}
|
|
48897
49000
|
evaluateGroup(data) {
|
|
48898
49001
|
if (this.markType === GrammarMarkType.group) return;
|
|
48899
|
-
const res = groupData(null != data ? data : DefaultMarkData, this.spec.groupBy, this.spec.groupSort)
|
|
48900
|
-
|
|
48901
|
-
this._groupKeys = groupKeys, this._groupEncodeResult = null, this.differ.setCurrentData(res);
|
|
49002
|
+
const res = groupData(null != data ? data : DefaultMarkData, this.spec.groupBy, this.spec.groupSort);
|
|
49003
|
+
this._groupEncodeResult = null, this._groupedData = res;
|
|
48902
49004
|
}
|
|
48903
49005
|
_getTransformsAfterEncodeItems() {
|
|
48904
49006
|
return this.transforms && this.transforms.filter(entry => "afterEncodeItems" === entry.markPhase);
|
|
@@ -49047,7 +49149,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
49047
49149
|
}
|
|
49048
49150
|
update(spec) {
|
|
49049
49151
|
var _b;
|
|
49050
|
-
if (this._context = this.spec.context, this.isUpdated = !0, this.renderContext.progressive || null === (_b = this.updateAnimate) || void 0 === _b || _b.call(this, spec), this.markType !== GrammarMarkType.group) {
|
|
49152
|
+
if (this.emit(HOOK_EVENT.BEFORE_MARK_UPDATE), this._context = this.spec.context, this.isUpdated = !0, this.renderContext.progressive || null === (_b = this.updateAnimate) || void 0 === _b || _b.call(this, spec), this.markType !== GrammarMarkType.group) {
|
|
49051
49153
|
if (isNil$1(spec.zIndex) || this.graphicItem.setAttribute("zIndex", spec.zIndex), isNil$1(spec.clip) || this.graphicItem.setAttribute("clip", spec.clip), !isNil$1(spec.clipPath)) {
|
|
49052
49154
|
const paths = isArray$1(spec.clipPath) ? spec.clipPath : spec.clipPath(this.elements);
|
|
49053
49155
|
paths && paths.length ? this.graphicItem.setAttribute("path", paths) : this.graphicItem.setAttributes({
|
|
@@ -49061,6 +49163,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
49061
49163
|
} else this.elementMap.forEach(element => {
|
|
49062
49164
|
element.updateGraphicItem();
|
|
49063
49165
|
});
|
|
49166
|
+
this.emit(HOOK_EVENT.AFTER_MARK_UPDATE);
|
|
49064
49167
|
}
|
|
49065
49168
|
createElement() {
|
|
49066
49169
|
return new Element$1(this);
|
|
@@ -49095,7 +49198,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
49095
49198
|
enterElements.delete(element);
|
|
49096
49199
|
});
|
|
49097
49200
|
const currentData = null != data ? data : DefaultMarkData;
|
|
49098
|
-
isCollectionMark
|
|
49201
|
+
isCollectionMark ? this.differ.setCurrentData(this._groupedData) : this.differ.setCurrentData(groupData(currentData, datum => `${groupKeyGetter(datum)}-${keyGetter(datum)}`, void 0)), this.differ.doDiff(), enterElements.forEach(element => {
|
|
49099
49202
|
this.elementMap.delete(isCollectionMark ? element.groupKey : `${element.groupKey}-${element.key}`), element.remove(), element.release();
|
|
49100
49203
|
}), this.elements = elements, sort && this.elements.length >= 2 && this.elements.sort((elementA, elementB) => sort(elementA.getDatum(), elementB.getDatum()));
|
|
49101
49204
|
}
|
|
@@ -49105,9 +49208,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
49105
49208
|
});
|
|
49106
49209
|
}
|
|
49107
49210
|
evaluateGroupEncode(elements, groupEncode, parameters) {
|
|
49108
|
-
if (!this.
|
|
49211
|
+
if (!this._groupedData || !groupEncode) return;
|
|
49109
49212
|
const res = {};
|
|
49110
|
-
return this.
|
|
49213
|
+
return this._groupedData.keys.forEach(key => {
|
|
49111
49214
|
const el = elements.find(el => el.groupKey === key);
|
|
49112
49215
|
el && (res[key] = invokeEncoder(groupEncode, el.items && el.items[0] && el.items[0].datum, el, parameters));
|
|
49113
49216
|
}), this._groupEncodeResult = res, res;
|
|
@@ -49152,8 +49255,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
49152
49255
|
if (graphicItem) {
|
|
49153
49256
|
if (null === (_a = this.renderContext) || void 0 === _a ? void 0 : _a.progressive) {
|
|
49154
49257
|
let group;
|
|
49155
|
-
if (this.
|
|
49156
|
-
const index = this.
|
|
49258
|
+
if (this._groupedData) {
|
|
49259
|
+
const index = this._groupedData.keys.indexOf(groupKey);
|
|
49157
49260
|
index >= 0 && (group = this.graphicParent.getChildAt(index));
|
|
49158
49261
|
} else group = this.graphicParent.at(0);
|
|
49159
49262
|
this.isCollectionMark() ? (graphicItem.incremental = 1, group.appendChild(graphicItem)) : group.incrementalAppendChild(graphicItem);
|
|
@@ -49165,7 +49268,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
49165
49268
|
const enableProgressive = this.markType !== GrammarMarkType.group && this.spec.progressiveStep > 0 && this.spec.progressiveThreshold > 0 && this.spec.progressiveStep < this.spec.progressiveThreshold,
|
|
49166
49269
|
large = this.spec.large && this.spec.largeThreshold > 0 && data.length >= this.spec.largeThreshold;
|
|
49167
49270
|
if (enableProgressive) {
|
|
49168
|
-
const groupedData = this.
|
|
49271
|
+
const groupedData = this._groupedData;
|
|
49169
49272
|
return groupedData && groupedData.keys && groupedData.keys.some(key => groupedData.data.get(key).length > this.spec.progressiveThreshold) ? {
|
|
49170
49273
|
large: large,
|
|
49171
49274
|
parameters: parameters,
|
|
@@ -49206,7 +49309,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
49206
49309
|
const currentIndex = this.renderContext.progressive.currentIndex,
|
|
49207
49310
|
keyGetter = parseField(null !== (_c = null !== (_a = this.spec.key) && void 0 !== _a ? _a : null === (_b = this.grammarSource) || void 0 === _b ? void 0 : _b.getDataIDKey()) && void 0 !== _c ? _c : () => DefaultKey),
|
|
49208
49311
|
elements = [];
|
|
49209
|
-
if (this.isCollectionMark()) return this.
|
|
49312
|
+
if (this.isCollectionMark()) return this._groupedData.keys.forEach((key, index) => {
|
|
49210
49313
|
const data = this.renderContext.progressive.groupedData.get(key),
|
|
49211
49314
|
groupStep = this.renderContext.progressive.step,
|
|
49212
49315
|
dataSlice = data.slice(currentIndex * groupStep, (currentIndex + 1) * groupStep);
|
|
@@ -49219,7 +49322,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
49219
49322
|
}
|
|
49220
49323
|
}), elements;
|
|
49221
49324
|
const groupElements = {};
|
|
49222
|
-
return this.
|
|
49325
|
+
return this._groupedData.keys.forEach(key => {
|
|
49223
49326
|
const data = this.renderContext.progressive.groupedData.get(key),
|
|
49224
49327
|
groupStep = this.renderContext.progressive.step,
|
|
49225
49328
|
dataSlice = data.slice(currentIndex * groupStep, (currentIndex + 1) * groupStep),
|
|
@@ -49249,8 +49352,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
49249
49352
|
evaluateProgressive() {
|
|
49250
49353
|
var _a, _b, _c;
|
|
49251
49354
|
if (null === (_a = this.renderContext) || void 0 === _a ? void 0 : _a.beforeTransformProgressive) {
|
|
49252
|
-
this.renderContext.beforeTransformProgressive
|
|
49253
|
-
|
|
49355
|
+
const transform = this.renderContext.beforeTransformProgressive;
|
|
49356
|
+
transform.progressiveRun();
|
|
49357
|
+
const output = transform.output();
|
|
49358
|
+
if (transform.canAnimate) {
|
|
49359
|
+
if (transform.unfinished()) return;
|
|
49360
|
+
this.evaluateGroup(output);
|
|
49361
|
+
}
|
|
49254
49362
|
return this.emit(HOOK_EVENT.BEFORE_MARK_JOIN), this.evaluateJoin(output), this.emit(HOOK_EVENT.AFTER_MARK_JOIN), this.emit(HOOK_EVENT.BEFORE_MARK_STATE), this.evaluateState(this.elements, this.spec.state, this.renderContext.parameters), this.emit(HOOK_EVENT.AFTER_MARK_STATE), this.emit(HOOK_EVENT.BEFORE_MARK_ENCODE), this.evaluateEncode(this.elements, this._getEncoders(), this.renderContext.parameters), void this.emit(HOOK_EVENT.AFTER_MARK_ENCODE);
|
|
49255
49363
|
}
|
|
49256
49364
|
if (!(null === (_b = this.renderContext) || void 0 === _b ? void 0 : _b.progressive)) return;
|
|
@@ -49258,7 +49366,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
49258
49366
|
this.emit(HOOK_EVENT.BEFORE_MARK_JOIN);
|
|
49259
49367
|
const result = this.evaluateJoinProgressive(),
|
|
49260
49368
|
elements = Array.isArray(result) ? result : result.elements;
|
|
49261
|
-
if (this.emit(HOOK_EVENT.AFTER_MARK_JOIN), 0 === this.renderContext.progressive.currentIndex ? (this.graphicParent.removeAllChild(), this.
|
|
49369
|
+
if (this.emit(HOOK_EVENT.AFTER_MARK_JOIN), 0 === this.renderContext.progressive.currentIndex ? (this.graphicParent.removeAllChild(), this._groupedData.keys.forEach(key => {
|
|
49262
49370
|
const graphicItem = createGraphicItem(this, GrammarMarkType.group, {
|
|
49263
49371
|
pickable: !1,
|
|
49264
49372
|
zIndex: this.spec.zIndex
|
|
@@ -49332,10 +49440,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
49332
49440
|
}
|
|
49333
49441
|
prepareRelease() {
|
|
49334
49442
|
var _a;
|
|
49335
|
-
null === (_a = this.animate) || void 0 === _a || _a.stop(), this.elementMap.forEach(element => element.diffState = DiffState.exit), this._finalParameters = this.parameters();
|
|
49443
|
+
this.differ.setCurrentData(null), null === (_a = this.animate) || void 0 === _a || _a.stop(), this.elementMap.forEach(element => element.diffState = DiffState.exit), this._finalParameters = this.parameters();
|
|
49336
49444
|
}
|
|
49337
49445
|
release() {
|
|
49338
|
-
this.releaseEvent(), this.elements.forEach(element => element.release()), this.elementMap.clear(), this._finalParameters = null, this.animate && this.animate.release(), this.graphicItem && removeGraphicItem(this.graphicItem), this.detachAll(), super.release();
|
|
49446
|
+
this.releaseEvent(), this.elements.forEach(element => element.release()), this.differ = null, this.elements = [], this.elementMap.clear(), this._finalParameters = null, this.animate && this.animate.release(), this.graphicItem && removeGraphicItem(this.graphicItem), this.detachAll(), super.release();
|
|
49339
49447
|
}
|
|
49340
49448
|
}
|
|
49341
49449
|
|
|
@@ -55707,8 +55815,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
55707
55815
|
});
|
|
55708
55816
|
return viewData;
|
|
55709
55817
|
}
|
|
55710
|
-
function dataToDataView(data, dataSet, sourceDataViews = []
|
|
55711
|
-
var _a
|
|
55818
|
+
function dataToDataView(data, dataSet, sourceDataViews = []) {
|
|
55819
|
+
var _a;
|
|
55712
55820
|
if (data instanceof DataView) {
|
|
55713
55821
|
return data;
|
|
55714
55822
|
}
|
|
@@ -55730,7 +55838,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
55730
55838
|
if (typeof fromDataId === 'string') {
|
|
55731
55839
|
const fromDataView = sourceDataViews.find(dv => dv.name === fromDataId);
|
|
55732
55840
|
if (!fromDataView) {
|
|
55733
|
-
(
|
|
55841
|
+
warn(`no data matches fromDataId ${fromDataId}`);
|
|
55734
55842
|
return null;
|
|
55735
55843
|
}
|
|
55736
55844
|
dataView.parse([fromDataView], {
|
|
@@ -55743,7 +55851,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
55743
55851
|
else if (typeof fromDataIndex === 'number') {
|
|
55744
55852
|
const fromDataView = sourceDataViews[fromDataIndex];
|
|
55745
55853
|
if (!fromDataView) {
|
|
55746
|
-
(
|
|
55854
|
+
warn(`no data matches fromDataIndex ${fromDataIndex}`);
|
|
55747
55855
|
return null;
|
|
55748
55856
|
}
|
|
55749
55857
|
dataView.parse([fromDataView], {
|
|
@@ -55757,7 +55865,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
55757
55865
|
dataView.parse(values, parser);
|
|
55758
55866
|
}
|
|
55759
55867
|
else if (isString$1(values) && (!parser || ['csv', 'dsv', 'tsv'].includes(parser.type))) {
|
|
55760
|
-
dataView.parse(values, (
|
|
55868
|
+
dataView.parse(values, (_a = parser) !== null && _a !== void 0 ? _a : { type: 'csv' });
|
|
55761
55869
|
}
|
|
55762
55870
|
else {
|
|
55763
55871
|
dataView.parse([]);
|
|
@@ -59984,6 +60092,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
59984
60092
|
plugin.onAfterChartSpecTransform && plugin.onAfterChartSpecTransform(this, chartSpec, actionSource);
|
|
59985
60093
|
});
|
|
59986
60094
|
}
|
|
60095
|
+
onAfterModelSpecTransform(chartSpec, chartSpecInfo, actionSource) {
|
|
60096
|
+
this._plugins.forEach(plugin => {
|
|
60097
|
+
plugin.onAfterModelSpecTransform &&
|
|
60098
|
+
plugin.onAfterModelSpecTransform(this, chartSpec, chartSpecInfo, actionSource);
|
|
60099
|
+
});
|
|
60100
|
+
}
|
|
59987
60101
|
onBeforeInitChart(chartSpec, actionSource) {
|
|
59988
60102
|
this._plugins.forEach(plugin => {
|
|
59989
60103
|
plugin.onBeforeInitChart && plugin.onBeforeInitChart(this, chartSpec, actionSource);
|
|
@@ -60136,7 +60250,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
60136
60250
|
result.changeTheme = true;
|
|
60137
60251
|
return result;
|
|
60138
60252
|
}
|
|
60139
|
-
this._initChartSpec(this._spec, '
|
|
60253
|
+
this._initChartSpec(this._spec, 'updateSpec');
|
|
60140
60254
|
const res = mergeUpdateResult(this._chart.updateSpec(this._spec), result);
|
|
60141
60255
|
return userUpdateOptions
|
|
60142
60256
|
? Object.assign(Object.assign({}, res), userUpdateOptions) : res;
|
|
@@ -60565,7 +60679,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
60565
60679
|
const prevData = array(this._spec.data);
|
|
60566
60680
|
const list = array(data);
|
|
60567
60681
|
list.forEach(d => {
|
|
60568
|
-
var _a;
|
|
60569
60682
|
const { id, values, parser, fields } = d;
|
|
60570
60683
|
const preDV = prevData.find(dv => dv.name === id);
|
|
60571
60684
|
if (preDV) {
|
|
@@ -60580,9 +60693,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
60580
60693
|
}
|
|
60581
60694
|
}
|
|
60582
60695
|
else {
|
|
60583
|
-
const dataView = dataToDataView(d, this._dataSet, prevData
|
|
60584
|
-
onError: (_a = this._option) === null || _a === void 0 ? void 0 : _a.onError
|
|
60585
|
-
});
|
|
60696
|
+
const dataView = dataToDataView(d, this._dataSet, prevData);
|
|
60586
60697
|
if (isArray$1(this._spec.data)) {
|
|
60587
60698
|
this._spec.data.push(dataView);
|
|
60588
60699
|
}
|
|
@@ -61296,7 +61407,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
61296
61407
|
};
|
|
61297
61408
|
registerVChartCore();
|
|
61298
61409
|
|
|
61299
|
-
const version = "1.12.
|
|
61410
|
+
const version = "1.12.7";
|
|
61300
61411
|
|
|
61301
61412
|
const addVChartProperty = (data, op) => {
|
|
61302
61413
|
const context = op.beforeCall();
|
|
@@ -62423,14 +62534,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
62423
62534
|
}
|
|
62424
62535
|
}
|
|
62425
62536
|
initData() {
|
|
62426
|
-
var _a, _b, _c
|
|
62537
|
+
var _a, _b, _c;
|
|
62427
62538
|
const d = (_a = this._spec.data) !== null && _a !== void 0 ? _a : this._option.getSeriesData(this._spec.dataId, this._spec.dataIndex);
|
|
62428
62539
|
if (d) {
|
|
62429
|
-
this._rawData = dataToDataView(d, this._dataSet, this._option.sourceDataList
|
|
62430
|
-
onError: (_b = this._option) === null || _b === void 0 ? void 0 : _b.onError
|
|
62431
|
-
});
|
|
62540
|
+
this._rawData = dataToDataView(d, this._dataSet, this._option.sourceDataList);
|
|
62432
62541
|
}
|
|
62433
|
-
(
|
|
62542
|
+
(_c = (_b = this._rawData) === null || _b === void 0 ? void 0 : _b.target) === null || _c === void 0 ? void 0 : _c.addListener('change', this.rawDataUpdate.bind(this));
|
|
62434
62543
|
this._addDataIndexAndKey();
|
|
62435
62544
|
if (this._rawData) {
|
|
62436
62545
|
if (this.getStack()) {
|
|
@@ -65889,12 +65998,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
65889
65998
|
const attrs = this._getUpdateAttribute(true);
|
|
65890
65999
|
const axisComponent = product.getGroupGraphicItem();
|
|
65891
66000
|
const spec = mergeSpec(Object.assign({}, this.getLayoutStartPoint()), this._axisStyle, attrs, { line: { visible: false } });
|
|
65892
|
-
|
|
66001
|
+
let updateBounds = axisComponent.getBoundsWithoutRender(spec);
|
|
66002
|
+
if (updateBounds.empty()) {
|
|
66003
|
+
updateBounds = new Bounds().set(spec.x, spec.y, spec.x, spec.y);
|
|
66004
|
+
}
|
|
65893
66005
|
hasBounds = true;
|
|
65894
66006
|
this._latestBounds = updateBounds;
|
|
65895
|
-
|
|
65896
|
-
result = this._appendAxisUnit(updateBounds, isX);
|
|
65897
|
-
}
|
|
66007
|
+
result = this._appendAxisUnit(updateBounds, isX);
|
|
65898
66008
|
}
|
|
65899
66009
|
if (!hasBounds) {
|
|
65900
66010
|
this._latestBounds = product.getBounds();
|
|
@@ -67222,16 +67332,15 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
67222
67332
|
get dataList() {
|
|
67223
67333
|
return this._dataArr;
|
|
67224
67334
|
}
|
|
67225
|
-
constructor(dataSet
|
|
67335
|
+
constructor(dataSet) {
|
|
67226
67336
|
this._dataArr = [];
|
|
67227
|
-
this._onError = onError;
|
|
67228
67337
|
this._dataSet = dataSet;
|
|
67229
67338
|
}
|
|
67230
67339
|
parseData(dataSpec) {
|
|
67231
67340
|
this._dataArr = [];
|
|
67232
67341
|
const list = array(dataSpec);
|
|
67233
67342
|
for (let i = 0; i < list.length; i++) {
|
|
67234
|
-
this._dataArr.push(dataToDataView(list[i], this._dataSet, this._dataArr
|
|
67343
|
+
this._dataArr.push(dataToDataView(list[i], this._dataSet, this._dataArr));
|
|
67235
67344
|
}
|
|
67236
67345
|
}
|
|
67237
67346
|
updateData(dataSpec, fullUp = false, forceMerge = true) {
|
|
@@ -67260,7 +67369,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
67260
67369
|
});
|
|
67261
67370
|
}
|
|
67262
67371
|
getSeriesData(id, index) {
|
|
67263
|
-
var _a, _b;
|
|
67264
67372
|
if (!this._dataArr.length) {
|
|
67265
67373
|
return null;
|
|
67266
67374
|
}
|
|
@@ -67271,15 +67379,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
67271
67379
|
if (metchData[0]) {
|
|
67272
67380
|
return metchData[0];
|
|
67273
67381
|
}
|
|
67274
|
-
(
|
|
67275
|
-
return null;
|
|
67382
|
+
warn(`no data matches dataId ${id}!`);
|
|
67276
67383
|
}
|
|
67277
67384
|
if (typeof index === 'number') {
|
|
67278
67385
|
if (this._dataArr[index]) {
|
|
67279
67386
|
return this._dataArr[index];
|
|
67280
67387
|
}
|
|
67281
|
-
(
|
|
67282
|
-
return null;
|
|
67388
|
+
warn(`no data matches dataIndex ${index}!`);
|
|
67283
67389
|
}
|
|
67284
67390
|
return this._dataArr[0];
|
|
67285
67391
|
}
|
|
@@ -67639,7 +67745,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
67639
67745
|
return this._chartData;
|
|
67640
67746
|
}
|
|
67641
67747
|
constructor(spec, option) {
|
|
67642
|
-
var _a, _b, _c
|
|
67748
|
+
var _a, _b, _c;
|
|
67643
67749
|
super(option);
|
|
67644
67750
|
this.type = 'chart';
|
|
67645
67751
|
this.id = createID();
|
|
@@ -67769,8 +67875,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
67769
67875
|
this._paddingSpec = normalizeLayoutPaddingSpec((_a = spec.padding) !== null && _a !== void 0 ? _a : option.getTheme().padding);
|
|
67770
67876
|
this._event = new Event$1(option.eventDispatcher, option.mode);
|
|
67771
67877
|
this._dataSet = option.dataSet;
|
|
67772
|
-
this._chartData = new ChartData(this._dataSet
|
|
67773
|
-
this._modelOption = Object.assign(Object.assign({}, option), { mode: this._option.mode, map: this._idMap, getChartLayoutRect: () => this._layoutRect, getChartViewRect: () => this._viewRect, getChart: () => this, globalScale: this._globalScale, onError: (
|
|
67878
|
+
this._chartData = new ChartData(this._dataSet);
|
|
67879
|
+
this._modelOption = Object.assign(Object.assign({}, option), { mode: this._option.mode, map: this._idMap, getChartLayoutRect: () => this._layoutRect, getChartViewRect: () => this._viewRect, getChart: () => this, globalScale: this._globalScale, onError: (_b = this._option) === null || _b === void 0 ? void 0 : _b.onError, disableTriggerEvent: ((_c = this._option) === null || _c === void 0 ? void 0 : _c.disableTriggerEvent) === true, getSeriesData: this._chartData.getSeriesData.bind(this._chartData) });
|
|
67774
67880
|
this._spec = spec;
|
|
67775
67881
|
}
|
|
67776
67882
|
created() {
|
|
@@ -68096,6 +68202,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
68096
68202
|
this._globalScale.getScale('color').range(colorSpec.range);
|
|
68097
68203
|
}
|
|
68098
68204
|
}
|
|
68205
|
+
_getSpecKeys(spec) {
|
|
68206
|
+
const ignoreKeys = { width: true, height: true };
|
|
68207
|
+
return Object.keys(spec)
|
|
68208
|
+
.filter(key => !ignoreKeys[key])
|
|
68209
|
+
.sort();
|
|
68210
|
+
}
|
|
68099
68211
|
updateSpec(spec) {
|
|
68100
68212
|
const result = {
|
|
68101
68213
|
change: false,
|
|
@@ -68109,9 +68221,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
68109
68221
|
result.reMake = true;
|
|
68110
68222
|
return result;
|
|
68111
68223
|
}
|
|
68112
|
-
const currentKeys =
|
|
68113
|
-
const nextKeys =
|
|
68114
|
-
if (
|
|
68224
|
+
const currentKeys = this._getSpecKeys(this._spec);
|
|
68225
|
+
const nextKeys = this._getSpecKeys(spec);
|
|
68226
|
+
if (!isEqual(currentKeys, nextKeys)) {
|
|
68115
68227
|
result.reMake = true;
|
|
68116
68228
|
return result;
|
|
68117
68229
|
}
|
|
@@ -68210,10 +68322,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
68210
68322
|
}
|
|
68211
68323
|
}
|
|
68212
68324
|
}
|
|
68325
|
+
const isVisible = (compSpec) => compSpec && compSpec.visible !== false;
|
|
68213
68326
|
Object.keys(checkVisibleComponents).forEach(type => {
|
|
68214
68327
|
if (checkVisibleComponents[type]) {
|
|
68215
68328
|
const compSpec = this._spec[type];
|
|
68216
|
-
const switchToVisible = isArray$1(compSpec) ? compSpec.some(
|
|
68329
|
+
const switchToVisible = isArray$1(compSpec) ? compSpec.some(isVisible) : isVisible(compSpec);
|
|
68217
68330
|
if (switchToVisible) {
|
|
68218
68331
|
result.reMake = true;
|
|
68219
68332
|
}
|
|
@@ -80080,12 +80193,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
80080
80193
|
return this._valueField;
|
|
80081
80194
|
}
|
|
80082
80195
|
setAttrFromSpec() {
|
|
80083
|
-
var _a, _b;
|
|
80196
|
+
var _a, _b, _c, _d, _e;
|
|
80084
80197
|
super.setAttrFromSpec();
|
|
80085
80198
|
this.setCategoryField(this._spec.categoryField);
|
|
80086
80199
|
this.setValueField(this._spec.valueField);
|
|
80087
80200
|
this._funnelOrient = (_a = this._spec.funnelOrient) !== null && _a !== void 0 ? _a : 'top';
|
|
80088
80201
|
this._shape = (_b = this._spec.shape) !== null && _b !== void 0 ? _b : 'trapezoid';
|
|
80202
|
+
this._minLabelLineWidth = (_e = (_d = (_c = this._spec.outerLabel) === null || _c === void 0 ? void 0 : _c.line) === null || _d === void 0 ? void 0 : _d.minLength) !== null && _e !== void 0 ? _e : FUNNEL_LABEL_LINE_LENGTH;
|
|
80089
80203
|
if (this._isHorizontal()) {
|
|
80090
80204
|
this._funnelAlign = ['top', 'bottom'].includes(this._spec.funnelAlign) ? this._spec.funnelAlign : 'center';
|
|
80091
80205
|
}
|
|
@@ -80593,7 +80707,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
80593
80707
|
return type === 'text' && ((_a = attribute.data) === null || _a === void 0 ? void 0 : _a[categoryField]) === datum[categoryField];
|
|
80594
80708
|
}, true)) === null || _c === void 0 ? void 0 : _c.AABBBounds;
|
|
80595
80709
|
const funnelLabelWidth = funnelLabelBounds ? funnelLabelBounds.x2 - funnelLabelBounds.x1 : 0;
|
|
80596
|
-
const outerLineSpace = this._funnelOuterLabelMark.line ?
|
|
80710
|
+
const outerLineSpace = this._funnelOuterLabelMark.line ? this._minLabelLineWidth : 0;
|
|
80597
80711
|
let space = this.getLayoutRect().width - Math.max(shapeMiddleWidth, funnelLabelWidth);
|
|
80598
80712
|
if (this._funnelAlign === 'center') {
|
|
80599
80713
|
space /= 2;
|
|
@@ -80621,14 +80735,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
80621
80735
|
y1 = this._getPolygonCenter(points).y - shapeMiddleHeight / 2 - spaceWidth;
|
|
80622
80736
|
y2 = outerLabelSpec.alignLabel !== false ? (outerLabelMarkBounds === null || outerLabelMarkBounds === void 0 ? void 0 : outerLabelMarkBounds.y2) + spaceWidth : y1 - spaceWidth;
|
|
80623
80737
|
x1 = this._getPolygonCenter(points).x;
|
|
80624
|
-
y1 - y2 <
|
|
80738
|
+
y1 - y2 < this._minLabelLineWidth && (y2 = y1 - this._minLabelLineWidth);
|
|
80625
80739
|
x2 = x1;
|
|
80626
80740
|
}
|
|
80627
80741
|
else {
|
|
80628
80742
|
y1 = this._getPolygonCenter(points).y + shapeMiddleHeight / 2 + spaceWidth;
|
|
80629
80743
|
y2 = outerLabelSpec.alignLabel !== false ? (outerLabelMarkBounds === null || outerLabelMarkBounds === void 0 ? void 0 : outerLabelMarkBounds.y1) - spaceWidth : y1 + spaceWidth;
|
|
80630
80744
|
x1 = this._getPolygonCenter(points).x;
|
|
80631
|
-
y2 - y1 <
|
|
80745
|
+
y2 - y1 < this._minLabelLineWidth && (y2 = y1 + this._minLabelLineWidth);
|
|
80632
80746
|
x2 = x1;
|
|
80633
80747
|
}
|
|
80634
80748
|
return { x1, x2, y1, y2 };
|
|
@@ -80641,14 +80755,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
80641
80755
|
x1 = this._getPolygonCenter(points).x + Math.max(labelWidth / 2, shapeMiddleWidth / 2) + spaceWidth;
|
|
80642
80756
|
x2 = outerLabelSpec.alignLabel !== false ? (outerLabelMarkBounds === null || outerLabelMarkBounds === void 0 ? void 0 : outerLabelMarkBounds.x1) - spaceWidth : x1 + spaceWidth;
|
|
80643
80757
|
y1 = this._getPolygonCenter(points).y;
|
|
80644
|
-
x2 - x1 <
|
|
80758
|
+
x2 - x1 < this._minLabelLineWidth && (x2 = x1 + this._minLabelLineWidth);
|
|
80645
80759
|
y2 = y1;
|
|
80646
80760
|
}
|
|
80647
80761
|
else {
|
|
80648
80762
|
x1 = this._getPolygonCenter(points).x - Math.max(labelWidth / 2, shapeMiddleWidth / 2) - spaceWidth;
|
|
80649
80763
|
x2 = outerLabelSpec.alignLabel !== false ? (outerLabelMarkBounds === null || outerLabelMarkBounds === void 0 ? void 0 : outerLabelMarkBounds.x2) + spaceWidth : x1 - spaceWidth;
|
|
80650
80764
|
y1 = this._getPolygonCenter(points).y;
|
|
80651
|
-
x1 - x2 <
|
|
80765
|
+
x1 - x2 < this._minLabelLineWidth && (x2 = x1 - this._minLabelLineWidth);
|
|
80652
80766
|
y2 = y1;
|
|
80653
80767
|
}
|
|
80654
80768
|
return { x1, x2, y1, y2 };
|
|
@@ -92496,11 +92610,27 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
92496
92610
|
});
|
|
92497
92611
|
let filter = null;
|
|
92498
92612
|
if (isContinuous()) {
|
|
92499
|
-
filter = (d) =>
|
|
92613
|
+
filter = (d) => {
|
|
92614
|
+
let flag = false;
|
|
92615
|
+
array(datumField).every(field => {
|
|
92616
|
+
if (d[field] >= newDomain[0] && d[field] <= last(newDomain)) {
|
|
92617
|
+
flag = true;
|
|
92618
|
+
}
|
|
92619
|
+
return;
|
|
92620
|
+
});
|
|
92621
|
+
return flag;
|
|
92622
|
+
};
|
|
92500
92623
|
}
|
|
92501
92624
|
else {
|
|
92502
92625
|
filter = (d) => {
|
|
92503
|
-
|
|
92626
|
+
let flag = false;
|
|
92627
|
+
array(datumField).every(field => {
|
|
92628
|
+
if (domainMap[d[field] + ''] || domainMap[d[field]]) {
|
|
92629
|
+
flag = true;
|
|
92630
|
+
}
|
|
92631
|
+
return;
|
|
92632
|
+
});
|
|
92633
|
+
return flag;
|
|
92504
92634
|
};
|
|
92505
92635
|
}
|
|
92506
92636
|
return data.filter(filter);
|
|
@@ -92910,18 +93040,28 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
92910
93040
|
: yAxisHelper;
|
|
92911
93041
|
const valueAxisHelper = stateAxisHelper === xAxisHelper ? yAxisHelper : xAxisHelper;
|
|
92912
93042
|
const isValidateValueAxis = isContinuous(valueAxisHelper.getScale(0).type);
|
|
93043
|
+
const isValidateStateAxis = isContinuous(stateAxisHelper.getScale(0).type);
|
|
92913
93044
|
dataCollection.push(s.getRawData());
|
|
92914
93045
|
const seriesSpec = s.getSpec();
|
|
92915
|
-
const
|
|
92916
|
-
|
|
92917
|
-
|
|
92918
|
-
const yField = s.coordinate === 'cartesian'
|
|
93046
|
+
const xField = s.coordinate === 'cartesian'
|
|
93047
|
+
? array(seriesSpec.xField)
|
|
93048
|
+
: array((_a = seriesSpec.angleField) !== null && _a !== void 0 ? _a : seriesSpec.categoryField);
|
|
93049
|
+
const yField = s.coordinate === 'cartesian'
|
|
93050
|
+
? array(seriesSpec.yField)
|
|
93051
|
+
: array((_b = seriesSpec.radiusField) !== null && _b !== void 0 ? _b : seriesSpec.valueField);
|
|
92919
93052
|
originalStateFields[s.id] =
|
|
92920
|
-
s.type === 'link' ? 'from_xField' : stateAxisHelper === xAxisHelper ? xField : yField;
|
|
92921
|
-
|
|
93053
|
+
s.type === 'link' ? ['from_xField'] : stateAxisHelper === xAxisHelper ? xField : yField;
|
|
93054
|
+
if (isValidateStateAxis) {
|
|
93055
|
+
stateFields.push(originalStateFields[s.id]);
|
|
93056
|
+
}
|
|
93057
|
+
else {
|
|
93058
|
+
stateFields.push(originalStateFields[s.id][0]);
|
|
93059
|
+
}
|
|
92922
93060
|
if (this._valueField) {
|
|
92923
|
-
const valueField = s.type === 'link' ? 'from_yField' : valueAxisHelper === xAxisHelper ? xField : yField;
|
|
92924
|
-
|
|
93061
|
+
const valueField = s.type === 'link' ? ['from_yField'] : valueAxisHelper === xAxisHelper ? xField : yField;
|
|
93062
|
+
if (isValidateValueAxis) {
|
|
93063
|
+
valueFields.push(...valueField);
|
|
93064
|
+
}
|
|
92925
93065
|
}
|
|
92926
93066
|
}, {
|
|
92927
93067
|
userId: this._seriesUserId,
|
|
@@ -101232,6 +101372,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
101232
101372
|
this._reInit(false, false);
|
|
101233
101373
|
}
|
|
101234
101374
|
}
|
|
101375
|
+
onAfterModelSpecTransform(service, chartSpec, chartInfo, actionSource) {
|
|
101376
|
+
if (!this._initialized) {
|
|
101377
|
+
return;
|
|
101378
|
+
}
|
|
101379
|
+
if (actionSource === 'updateSpec') {
|
|
101380
|
+
this.onBeforeInitChart(service, chartSpec, 'setCurrentTheme');
|
|
101381
|
+
}
|
|
101382
|
+
}
|
|
101235
101383
|
onBeforeInitChart(service, chartSpec, actionSource) {
|
|
101236
101384
|
if (!this._initialized) {
|
|
101237
101385
|
return;
|
|
@@ -101244,7 +101392,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
101244
101392
|
resetMediaQuery = false;
|
|
101245
101393
|
checkMediaQuery = true;
|
|
101246
101394
|
break;
|
|
101247
|
-
case 'updateSpec':
|
|
101248
101395
|
case 'setCurrentTheme':
|
|
101249
101396
|
resetMediaQuery = true;
|
|
101250
101397
|
checkMediaQuery = false;
|