@visactor/vchart 1.12.12 → 1.12.13
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 +1 -1
- package/build/index.js +585 -448
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/compile/util.js +2 -1
- package/cjs/component/index.js +1 -2
- 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/plugin/components/tooltip-handler/dom/model/shape-model.js.map +1 -1
- package/cjs/series/box-plot/box-plot.js +2 -0
- package/cjs/series/box-plot/box-plot.js.map +1 -1
- package/cjs/series/funnel/funnel.js +8 -7
- package/cjs/series/funnel/funnel.js.map +1 -1
- package/esm/compile/util.js +2 -1
- package/esm/component/index.js +1 -2
- 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/plugin/components/tooltip-handler/dom/model/shape-model.js.map +1 -1
- package/esm/series/box-plot/box-plot.js +2 -0
- package/esm/series/box-plot/box-plot.js.map +1 -1
- package/esm/series/funnel/funnel.js +8 -7
- package/esm/series/funnel/funnel.js.map +1 -1
- package/package.json +15 -15
package/build/index.js
CHANGED
|
@@ -1261,7 +1261,7 @@
|
|
|
1261
1261
|
function sub(out, v1, v2) {
|
|
1262
1262
|
out[0] = v1[0] - v2[0], out[1] = v1[1] - v2[1];
|
|
1263
1263
|
}
|
|
1264
|
-
function isIntersect(left1, right1, left2, right2) {
|
|
1264
|
+
function isIntersect$1(left1, right1, left2, right2) {
|
|
1265
1265
|
let min1 = left1[0],
|
|
1266
1266
|
max1 = right1[0],
|
|
1267
1267
|
min2 = left2[0],
|
|
@@ -1269,7 +1269,7 @@
|
|
|
1269
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
1270
|
}
|
|
1271
1271
|
function getIntersectPoint(left1, right1, left2, right2) {
|
|
1272
|
-
if (!isIntersect(left1, right1, left2, right2)) return !1;
|
|
1272
|
+
if (!isIntersect$1(left1, right1, left2, right2)) return !1;
|
|
1273
1273
|
const dir1 = [0, 0],
|
|
1274
1274
|
dir2 = [0, 0],
|
|
1275
1275
|
tempVec = [0, 0];
|
|
@@ -1454,7 +1454,7 @@
|
|
|
1454
1454
|
function lineIntersectPolygon(a1x, a1y, a2x, a2y, points) {
|
|
1455
1455
|
for (let i = 0, p2 = points[points.length - 1]; i < points.length; i++) {
|
|
1456
1456
|
const p = points[i];
|
|
1457
|
-
if (isIntersect([a1x, a1y], [a2x, a2y], [p.x, p.y], [p2.x, p2.y])) return !0;
|
|
1457
|
+
if (isIntersect$1([a1x, a1y], [a2x, a2y], [p.x, p.y], [p2.x, p2.y])) return !0;
|
|
1458
1458
|
p2 = p;
|
|
1459
1459
|
}
|
|
1460
1460
|
return !1;
|
|
@@ -9350,6 +9350,292 @@
|
|
|
9350
9350
|
class Application {}
|
|
9351
9351
|
const application = new Application();
|
|
9352
9352
|
|
|
9353
|
+
const parse = function () {
|
|
9354
|
+
const tokens = {
|
|
9355
|
+
linearGradient: /^(linear\-gradient)/i,
|
|
9356
|
+
radialGradient: /^(radial\-gradient)/i,
|
|
9357
|
+
conicGradient: /^(conic\-gradient)/i,
|
|
9358
|
+
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,
|
|
9359
|
+
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
|
9360
|
+
positionKeywords: /^(left|center|right|top|bottom)/i,
|
|
9361
|
+
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
|
|
9362
|
+
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
|
|
9363
|
+
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
|
|
9364
|
+
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
|
9365
|
+
fromAngleValue: /^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
|
9366
|
+
startCall: /^\(/,
|
|
9367
|
+
endCall: /^\)/,
|
|
9368
|
+
comma: /^,/,
|
|
9369
|
+
hexColor: /(^\#[0-9a-fA-F]+)/,
|
|
9370
|
+
literalColor: /^([a-zA-Z]+)/,
|
|
9371
|
+
rgbColor: /^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,
|
|
9372
|
+
rgbaColor: /^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,
|
|
9373
|
+
number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
|
|
9374
|
+
};
|
|
9375
|
+
let input = "";
|
|
9376
|
+
function error(msg) {
|
|
9377
|
+
const err = new Error(input + ": " + msg);
|
|
9378
|
+
throw err.source = input, err;
|
|
9379
|
+
}
|
|
9380
|
+
function getAST() {
|
|
9381
|
+
const ast = matchListing(matchDefinition);
|
|
9382
|
+
return input.length > 0 && error("Invalid input not EOF"), ast;
|
|
9383
|
+
}
|
|
9384
|
+
function matchDefinition() {
|
|
9385
|
+
return matchGradient("linear", tokens.linearGradient, matchLinearOrientation) || matchGradient("radial", tokens.radialGradient, matchListRadialOrientations) || matchGradient("conic", tokens.conicGradient, matchConicalOrientation);
|
|
9386
|
+
}
|
|
9387
|
+
function matchGradient(gradientType, pattern, orientationMatcher) {
|
|
9388
|
+
return function (pattern, callback) {
|
|
9389
|
+
const captures = scan(pattern);
|
|
9390
|
+
if (captures) {
|
|
9391
|
+
scan(tokens.startCall) || error("Missing (");
|
|
9392
|
+
const result = callback(captures);
|
|
9393
|
+
return scan(tokens.endCall) || error("Missing )"), result;
|
|
9394
|
+
}
|
|
9395
|
+
}(pattern, function (captures) {
|
|
9396
|
+
const orientation = orientationMatcher();
|
|
9397
|
+
return orientation && (scan(tokens.comma) || error("Missing comma before color stops")), {
|
|
9398
|
+
type: gradientType,
|
|
9399
|
+
orientation: orientation,
|
|
9400
|
+
colorStops: matchListing(matchColorStop)
|
|
9401
|
+
};
|
|
9402
|
+
});
|
|
9403
|
+
}
|
|
9404
|
+
function matchLinearOrientation() {
|
|
9405
|
+
return match("directional", tokens.sideOrCorner, 1) || match("angular", tokens.angleValue, 1);
|
|
9406
|
+
}
|
|
9407
|
+
function matchConicalOrientation() {
|
|
9408
|
+
return match("angular", tokens.fromAngleValue, 1);
|
|
9409
|
+
}
|
|
9410
|
+
function matchListRadialOrientations() {
|
|
9411
|
+
let radialOrientations,
|
|
9412
|
+
lookaheadCache,
|
|
9413
|
+
radialOrientation = matchRadialOrientation();
|
|
9414
|
+
return radialOrientation && (radialOrientations = [], radialOrientations.push(radialOrientation), lookaheadCache = input, scan(tokens.comma) && (radialOrientation = matchRadialOrientation(), radialOrientation ? radialOrientations.push(radialOrientation) : input = lookaheadCache)), radialOrientations;
|
|
9415
|
+
}
|
|
9416
|
+
function matchRadialOrientation() {
|
|
9417
|
+
let radialType = function () {
|
|
9418
|
+
const circle = match("shape", /^(circle)/i, 0);
|
|
9419
|
+
circle && (circle.style = matchLength() || matchExtentKeyword());
|
|
9420
|
+
return circle;
|
|
9421
|
+
}() || function () {
|
|
9422
|
+
const ellipse = match("shape", /^(ellipse)/i, 0);
|
|
9423
|
+
ellipse && (ellipse.style = matchDistance() || matchExtentKeyword());
|
|
9424
|
+
return ellipse;
|
|
9425
|
+
}();
|
|
9426
|
+
if (radialType) radialType.at = matchAtPosition();else {
|
|
9427
|
+
const extent = matchExtentKeyword();
|
|
9428
|
+
if (extent) {
|
|
9429
|
+
radialType = extent;
|
|
9430
|
+
const positionAt = matchAtPosition();
|
|
9431
|
+
positionAt && (radialType.at = positionAt);
|
|
9432
|
+
} else {
|
|
9433
|
+
const defaultPosition = matchPositioning();
|
|
9434
|
+
defaultPosition && (radialType = {
|
|
9435
|
+
type: "default-radial",
|
|
9436
|
+
at: defaultPosition
|
|
9437
|
+
});
|
|
9438
|
+
}
|
|
9439
|
+
}
|
|
9440
|
+
return radialType;
|
|
9441
|
+
}
|
|
9442
|
+
function matchExtentKeyword() {
|
|
9443
|
+
return match("extent-keyword", tokens.extentKeywords, 1);
|
|
9444
|
+
}
|
|
9445
|
+
function matchAtPosition() {
|
|
9446
|
+
if (match("position", /^at/, 0)) {
|
|
9447
|
+
const positioning = matchPositioning();
|
|
9448
|
+
return positioning || error("Missing positioning value"), positioning;
|
|
9449
|
+
}
|
|
9450
|
+
}
|
|
9451
|
+
function matchPositioning() {
|
|
9452
|
+
const location = {
|
|
9453
|
+
x: matchDistance(),
|
|
9454
|
+
y: matchDistance()
|
|
9455
|
+
};
|
|
9456
|
+
if (location.x || location.y) return {
|
|
9457
|
+
type: "position",
|
|
9458
|
+
value: location
|
|
9459
|
+
};
|
|
9460
|
+
}
|
|
9461
|
+
function matchListing(matcher) {
|
|
9462
|
+
let captures = matcher();
|
|
9463
|
+
const result = [];
|
|
9464
|
+
if (captures) for (result.push(captures); scan(tokens.comma);) captures = matcher(), captures ? result.push(captures) : error("One extra comma");
|
|
9465
|
+
return result;
|
|
9466
|
+
}
|
|
9467
|
+
function matchColorStop() {
|
|
9468
|
+
const color = match("hex", tokens.hexColor, 1) || match("rgba", tokens.rgbaColor, 1) || match("rgb", tokens.rgbColor, 1) || match("literal", tokens.literalColor, 0);
|
|
9469
|
+
return color || error("Expected color definition"), color.length = matchDistance(), color;
|
|
9470
|
+
}
|
|
9471
|
+
function matchDistance() {
|
|
9472
|
+
return match("%", tokens.percentageValue, 1) || match("position-keyword", tokens.positionKeywords, 1) || matchLength();
|
|
9473
|
+
}
|
|
9474
|
+
function matchLength() {
|
|
9475
|
+
return match("px", tokens.pixelValue, 1) || match("em", tokens.emValue, 1);
|
|
9476
|
+
}
|
|
9477
|
+
function match(type, pattern, captureIndex) {
|
|
9478
|
+
const captures = scan(pattern);
|
|
9479
|
+
if (captures) return {
|
|
9480
|
+
type: type,
|
|
9481
|
+
value: captures[captureIndex]
|
|
9482
|
+
};
|
|
9483
|
+
}
|
|
9484
|
+
function scan(regexp) {
|
|
9485
|
+
const blankCaptures = /^[\n\r\t\s]+/.exec(input);
|
|
9486
|
+
blankCaptures && consume(blankCaptures[0].length);
|
|
9487
|
+
const captures = regexp.exec(input);
|
|
9488
|
+
return captures && consume(captures[0].length), captures;
|
|
9489
|
+
}
|
|
9490
|
+
function consume(size) {
|
|
9491
|
+
input = input.substr(size);
|
|
9492
|
+
}
|
|
9493
|
+
return function (code) {
|
|
9494
|
+
return input = code.toString(), getAST();
|
|
9495
|
+
};
|
|
9496
|
+
}();
|
|
9497
|
+
class GradientParser {
|
|
9498
|
+
static IsGradient(c) {
|
|
9499
|
+
return !("string" == typeof c && !c.includes("gradient"));
|
|
9500
|
+
}
|
|
9501
|
+
static IsGradientStr(c) {
|
|
9502
|
+
return "string" == typeof c && c.includes("gradient");
|
|
9503
|
+
}
|
|
9504
|
+
static Parse(c) {
|
|
9505
|
+
if (GradientParser.IsGradientStr(c)) try {
|
|
9506
|
+
const datum = parse(c)[0];
|
|
9507
|
+
if (datum) {
|
|
9508
|
+
if ("linear" === datum.type) return GradientParser.ParseLinear(datum);
|
|
9509
|
+
if ("radial" === datum.type) return GradientParser.ParseRadial(datum);
|
|
9510
|
+
if ("conic" === datum.type) return GradientParser.ParseConic(datum);
|
|
9511
|
+
}
|
|
9512
|
+
} catch (err) {
|
|
9513
|
+
return c;
|
|
9514
|
+
}
|
|
9515
|
+
return c;
|
|
9516
|
+
}
|
|
9517
|
+
static ParseConic(datum) {
|
|
9518
|
+
const {
|
|
9519
|
+
orientation: orientation,
|
|
9520
|
+
colorStops = []
|
|
9521
|
+
} = datum,
|
|
9522
|
+
halfPi = pi$1 / 2,
|
|
9523
|
+
sa = parseFloat(orientation.value) / 180 * pi$1 - halfPi;
|
|
9524
|
+
return {
|
|
9525
|
+
gradient: "conical",
|
|
9526
|
+
x: .5,
|
|
9527
|
+
y: .5,
|
|
9528
|
+
startAngle: sa,
|
|
9529
|
+
endAngle: sa + pi2,
|
|
9530
|
+
stops: colorStops.map(item => ({
|
|
9531
|
+
color: item.value,
|
|
9532
|
+
offset: parseFloat(item.length.value) / 100
|
|
9533
|
+
}))
|
|
9534
|
+
};
|
|
9535
|
+
}
|
|
9536
|
+
static ParseRadial(datum) {
|
|
9537
|
+
const {
|
|
9538
|
+
colorStops = []
|
|
9539
|
+
} = datum;
|
|
9540
|
+
return {
|
|
9541
|
+
gradient: "radial",
|
|
9542
|
+
x0: .5,
|
|
9543
|
+
y0: .5,
|
|
9544
|
+
x1: .5,
|
|
9545
|
+
y1: .5,
|
|
9546
|
+
r0: 0,
|
|
9547
|
+
r1: 1,
|
|
9548
|
+
stops: colorStops.map(item => ({
|
|
9549
|
+
color: item.value,
|
|
9550
|
+
offset: parseFloat(item.length.value) / 100
|
|
9551
|
+
}))
|
|
9552
|
+
};
|
|
9553
|
+
}
|
|
9554
|
+
static ParseLinear(datum) {
|
|
9555
|
+
const {
|
|
9556
|
+
orientation: orientation,
|
|
9557
|
+
colorStops = []
|
|
9558
|
+
} = datum,
|
|
9559
|
+
halfPi = pi$1 / 2;
|
|
9560
|
+
let angle = "angular" === orientation.type ? parseFloat(orientation.value) / 180 * pi$1 : 0;
|
|
9561
|
+
for (; angle < 0;) angle += pi2;
|
|
9562
|
+
for (; angle >= pi2;) angle -= pi2;
|
|
9563
|
+
let x0 = 0,
|
|
9564
|
+
y0 = 0,
|
|
9565
|
+
x1 = 0,
|
|
9566
|
+
y1 = 0;
|
|
9567
|
+
return angle < halfPi ? (x0 = 0, y0 = 1, x1 = Math.sin(angle), y1 = y0 - Math.cos(angle)) : angle < pi$1 ? (x0 = 0, y0 = 0, x1 = Math.cos(angle - halfPi), y1 = Math.sin(angle - halfPi)) : angle < pi$1 + halfPi ? (x0 = 1, y0 = 0, x1 = x0 - Math.sin(angle - pi$1), y1 = Math.cos(angle - pi$1)) : (x0 = 1, x1 = x0 - Math.cos(angle - halfPi - pi$1), y1 -= Math.sin(angle - halfPi - pi$1)), {
|
|
9568
|
+
gradient: "linear",
|
|
9569
|
+
x0: x0,
|
|
9570
|
+
y0: y0,
|
|
9571
|
+
x1: x1,
|
|
9572
|
+
y1: y1,
|
|
9573
|
+
stops: colorStops.map(item => ({
|
|
9574
|
+
color: item.value,
|
|
9575
|
+
offset: parseFloat(item.length.value) / 100
|
|
9576
|
+
}))
|
|
9577
|
+
};
|
|
9578
|
+
}
|
|
9579
|
+
}
|
|
9580
|
+
|
|
9581
|
+
function getScaledStroke(context, width, dpr) {
|
|
9582
|
+
let strokeWidth = width;
|
|
9583
|
+
const {
|
|
9584
|
+
a: a,
|
|
9585
|
+
b: b,
|
|
9586
|
+
c: c,
|
|
9587
|
+
d: d
|
|
9588
|
+
} = context.currentMatrix,
|
|
9589
|
+
scaleX = Math.sign(a) * Math.sqrt(a * a + b * b),
|
|
9590
|
+
scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);
|
|
9591
|
+
return scaleX + scaleY === 0 ? 0 : (strokeWidth = strokeWidth / Math.abs(scaleX + scaleY) * 2 * dpr, strokeWidth);
|
|
9592
|
+
}
|
|
9593
|
+
function createColor(context, c, params) {
|
|
9594
|
+
let offsetX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
9595
|
+
let offsetY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
9596
|
+
if (!c || !0 === c) return "black";
|
|
9597
|
+
let result, color;
|
|
9598
|
+
if (isArray$1(c)) for (let i = 0; i < c.length && (color = c[i], !color); i++);else color = c;
|
|
9599
|
+
if (color = GradientParser.Parse(color), "string" == typeof color) return color;
|
|
9600
|
+
if (params.AABBBounds && (!params.attribute || 0 !== params.attribute.scaleX || 0 !== params.attribute.scaleY)) {
|
|
9601
|
+
const bounds = params.AABBBounds;
|
|
9602
|
+
let w = bounds.x2 - bounds.x1,
|
|
9603
|
+
h = bounds.y2 - bounds.y1,
|
|
9604
|
+
x = bounds.x1 - offsetX,
|
|
9605
|
+
y = bounds.y1 - offsetY;
|
|
9606
|
+
if (params.attribute) {
|
|
9607
|
+
const {
|
|
9608
|
+
scaleX = 1,
|
|
9609
|
+
scaleY = 1
|
|
9610
|
+
} = params.attribute;
|
|
9611
|
+
w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY;
|
|
9612
|
+
}
|
|
9613
|
+
"linear" === color.gradient ? result = createLinearGradient(context, color, x, y, w, h) : "conical" === color.gradient ? result = createConicGradient(context, color, x, y, w, h) : "radial" === color.gradient && (result = createRadialGradient(context, color, x, y, w, h));
|
|
9614
|
+
}
|
|
9615
|
+
return result || "orange";
|
|
9616
|
+
}
|
|
9617
|
+
function createLinearGradient(context, color, x, y, w, h) {
|
|
9618
|
+
var _a, _b, _c, _d;
|
|
9619
|
+
const canvasGradient = context.createLinearGradient(x + (null !== (_a = color.x0) && void 0 !== _a ? _a : 0) * w, y + (null !== (_b = color.y0) && void 0 !== _b ? _b : 0) * h, x + (null !== (_c = color.x1) && void 0 !== _c ? _c : 1) * w, y + (null !== (_d = color.y1) && void 0 !== _d ? _d : 0) * h);
|
|
9620
|
+
return color.stops.forEach(stop => {
|
|
9621
|
+
canvasGradient.addColorStop(stop.offset, stop.color);
|
|
9622
|
+
}), canvasGradient;
|
|
9623
|
+
}
|
|
9624
|
+
function createRadialGradient(context, color, x, y, w, h) {
|
|
9625
|
+
var _a, _b, _c, _d, _e, _f;
|
|
9626
|
+
const canvasGradient = context.createRadialGradient(x + (null !== (_a = color.x0) && void 0 !== _a ? _a : .5) * w, y + (null !== (_b = color.y0) && void 0 !== _b ? _b : .5) * h, Math.max(w, h) * (null !== (_c = color.r0) && void 0 !== _c ? _c : 0), x + (null !== (_d = color.x1) && void 0 !== _d ? _d : .5) * w, y + (null !== (_e = color.y1) && void 0 !== _e ? _e : .5) * h, Math.max(w, h) * (null !== (_f = color.r1) && void 0 !== _f ? _f : .5));
|
|
9627
|
+
return color.stops.forEach(stop => {
|
|
9628
|
+
canvasGradient.addColorStop(stop.offset, stop.color);
|
|
9629
|
+
}), canvasGradient;
|
|
9630
|
+
}
|
|
9631
|
+
function createConicGradient(context, color, x, y, w, h) {
|
|
9632
|
+
var _a, _b;
|
|
9633
|
+
const canvasGradient = context.createConicGradient(x + (null !== (_a = color.x) && void 0 !== _a ? _a : 0) * w, y + (null !== (_b = color.y) && void 0 !== _b ? _b : 0) * h, color.startAngle, color.endAngle);
|
|
9634
|
+
return color.stops.forEach(stop => {
|
|
9635
|
+
canvasGradient.addColorStop(stop.offset, stop.color);
|
|
9636
|
+
}), canvasGradient.GetPattern(w + x, h + y, undefined);
|
|
9637
|
+
}
|
|
9638
|
+
|
|
9353
9639
|
const DIRECTION_KEY = {
|
|
9354
9640
|
horizontal: {
|
|
9355
9641
|
width: "width",
|
|
@@ -9401,14 +9687,16 @@
|
|
|
9401
9687
|
fontFamily: character.fontFamily || "sans-serif"
|
|
9402
9688
|
});
|
|
9403
9689
|
};
|
|
9404
|
-
function applyFillStyle(ctx, character) {
|
|
9690
|
+
function applyFillStyle(ctx, character, b) {
|
|
9405
9691
|
const fillStyle = character && character.fill || defaultFormatting.fill;
|
|
9406
9692
|
if (!fillStyle) return void (ctx.globalAlpha = 0);
|
|
9407
9693
|
const {
|
|
9408
9694
|
fillOpacity = 1,
|
|
9409
9695
|
opacity = 1
|
|
9410
9696
|
} = character;
|
|
9411
|
-
ctx.globalAlpha = fillOpacity * opacity, ctx.fillStyle =
|
|
9697
|
+
ctx.globalAlpha = fillOpacity * opacity, ctx.fillStyle = b ? createColor(ctx, fillStyle, {
|
|
9698
|
+
AABBBounds: b
|
|
9699
|
+
}) : fillStyle, setTextStyle(ctx, character);
|
|
9412
9700
|
}
|
|
9413
9701
|
function applyStrokeStyle(ctx, character) {
|
|
9414
9702
|
const strokeStyle = character && character.stroke || defaultFormatting.stroke;
|
|
@@ -16060,292 +16348,6 @@
|
|
|
16060
16348
|
}
|
|
16061
16349
|
}
|
|
16062
16350
|
|
|
16063
|
-
const parse = function () {
|
|
16064
|
-
const tokens = {
|
|
16065
|
-
linearGradient: /^(linear\-gradient)/i,
|
|
16066
|
-
radialGradient: /^(radial\-gradient)/i,
|
|
16067
|
-
conicGradient: /^(conic\-gradient)/i,
|
|
16068
|
-
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,
|
|
16069
|
-
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
|
16070
|
-
positionKeywords: /^(left|center|right|top|bottom)/i,
|
|
16071
|
-
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
|
|
16072
|
-
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
|
|
16073
|
-
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
|
|
16074
|
-
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
|
16075
|
-
fromAngleValue: /^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
|
16076
|
-
startCall: /^\(/,
|
|
16077
|
-
endCall: /^\)/,
|
|
16078
|
-
comma: /^,/,
|
|
16079
|
-
hexColor: /(^\#[0-9a-fA-F]+)/,
|
|
16080
|
-
literalColor: /^([a-zA-Z]+)/,
|
|
16081
|
-
rgbColor: /^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,
|
|
16082
|
-
rgbaColor: /^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,
|
|
16083
|
-
number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
|
|
16084
|
-
};
|
|
16085
|
-
let input = "";
|
|
16086
|
-
function error(msg) {
|
|
16087
|
-
const err = new Error(input + ": " + msg);
|
|
16088
|
-
throw err.source = input, err;
|
|
16089
|
-
}
|
|
16090
|
-
function getAST() {
|
|
16091
|
-
const ast = matchListing(matchDefinition);
|
|
16092
|
-
return input.length > 0 && error("Invalid input not EOF"), ast;
|
|
16093
|
-
}
|
|
16094
|
-
function matchDefinition() {
|
|
16095
|
-
return matchGradient("linear", tokens.linearGradient, matchLinearOrientation) || matchGradient("radial", tokens.radialGradient, matchListRadialOrientations) || matchGradient("conic", tokens.conicGradient, matchConicalOrientation);
|
|
16096
|
-
}
|
|
16097
|
-
function matchGradient(gradientType, pattern, orientationMatcher) {
|
|
16098
|
-
return function (pattern, callback) {
|
|
16099
|
-
const captures = scan(pattern);
|
|
16100
|
-
if (captures) {
|
|
16101
|
-
scan(tokens.startCall) || error("Missing (");
|
|
16102
|
-
const result = callback(captures);
|
|
16103
|
-
return scan(tokens.endCall) || error("Missing )"), result;
|
|
16104
|
-
}
|
|
16105
|
-
}(pattern, function (captures) {
|
|
16106
|
-
const orientation = orientationMatcher();
|
|
16107
|
-
return orientation && (scan(tokens.comma) || error("Missing comma before color stops")), {
|
|
16108
|
-
type: gradientType,
|
|
16109
|
-
orientation: orientation,
|
|
16110
|
-
colorStops: matchListing(matchColorStop)
|
|
16111
|
-
};
|
|
16112
|
-
});
|
|
16113
|
-
}
|
|
16114
|
-
function matchLinearOrientation() {
|
|
16115
|
-
return match("directional", tokens.sideOrCorner, 1) || match("angular", tokens.angleValue, 1);
|
|
16116
|
-
}
|
|
16117
|
-
function matchConicalOrientation() {
|
|
16118
|
-
return match("angular", tokens.fromAngleValue, 1);
|
|
16119
|
-
}
|
|
16120
|
-
function matchListRadialOrientations() {
|
|
16121
|
-
let radialOrientations,
|
|
16122
|
-
lookaheadCache,
|
|
16123
|
-
radialOrientation = matchRadialOrientation();
|
|
16124
|
-
return radialOrientation && (radialOrientations = [], radialOrientations.push(radialOrientation), lookaheadCache = input, scan(tokens.comma) && (radialOrientation = matchRadialOrientation(), radialOrientation ? radialOrientations.push(radialOrientation) : input = lookaheadCache)), radialOrientations;
|
|
16125
|
-
}
|
|
16126
|
-
function matchRadialOrientation() {
|
|
16127
|
-
let radialType = function () {
|
|
16128
|
-
const circle = match("shape", /^(circle)/i, 0);
|
|
16129
|
-
circle && (circle.style = matchLength() || matchExtentKeyword());
|
|
16130
|
-
return circle;
|
|
16131
|
-
}() || function () {
|
|
16132
|
-
const ellipse = match("shape", /^(ellipse)/i, 0);
|
|
16133
|
-
ellipse && (ellipse.style = matchDistance() || matchExtentKeyword());
|
|
16134
|
-
return ellipse;
|
|
16135
|
-
}();
|
|
16136
|
-
if (radialType) radialType.at = matchAtPosition();else {
|
|
16137
|
-
const extent = matchExtentKeyword();
|
|
16138
|
-
if (extent) {
|
|
16139
|
-
radialType = extent;
|
|
16140
|
-
const positionAt = matchAtPosition();
|
|
16141
|
-
positionAt && (radialType.at = positionAt);
|
|
16142
|
-
} else {
|
|
16143
|
-
const defaultPosition = matchPositioning();
|
|
16144
|
-
defaultPosition && (radialType = {
|
|
16145
|
-
type: "default-radial",
|
|
16146
|
-
at: defaultPosition
|
|
16147
|
-
});
|
|
16148
|
-
}
|
|
16149
|
-
}
|
|
16150
|
-
return radialType;
|
|
16151
|
-
}
|
|
16152
|
-
function matchExtentKeyword() {
|
|
16153
|
-
return match("extent-keyword", tokens.extentKeywords, 1);
|
|
16154
|
-
}
|
|
16155
|
-
function matchAtPosition() {
|
|
16156
|
-
if (match("position", /^at/, 0)) {
|
|
16157
|
-
const positioning = matchPositioning();
|
|
16158
|
-
return positioning || error("Missing positioning value"), positioning;
|
|
16159
|
-
}
|
|
16160
|
-
}
|
|
16161
|
-
function matchPositioning() {
|
|
16162
|
-
const location = {
|
|
16163
|
-
x: matchDistance(),
|
|
16164
|
-
y: matchDistance()
|
|
16165
|
-
};
|
|
16166
|
-
if (location.x || location.y) return {
|
|
16167
|
-
type: "position",
|
|
16168
|
-
value: location
|
|
16169
|
-
};
|
|
16170
|
-
}
|
|
16171
|
-
function matchListing(matcher) {
|
|
16172
|
-
let captures = matcher();
|
|
16173
|
-
const result = [];
|
|
16174
|
-
if (captures) for (result.push(captures); scan(tokens.comma);) captures = matcher(), captures ? result.push(captures) : error("One extra comma");
|
|
16175
|
-
return result;
|
|
16176
|
-
}
|
|
16177
|
-
function matchColorStop() {
|
|
16178
|
-
const color = match("hex", tokens.hexColor, 1) || match("rgba", tokens.rgbaColor, 1) || match("rgb", tokens.rgbColor, 1) || match("literal", tokens.literalColor, 0);
|
|
16179
|
-
return color || error("Expected color definition"), color.length = matchDistance(), color;
|
|
16180
|
-
}
|
|
16181
|
-
function matchDistance() {
|
|
16182
|
-
return match("%", tokens.percentageValue, 1) || match("position-keyword", tokens.positionKeywords, 1) || matchLength();
|
|
16183
|
-
}
|
|
16184
|
-
function matchLength() {
|
|
16185
|
-
return match("px", tokens.pixelValue, 1) || match("em", tokens.emValue, 1);
|
|
16186
|
-
}
|
|
16187
|
-
function match(type, pattern, captureIndex) {
|
|
16188
|
-
const captures = scan(pattern);
|
|
16189
|
-
if (captures) return {
|
|
16190
|
-
type: type,
|
|
16191
|
-
value: captures[captureIndex]
|
|
16192
|
-
};
|
|
16193
|
-
}
|
|
16194
|
-
function scan(regexp) {
|
|
16195
|
-
const blankCaptures = /^[\n\r\t\s]+/.exec(input);
|
|
16196
|
-
blankCaptures && consume(blankCaptures[0].length);
|
|
16197
|
-
const captures = regexp.exec(input);
|
|
16198
|
-
return captures && consume(captures[0].length), captures;
|
|
16199
|
-
}
|
|
16200
|
-
function consume(size) {
|
|
16201
|
-
input = input.substr(size);
|
|
16202
|
-
}
|
|
16203
|
-
return function (code) {
|
|
16204
|
-
return input = code.toString(), getAST();
|
|
16205
|
-
};
|
|
16206
|
-
}();
|
|
16207
|
-
class GradientParser {
|
|
16208
|
-
static IsGradient(c) {
|
|
16209
|
-
return !("string" == typeof c && !c.includes("gradient"));
|
|
16210
|
-
}
|
|
16211
|
-
static IsGradientStr(c) {
|
|
16212
|
-
return "string" == typeof c && c.includes("gradient");
|
|
16213
|
-
}
|
|
16214
|
-
static Parse(c) {
|
|
16215
|
-
if (GradientParser.IsGradientStr(c)) try {
|
|
16216
|
-
const datum = parse(c)[0];
|
|
16217
|
-
if (datum) {
|
|
16218
|
-
if ("linear" === datum.type) return GradientParser.ParseLinear(datum);
|
|
16219
|
-
if ("radial" === datum.type) return GradientParser.ParseRadial(datum);
|
|
16220
|
-
if ("conic" === datum.type) return GradientParser.ParseConic(datum);
|
|
16221
|
-
}
|
|
16222
|
-
} catch (err) {
|
|
16223
|
-
return c;
|
|
16224
|
-
}
|
|
16225
|
-
return c;
|
|
16226
|
-
}
|
|
16227
|
-
static ParseConic(datum) {
|
|
16228
|
-
const {
|
|
16229
|
-
orientation: orientation,
|
|
16230
|
-
colorStops = []
|
|
16231
|
-
} = datum,
|
|
16232
|
-
halfPi = pi$1 / 2,
|
|
16233
|
-
sa = parseFloat(orientation.value) / 180 * pi$1 - halfPi;
|
|
16234
|
-
return {
|
|
16235
|
-
gradient: "conical",
|
|
16236
|
-
x: .5,
|
|
16237
|
-
y: .5,
|
|
16238
|
-
startAngle: sa,
|
|
16239
|
-
endAngle: sa + pi2,
|
|
16240
|
-
stops: colorStops.map(item => ({
|
|
16241
|
-
color: item.value,
|
|
16242
|
-
offset: parseFloat(item.length.value) / 100
|
|
16243
|
-
}))
|
|
16244
|
-
};
|
|
16245
|
-
}
|
|
16246
|
-
static ParseRadial(datum) {
|
|
16247
|
-
const {
|
|
16248
|
-
colorStops = []
|
|
16249
|
-
} = datum;
|
|
16250
|
-
return {
|
|
16251
|
-
gradient: "radial",
|
|
16252
|
-
x0: .5,
|
|
16253
|
-
y0: .5,
|
|
16254
|
-
x1: .5,
|
|
16255
|
-
y1: .5,
|
|
16256
|
-
r0: 0,
|
|
16257
|
-
r1: 1,
|
|
16258
|
-
stops: colorStops.map(item => ({
|
|
16259
|
-
color: item.value,
|
|
16260
|
-
offset: parseFloat(item.length.value) / 100
|
|
16261
|
-
}))
|
|
16262
|
-
};
|
|
16263
|
-
}
|
|
16264
|
-
static ParseLinear(datum) {
|
|
16265
|
-
const {
|
|
16266
|
-
orientation: orientation,
|
|
16267
|
-
colorStops = []
|
|
16268
|
-
} = datum,
|
|
16269
|
-
halfPi = pi$1 / 2;
|
|
16270
|
-
let angle = "angular" === orientation.type ? parseFloat(orientation.value) / 180 * pi$1 : 0;
|
|
16271
|
-
for (; angle < 0;) angle += pi2;
|
|
16272
|
-
for (; angle > pi2;) angle -= pi2;
|
|
16273
|
-
let x0 = 0,
|
|
16274
|
-
y0 = 0,
|
|
16275
|
-
x1 = 0,
|
|
16276
|
-
y1 = 0;
|
|
16277
|
-
return angle < halfPi ? (x0 = 0, y0 = 1, x1 = Math.sin(angle), y1 = Math.cos(angle)) : angle < pi$1 ? (x0 = 0, y0 = 0, x1 = Math.cos(angle - halfPi), y1 = Math.sin(angle - halfPi)) : angle < pi$1 + halfPi ? (x0 = 1, y0 = 0, x1 = x0 - Math.sin(angle - pi$1), y1 = Math.cos(angle - pi$1)) : (x0 = 1, x1 = x0 - Math.cos(angle - halfPi - pi$1), y1 -= Math.sin(angle - halfPi - pi$1)), {
|
|
16278
|
-
gradient: "linear",
|
|
16279
|
-
x0: x0,
|
|
16280
|
-
y0: y0,
|
|
16281
|
-
x1: x1,
|
|
16282
|
-
y1: y1,
|
|
16283
|
-
stops: colorStops.map(item => ({
|
|
16284
|
-
color: item.value,
|
|
16285
|
-
offset: parseFloat(item.length.value) / 100
|
|
16286
|
-
}))
|
|
16287
|
-
};
|
|
16288
|
-
}
|
|
16289
|
-
}
|
|
16290
|
-
|
|
16291
|
-
function getScaledStroke(context, width, dpr) {
|
|
16292
|
-
let strokeWidth = width;
|
|
16293
|
-
const {
|
|
16294
|
-
a: a,
|
|
16295
|
-
b: b,
|
|
16296
|
-
c: c,
|
|
16297
|
-
d: d
|
|
16298
|
-
} = context.currentMatrix,
|
|
16299
|
-
scaleX = Math.sign(a) * Math.sqrt(a * a + b * b),
|
|
16300
|
-
scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);
|
|
16301
|
-
return scaleX + scaleY === 0 ? 0 : (strokeWidth = strokeWidth / Math.abs(scaleX + scaleY) * 2 * dpr, strokeWidth);
|
|
16302
|
-
}
|
|
16303
|
-
function createColor(context, c, params) {
|
|
16304
|
-
let offsetX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
16305
|
-
let offsetY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
16306
|
-
if (!c || !0 === c) return "black";
|
|
16307
|
-
let result, color;
|
|
16308
|
-
if (isArray$1(c)) for (let i = 0; i < c.length && (color = c[i], !color); i++);else color = c;
|
|
16309
|
-
if (color = GradientParser.Parse(color), "string" == typeof color) return color;
|
|
16310
|
-
if (params.AABBBounds && (!params.attribute || 0 !== params.attribute.scaleX || 0 !== params.attribute.scaleY)) {
|
|
16311
|
-
const bounds = params.AABBBounds;
|
|
16312
|
-
let w = bounds.x2 - bounds.x1,
|
|
16313
|
-
h = bounds.y2 - bounds.y1,
|
|
16314
|
-
x = bounds.x1 - offsetX,
|
|
16315
|
-
y = bounds.y1 - offsetY;
|
|
16316
|
-
if (params.attribute) {
|
|
16317
|
-
const {
|
|
16318
|
-
scaleX = 1,
|
|
16319
|
-
scaleY = 1
|
|
16320
|
-
} = params.attribute;
|
|
16321
|
-
w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY;
|
|
16322
|
-
}
|
|
16323
|
-
"linear" === color.gradient ? result = createLinearGradient(context, color, x, y, w, h) : "conical" === color.gradient ? result = createConicGradient(context, color, x, y, w, h) : "radial" === color.gradient && (result = createRadialGradient(context, color, x, y, w, h));
|
|
16324
|
-
}
|
|
16325
|
-
return result || "orange";
|
|
16326
|
-
}
|
|
16327
|
-
function createLinearGradient(context, color, x, y, w, h) {
|
|
16328
|
-
var _a, _b, _c, _d;
|
|
16329
|
-
const canvasGradient = context.createLinearGradient(x + (null !== (_a = color.x0) && void 0 !== _a ? _a : 0) * w, y + (null !== (_b = color.y0) && void 0 !== _b ? _b : 0) * h, x + (null !== (_c = color.x1) && void 0 !== _c ? _c : 1) * w, y + (null !== (_d = color.y1) && void 0 !== _d ? _d : 0) * h);
|
|
16330
|
-
return color.stops.forEach(stop => {
|
|
16331
|
-
canvasGradient.addColorStop(stop.offset, stop.color);
|
|
16332
|
-
}), canvasGradient;
|
|
16333
|
-
}
|
|
16334
|
-
function createRadialGradient(context, color, x, y, w, h) {
|
|
16335
|
-
var _a, _b, _c, _d, _e, _f;
|
|
16336
|
-
const canvasGradient = context.createRadialGradient(x + (null !== (_a = color.x0) && void 0 !== _a ? _a : .5) * w, y + (null !== (_b = color.y0) && void 0 !== _b ? _b : .5) * h, Math.max(w, h) * (null !== (_c = color.r0) && void 0 !== _c ? _c : 0), x + (null !== (_d = color.x1) && void 0 !== _d ? _d : .5) * w, y + (null !== (_e = color.y1) && void 0 !== _e ? _e : .5) * h, Math.max(w, h) * (null !== (_f = color.r1) && void 0 !== _f ? _f : .5));
|
|
16337
|
-
return color.stops.forEach(stop => {
|
|
16338
|
-
canvasGradient.addColorStop(stop.offset, stop.color);
|
|
16339
|
-
}), canvasGradient;
|
|
16340
|
-
}
|
|
16341
|
-
function createConicGradient(context, color, x, y, w, h) {
|
|
16342
|
-
var _a, _b;
|
|
16343
|
-
const canvasGradient = context.createConicGradient(x + (null !== (_a = color.x) && void 0 !== _a ? _a : 0) * w, y + (null !== (_b = color.y) && void 0 !== _b ? _b : 0) * h, color.startAngle, color.endAngle);
|
|
16344
|
-
return color.stops.forEach(stop => {
|
|
16345
|
-
canvasGradient.addColorStop(stop.offset, stop.color);
|
|
16346
|
-
}), canvasGradient.GetPattern(w + x, h + y, undefined);
|
|
16347
|
-
}
|
|
16348
|
-
|
|
16349
16351
|
var __decorate$1t = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
16350
16352
|
var d,
|
|
16351
16353
|
c = arguments.length,
|
|
@@ -18748,7 +18750,10 @@
|
|
|
18748
18750
|
const {
|
|
18749
18751
|
context: context
|
|
18750
18752
|
} = drawContext;
|
|
18751
|
-
|
|
18753
|
+
context.highPerformanceSave();
|
|
18754
|
+
const t1 = graphic.parent.globalTransMatrix,
|
|
18755
|
+
t2 = graphic.stage.window.getViewBoxTransform().clone().multiply(t1.a, t1.b, t1.c, t1.d, t1.e, t1.f);
|
|
18756
|
+
if (graphic.parent && context.setTransformFromMatrix(t2, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
|
|
18752
18757
|
tempDirtyBounds.copy(drawContribution.dirtyBounds), tempBackupDirtyBounds.copy(drawContribution.backupDirtyBounds);
|
|
18753
18758
|
const m = graphic.globalTransMatrix.getInverse();
|
|
18754
18759
|
drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m), drawContribution.backupDirtyBounds.copy(drawContribution.dirtyBounds);
|
|
@@ -19636,6 +19641,9 @@
|
|
|
19636
19641
|
bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
|
|
19637
19642
|
} else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
|
|
19638
19643
|
}
|
|
19644
|
+
parseSize(size) {
|
|
19645
|
+
return isNumber$1(size) ? size : Math.min(size[0], size[1]);
|
|
19646
|
+
}
|
|
19639
19647
|
}
|
|
19640
19648
|
|
|
19641
19649
|
function circle$1(ctx, r, x, y, z) {
|
|
@@ -19646,13 +19654,13 @@
|
|
|
19646
19654
|
super(...arguments), this.type = "circle", this.pathStr = "M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0";
|
|
19647
19655
|
}
|
|
19648
19656
|
draw(ctx, size, x, y, z) {
|
|
19649
|
-
return circle$1(ctx, size / 2, x, y, z);
|
|
19657
|
+
return circle$1(ctx, this.parseSize(size) / 2, x, y, z);
|
|
19650
19658
|
}
|
|
19651
19659
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
19652
|
-
return circle$1(ctx, size / 2 + offset, x, y, z);
|
|
19660
|
+
return circle$1(ctx, this.parseSize(size) / 2 + offset, x, y, z);
|
|
19653
19661
|
}
|
|
19654
19662
|
drawToSvgPath(size, x, y, z) {
|
|
19655
|
-
const r = size / 2;
|
|
19663
|
+
const r = this.parseSize(size) / 2;
|
|
19656
19664
|
return `M ${x - r}, ${y} a ${r},${r} 0 1,0 ${2 * r},0 a ${r},${r} 0 1,0 -${2 * r},0`;
|
|
19657
19665
|
}
|
|
19658
19666
|
}
|
|
@@ -19669,10 +19677,10 @@
|
|
|
19669
19677
|
super(...arguments), this.type = "cross", this.pathStr = "M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z";
|
|
19670
19678
|
}
|
|
19671
19679
|
draw(ctx, size, x, y, z) {
|
|
19672
|
-
return cross(ctx, size / 6, x, y, z);
|
|
19680
|
+
return cross(ctx, this.parseSize(size) / 6, x, y, z);
|
|
19673
19681
|
}
|
|
19674
19682
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
19675
|
-
return crossOffset(ctx, size / 6, x, y, offset, z);
|
|
19683
|
+
return crossOffset(ctx, this.parseSize(size) / 6, x, y, offset, z);
|
|
19676
19684
|
}
|
|
19677
19685
|
}
|
|
19678
19686
|
var cross$1 = new CrossSymbol();
|
|
@@ -19685,13 +19693,13 @@
|
|
|
19685
19693
|
super(...arguments), this.type = "diamond", this.pathStr = "M-0.5,0L0,-0.5L0.5,0L0,0.5Z";
|
|
19686
19694
|
}
|
|
19687
19695
|
draw(ctx, size, x, y, z) {
|
|
19688
|
-
return diamond$1(ctx, size / 2, x, y, z);
|
|
19696
|
+
return diamond$1(ctx, this.parseSize(size) / 2, x, y, z);
|
|
19689
19697
|
}
|
|
19690
19698
|
drawFitDir(ctx, size, x, y, z) {
|
|
19691
|
-
return diamond$1(ctx, size / 2, x, y, z);
|
|
19699
|
+
return diamond$1(ctx, this.parseSize(size) / 2, x, y, z);
|
|
19692
19700
|
}
|
|
19693
19701
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
19694
|
-
return diamond$1(ctx, size / 2 + offset, x, y, z);
|
|
19702
|
+
return diamond$1(ctx, this.parseSize(size) / 2 + offset, x, y, z);
|
|
19695
19703
|
}
|
|
19696
19704
|
}
|
|
19697
19705
|
var diamond$2 = new DiamondSymbol();
|
|
@@ -19705,10 +19713,10 @@
|
|
|
19705
19713
|
super(...arguments), this.type = "square", this.pathStr = "M-0.5,-0.5h1v1h-1Z";
|
|
19706
19714
|
}
|
|
19707
19715
|
draw(ctx, size, x, y) {
|
|
19708
|
-
return square$2(ctx, size / 2, x, y);
|
|
19716
|
+
return square$2(ctx, this.parseSize(size) / 2, x, y);
|
|
19709
19717
|
}
|
|
19710
19718
|
drawOffset(ctx, size, x, y, offset) {
|
|
19711
|
-
return square$2(ctx, size / 2 + offset, x, y);
|
|
19719
|
+
return square$2(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
19712
19720
|
}
|
|
19713
19721
|
}
|
|
19714
19722
|
var square$3 = new SquareSymbol();
|
|
@@ -19722,10 +19730,10 @@
|
|
|
19722
19730
|
super(...arguments), this.type = "triangleUp", this.pathStr = "M0.5,0.5 L-0.5,0.5 L0,-0.5 Z";
|
|
19723
19731
|
}
|
|
19724
19732
|
draw(ctx, size, x, y) {
|
|
19725
|
-
return trianglUpOffset(ctx, size / 2, x, y);
|
|
19733
|
+
return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
19726
19734
|
}
|
|
19727
19735
|
drawOffset(ctx, size, x, y, offset) {
|
|
19728
|
-
return trianglUpOffset(ctx, size / 2, x, y, offset);
|
|
19736
|
+
return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
19729
19737
|
}
|
|
19730
19738
|
}
|
|
19731
19739
|
var triangleUp = new TriangleUpSymbol();
|
|
@@ -19757,10 +19765,10 @@
|
|
|
19757
19765
|
super(...arguments), this.type = "star", this.pathStr = "M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z";
|
|
19758
19766
|
}
|
|
19759
19767
|
draw(ctx, size, transX, transY) {
|
|
19760
|
-
return star$1(ctx, size / 2, transX, transY);
|
|
19768
|
+
return star$1(ctx, this.parseSize(size) / 2, transX, transY);
|
|
19761
19769
|
}
|
|
19762
19770
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
19763
|
-
return star$1(ctx, size / 2 + offset, transX, transY);
|
|
19771
|
+
return star$1(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
19764
19772
|
}
|
|
19765
19773
|
}
|
|
19766
19774
|
var star$2 = new StarSymbol();
|
|
@@ -19778,10 +19786,10 @@
|
|
|
19778
19786
|
super(...arguments), this.type = "arrow", this.pathStr = "M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z";
|
|
19779
19787
|
}
|
|
19780
19788
|
draw(ctx, size, transX, transY) {
|
|
19781
|
-
return arrow(ctx, size / 2, transX, transY);
|
|
19789
|
+
return arrow(ctx, this.parseSize(size) / 2, transX, transY);
|
|
19782
19790
|
}
|
|
19783
19791
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
19784
|
-
return arrow(ctx, size / 2 + offset, transX, transY);
|
|
19792
|
+
return arrow(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
19785
19793
|
}
|
|
19786
19794
|
}
|
|
19787
19795
|
var arrow$1 = new ArrowSymbol();
|
|
@@ -19795,10 +19803,10 @@
|
|
|
19795
19803
|
super(...arguments), this.type = "wedge", this.pathStr = "M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z";
|
|
19796
19804
|
}
|
|
19797
19805
|
draw(ctx, size, transX, transY) {
|
|
19798
|
-
return wedge(ctx, size / 2, transX, transY);
|
|
19806
|
+
return wedge(ctx, this.parseSize(size) / 2, transX, transY);
|
|
19799
19807
|
}
|
|
19800
19808
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
19801
|
-
return wedge(ctx, size / 2 + offset, transX, transY);
|
|
19809
|
+
return wedge(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
19802
19810
|
}
|
|
19803
19811
|
}
|
|
19804
19812
|
var wedge$1 = new WedgeSymbol();
|
|
@@ -19811,10 +19819,10 @@
|
|
|
19811
19819
|
super(...arguments), this.type = "stroke", this.pathStr = "";
|
|
19812
19820
|
}
|
|
19813
19821
|
draw(ctx, size, transX, transY) {
|
|
19814
|
-
return stroke(ctx, size / 2, transX, transY);
|
|
19822
|
+
return stroke(ctx, this.parseSize(size) / 2, transX, transY);
|
|
19815
19823
|
}
|
|
19816
19824
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
19817
|
-
return stroke(ctx, size / 2 + offset, transX, transY);
|
|
19825
|
+
return stroke(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
19818
19826
|
}
|
|
19819
19827
|
}
|
|
19820
19828
|
var stroke$1 = new StrokeSymbol();
|
|
@@ -19836,10 +19844,10 @@
|
|
|
19836
19844
|
super(...arguments), this.type = "wye", this.pathStr = "M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z";
|
|
19837
19845
|
}
|
|
19838
19846
|
draw(ctx, size, transX, transY) {
|
|
19839
|
-
return wye(ctx, size / 2, transX, transY);
|
|
19847
|
+
return wye(ctx, this.parseSize(size) / 2, transX, transY);
|
|
19840
19848
|
}
|
|
19841
19849
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
19842
|
-
return wye(ctx, size / 2 + offset, transX, transY);
|
|
19850
|
+
return wye(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
19843
19851
|
}
|
|
19844
19852
|
}
|
|
19845
19853
|
var wye$1 = new WyeSymbol();
|
|
@@ -19852,10 +19860,10 @@
|
|
|
19852
19860
|
super(...arguments), this.type = "triangleLeft", this.pathStr = "M-0.5,0 L0.5,0.5 L0.5,-0.5 Z";
|
|
19853
19861
|
}
|
|
19854
19862
|
draw(ctx, size, x, y) {
|
|
19855
|
-
return trianglLeftOffset(ctx, size / 2, x, y, 0);
|
|
19863
|
+
return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, 0);
|
|
19856
19864
|
}
|
|
19857
19865
|
drawOffset(ctx, size, x, y, offset) {
|
|
19858
|
-
return trianglLeftOffset(ctx, size / 2, x, y, offset);
|
|
19866
|
+
return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
19859
19867
|
}
|
|
19860
19868
|
}
|
|
19861
19869
|
var triangleLeft = new TriangleLeftSymbol();
|
|
@@ -19869,10 +19877,10 @@
|
|
|
19869
19877
|
super(...arguments), this.type = "triangleRight", this.pathStr = "M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z";
|
|
19870
19878
|
}
|
|
19871
19879
|
draw(ctx, size, x, y) {
|
|
19872
|
-
return trianglRightOffset(ctx, size / 2, x, y);
|
|
19880
|
+
return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
19873
19881
|
}
|
|
19874
19882
|
drawOffset(ctx, size, x, y, offset) {
|
|
19875
|
-
return trianglRightOffset(ctx, size / 2, x, y, offset);
|
|
19883
|
+
return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
19876
19884
|
}
|
|
19877
19885
|
}
|
|
19878
19886
|
var triangleRight = new TriangleRightSymbol();
|
|
@@ -19886,10 +19894,10 @@
|
|
|
19886
19894
|
super(...arguments), this.type = "triangleDown", this.pathStr = "M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z";
|
|
19887
19895
|
}
|
|
19888
19896
|
draw(ctx, size, x, y) {
|
|
19889
|
-
return trianglDownOffset(ctx, size / 2, x, y);
|
|
19897
|
+
return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
19890
19898
|
}
|
|
19891
19899
|
drawOffset(ctx, size, x, y, offset) {
|
|
19892
|
-
return trianglDownOffset(ctx, size / 2, x, y, offset);
|
|
19900
|
+
return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
19893
19901
|
}
|
|
19894
19902
|
}
|
|
19895
19903
|
var triangleDown = new TriangleDownSymbol();
|
|
@@ -19904,10 +19912,10 @@
|
|
|
19904
19912
|
super(...arguments), this.type = "thinTriangle", this.pathStr = "M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z";
|
|
19905
19913
|
}
|
|
19906
19914
|
draw(ctx, size, x, y) {
|
|
19907
|
-
return thinTriangle(ctx, size / 2 / sqrt3, x, y);
|
|
19915
|
+
return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3, x, y);
|
|
19908
19916
|
}
|
|
19909
19917
|
drawOffset(ctx, size, x, y, offset) {
|
|
19910
|
-
return thinTriangle(ctx, size / 2 / sqrt3 + offset, x, y);
|
|
19918
|
+
return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3 + offset, x, y);
|
|
19911
19919
|
}
|
|
19912
19920
|
}
|
|
19913
19921
|
var thinTriangle$1 = new ThinTriangleSymbol();
|
|
@@ -19921,10 +19929,10 @@
|
|
|
19921
19929
|
super(...arguments), this.type = "arrow2Left", this.pathStr = "M 0.25 -0.5 L -0.25 0 l 0.25 0.5";
|
|
19922
19930
|
}
|
|
19923
19931
|
draw(ctx, size, transX, transY) {
|
|
19924
|
-
return arrow2Left(ctx, size / 4, transX, transY);
|
|
19932
|
+
return arrow2Left(ctx, this.parseSize(size) / 4, transX, transY);
|
|
19925
19933
|
}
|
|
19926
19934
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
19927
|
-
return arrow2Left(ctx, size / 4 + offset, transX, transY);
|
|
19935
|
+
return arrow2Left(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
19928
19936
|
}
|
|
19929
19937
|
}
|
|
19930
19938
|
var arrow2Left$1 = new Arrow2LeftSymbol();
|
|
@@ -19938,10 +19946,10 @@
|
|
|
19938
19946
|
super(...arguments), this.type = "arrow2Right", this.pathStr = "M -0.25 -0.5 l 0.25 0 l -0.25 0.5";
|
|
19939
19947
|
}
|
|
19940
19948
|
draw(ctx, size, transX, transY) {
|
|
19941
|
-
return arrow2Right(ctx, size / 4, transX, transY);
|
|
19949
|
+
return arrow2Right(ctx, this.parseSize(size) / 4, transX, transY);
|
|
19942
19950
|
}
|
|
19943
19951
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
19944
|
-
return arrow2Right(ctx, size / 4 + offset, transX, transY);
|
|
19952
|
+
return arrow2Right(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
19945
19953
|
}
|
|
19946
19954
|
}
|
|
19947
19955
|
var arrow2Right$1 = new Arrow2RightSymbol();
|
|
@@ -19955,10 +19963,10 @@
|
|
|
19955
19963
|
super(...arguments), this.type = "arrow2Up", this.pathStr = "M -0.5 0.25 L 0 -0.25 l 0.5 0.25";
|
|
19956
19964
|
}
|
|
19957
19965
|
draw(ctx, size, transX, transY) {
|
|
19958
|
-
return arrow2Up(ctx, size / 4, transX, transY);
|
|
19966
|
+
return arrow2Up(ctx, this.parseSize(size) / 4, transX, transY);
|
|
19959
19967
|
}
|
|
19960
19968
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
19961
|
-
return arrow2Up(ctx, size / 4 + offset, transX, transY);
|
|
19969
|
+
return arrow2Up(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
19962
19970
|
}
|
|
19963
19971
|
}
|
|
19964
19972
|
var arrow2Up$1 = new Arrow2UpSymbol();
|
|
@@ -19972,10 +19980,10 @@
|
|
|
19972
19980
|
super(...arguments), this.type = "arrow2Down", this.pathStr = "M -0.5 -0.25 L 0 0.25 l 0.5 -0.25";
|
|
19973
19981
|
}
|
|
19974
19982
|
draw(ctx, size, transX, transY) {
|
|
19975
|
-
return arrow2Down(ctx, size / 4, transX, transY);
|
|
19983
|
+
return arrow2Down(ctx, this.parseSize(size) / 4, transX, transY);
|
|
19976
19984
|
}
|
|
19977
19985
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
19978
|
-
return arrow2Down(ctx, size / 4 + offset, transX, transY);
|
|
19986
|
+
return arrow2Down(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
19979
19987
|
}
|
|
19980
19988
|
}
|
|
19981
19989
|
var arrow2Down$1 = new Arrow2DownSymbol();
|
|
@@ -19988,13 +19996,13 @@
|
|
|
19988
19996
|
super(...arguments), this.type = "lineV", this.pathStr = "M0,-0.5L0,0.5";
|
|
19989
19997
|
}
|
|
19990
19998
|
draw(ctx, size, x, y, z) {
|
|
19991
|
-
return lineV(ctx, size / 2, x, y);
|
|
19999
|
+
return lineV(ctx, this.parseSize(size) / 2, x, y);
|
|
19992
20000
|
}
|
|
19993
20001
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
19994
|
-
return lineV(ctx, size / 2 + offset, x, y);
|
|
20002
|
+
return lineV(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
19995
20003
|
}
|
|
19996
20004
|
drawToSvgPath(size, x, y, z) {
|
|
19997
|
-
const r = size / 2;
|
|
20005
|
+
const r = this.parseSize(size) / 2;
|
|
19998
20006
|
return `M ${x}, ${y - r} L ${x},${y + r}`;
|
|
19999
20007
|
}
|
|
20000
20008
|
}
|
|
@@ -20008,13 +20016,13 @@
|
|
|
20008
20016
|
super(...arguments), this.type = "lineH", this.pathStr = "M-0.5,0L0.5,0";
|
|
20009
20017
|
}
|
|
20010
20018
|
draw(ctx, size, x, y, z) {
|
|
20011
|
-
return lineH(ctx, size / 2, x, y);
|
|
20019
|
+
return lineH(ctx, this.parseSize(size) / 2, x, y);
|
|
20012
20020
|
}
|
|
20013
20021
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
20014
|
-
return lineH(ctx, size / 2 + offset, x, y);
|
|
20022
|
+
return lineH(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
20015
20023
|
}
|
|
20016
20024
|
drawToSvgPath(size, x, y, z) {
|
|
20017
|
-
const r = size / 2;
|
|
20025
|
+
const r = this.parseSize(size) / 2;
|
|
20018
20026
|
return `M ${x - r}, ${y} L ${x + r},${y}`;
|
|
20019
20027
|
}
|
|
20020
20028
|
}
|
|
@@ -20028,13 +20036,13 @@
|
|
|
20028
20036
|
super(...arguments), this.type = "close", this.pathStr = "M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5";
|
|
20029
20037
|
}
|
|
20030
20038
|
draw(ctx, size, x, y, z) {
|
|
20031
|
-
return close(ctx, size / 2, x, y);
|
|
20039
|
+
return close(ctx, this.parseSize(size) / 2, x, y);
|
|
20032
20040
|
}
|
|
20033
20041
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
20034
|
-
return close(ctx, size / 2 + offset, x, y);
|
|
20042
|
+
return close(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
20035
20043
|
}
|
|
20036
20044
|
drawToSvgPath(size, x, y, z) {
|
|
20037
|
-
const r = size / 2;
|
|
20045
|
+
const r = this.parseSize(size) / 2;
|
|
20038
20046
|
return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`;
|
|
20039
20047
|
}
|
|
20040
20048
|
}
|
|
@@ -20068,15 +20076,18 @@
|
|
|
20068
20076
|
this.pathStr = "", this.type = type, isArray$1(path) ? this.svgCache = path : this.path = path, this.isSvg = isSvg;
|
|
20069
20077
|
}
|
|
20070
20078
|
drawOffset(ctx, size, x, y, offset, z, cb) {
|
|
20071
|
-
return this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
|
|
20079
|
+
return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
|
|
20072
20080
|
ctx.beginPath(), renderCommandList(item.path.commandList, ctx, x, y, size, size), cb && cb(item.path, item.attribute);
|
|
20073
20081
|
}), !1) : (renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset), !1);
|
|
20074
20082
|
}
|
|
20075
20083
|
draw(ctx, size, x, y, z, cb) {
|
|
20076
|
-
return this.drawOffset(ctx, size, x, y, 0, z, cb);
|
|
20084
|
+
return size = this.parseSize(size), this.drawOffset(ctx, size, x, y, 0, z, cb);
|
|
20085
|
+
}
|
|
20086
|
+
parseSize(size) {
|
|
20087
|
+
return isNumber$1(size) ? size : Math.min(size[0], size[1]);
|
|
20077
20088
|
}
|
|
20078
20089
|
bounds(size, bounds) {
|
|
20079
|
-
if (this.isSvg) {
|
|
20090
|
+
if (size = this.parseSize(size), this.isSvg) {
|
|
20080
20091
|
if (!this.svgCache) return;
|
|
20081
20092
|
return bounds.clear(), void this.svgCache.forEach(_ref => {
|
|
20082
20093
|
let {
|
|
@@ -20759,7 +20770,11 @@
|
|
|
20759
20770
|
case "sub":
|
|
20760
20771
|
baseline += this.descent / 2;
|
|
20761
20772
|
}
|
|
20762
|
-
"vertical" === direction && (ctx.save(), ctx.rotateAbout(Math.PI / 2, left, baseline), ctx.translate(-this.heightOrigin || -this.lineHeight / 2, -this.descent / 2), ctx.translate(left, baseline), left = 0, baseline = 0)
|
|
20773
|
+
"vertical" === direction && (ctx.save(), ctx.rotateAbout(Math.PI / 2, left, baseline), ctx.translate(-this.heightOrigin || -this.lineHeight / 2, -this.descent / 2), ctx.translate(left, baseline), left = 0, baseline = 0);
|
|
20774
|
+
const {
|
|
20775
|
+
lineWidth = 1
|
|
20776
|
+
} = this.character;
|
|
20777
|
+
this.character.stroke && lineWidth && ctx.strokeText(text, left, baseline), this.character.fill && ctx.fillText(text, left, baseline), this.character.fill && ("boolean" == typeof this.character.lineThrough || "boolean" == typeof this.character.underline ? (this.character.underline && ctx.fillRect(left, 1 + baseline, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1), this.character.lineThrough && ctx.fillRect(left, 1 + baseline - this.ascent / 2, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1)) : "underline" === this.character.textDecoration ? ctx.fillRect(left, 1 + baseline, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1) : "line-through" === this.character.textDecoration && ctx.fillRect(left, 1 + baseline - this.ascent / 2, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1)), "vertical" === direction && ctx.restore();
|
|
20763
20778
|
}
|
|
20764
20779
|
getWidthWithEllips(direction) {
|
|
20765
20780
|
let text = this.text;
|
|
@@ -20982,12 +20997,18 @@
|
|
|
20982
20997
|
paragraph.ellipsis = "hide", otherParagraphWidth += paragraph.width;
|
|
20983
20998
|
}
|
|
20984
20999
|
}
|
|
20985
|
-
this.paragraphs.
|
|
21000
|
+
this.paragraphs.forEach((paragraph, index) => {
|
|
20986
21001
|
if (paragraph instanceof RichTextIcon) return paragraph.setAttributes({
|
|
20987
21002
|
x: x + paragraph._x,
|
|
20988
21003
|
y: y + paragraph._y
|
|
20989
21004
|
}), void drawIcon(paragraph, ctx, x + paragraph._x, y + paragraph._y, this.ascent);
|
|
20990
|
-
|
|
21005
|
+
const b = {
|
|
21006
|
+
x1: this.left,
|
|
21007
|
+
y1: this.top,
|
|
21008
|
+
x2: this.left + this.actualWidth,
|
|
21009
|
+
y2: this.top + this.height
|
|
21010
|
+
};
|
|
21011
|
+
applyStrokeStyle(ctx, paragraph.character), applyFillStyle(ctx, paragraph.character, b), paragraph.draw(ctx, y + this.ascent, x, 0 === index, this.textAlign);
|
|
20991
21012
|
});
|
|
20992
21013
|
}
|
|
20993
21014
|
getWidthWithEllips(ellipsis) {
|
|
@@ -21010,7 +21031,7 @@
|
|
|
21010
21031
|
paragraph.ellipsis = "hide", otherParagraphWidth += paragraph.width;
|
|
21011
21032
|
}
|
|
21012
21033
|
let width = 0;
|
|
21013
|
-
return this.paragraphs.
|
|
21034
|
+
return this.paragraphs.forEach((paragraph, index) => {
|
|
21014
21035
|
width += paragraph instanceof RichTextIcon ? paragraph.width : paragraph.getWidthWithEllips(this.direction);
|
|
21015
21036
|
}), width;
|
|
21016
21037
|
}
|
|
@@ -31756,19 +31777,28 @@
|
|
|
31756
31777
|
return "rect" === type ? DefaultRectPositions : DefaultPositions;
|
|
31757
31778
|
}
|
|
31758
31779
|
function clampText(text, width, height) {
|
|
31780
|
+
let padding = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
31759
31781
|
const {
|
|
31760
31782
|
x1: x1,
|
|
31761
31783
|
x2: x2,
|
|
31762
31784
|
y1: y1,
|
|
31763
31785
|
y2: y2
|
|
31764
31786
|
} = text.AABBBounds,
|
|
31787
|
+
{
|
|
31788
|
+
top = 0,
|
|
31789
|
+
left = 0,
|
|
31790
|
+
right = 0,
|
|
31791
|
+
bottom = 0
|
|
31792
|
+
} = padding,
|
|
31765
31793
|
minX = Math.min(x1, x2),
|
|
31766
31794
|
maxX = Math.max(x1, x2),
|
|
31767
31795
|
minY = Math.min(y1, y2),
|
|
31768
|
-
maxY = Math.max(y1, y2)
|
|
31796
|
+
maxY = Math.max(y1, y2),
|
|
31797
|
+
minXWithPadding = 0 - left,
|
|
31798
|
+
minYWithPadding = 0 - top;
|
|
31769
31799
|
let dx = 0,
|
|
31770
31800
|
dy = 0;
|
|
31771
|
-
return minX <
|
|
31801
|
+
return minX < minXWithPadding && maxX - minX <= width ? dx = -minX : maxX > width + right && minX - (maxX - width) >= minXWithPadding && (dx = width - maxX), minY < minYWithPadding && maxY - minY <= height ? dy = -minY : maxY > height + bottom && minY - (maxY - height) >= minYWithPadding && (dy = height - maxY), {
|
|
31772
31802
|
dx: dx,
|
|
31773
31803
|
dy: dy
|
|
31774
31804
|
};
|
|
@@ -32063,71 +32093,166 @@
|
|
|
32063
32093
|
registerGroup(), registerText(), registerRichtext(), registerLine();
|
|
32064
32094
|
}
|
|
32065
32095
|
|
|
32066
|
-
|
|
32067
|
-
|
|
32096
|
+
const isIntersect = (top, bottom) => Math.ceil(top) > Math.floor(bottom),
|
|
32097
|
+
isXIntersect = (_ref, _ref2) => {
|
|
32098
|
+
let [a, b] = _ref;
|
|
32099
|
+
let [c, d] = _ref2;
|
|
32100
|
+
return d > a && b > c;
|
|
32101
|
+
};
|
|
32102
|
+
function getIntersectionLength(range1, range2) {
|
|
32103
|
+
const [start1, end1] = range1,
|
|
32104
|
+
[start2, end2] = range2,
|
|
32105
|
+
start = Math.max(start1, start2),
|
|
32106
|
+
end = Math.min(end1, end2);
|
|
32107
|
+
return Math.max(0, end - start);
|
|
32108
|
+
}
|
|
32109
|
+
function shiftY(texts, option) {
|
|
32068
32110
|
const {
|
|
32069
|
-
|
|
32070
|
-
|
|
32071
|
-
|
|
32072
|
-
|
|
32111
|
+
maxY = Number.MAX_VALUE,
|
|
32112
|
+
labelling: labelling,
|
|
32113
|
+
globalShiftY = {
|
|
32114
|
+
enable: !0,
|
|
32115
|
+
maxIterations: 10,
|
|
32116
|
+
maxError: .1,
|
|
32117
|
+
padding: 1
|
|
32118
|
+
}
|
|
32073
32119
|
} = option,
|
|
32074
32120
|
n = texts.length;
|
|
32075
32121
|
if (n <= 1) return texts;
|
|
32076
|
-
const
|
|
32077
|
-
let [a, b] = _ref;
|
|
32078
|
-
let [c, d] = _ref2;
|
|
32079
|
-
return d > a && b > c;
|
|
32080
|
-
},
|
|
32122
|
+
const xMap = new Map(),
|
|
32081
32123
|
textInformation = new Map(),
|
|
32082
|
-
|
|
32083
|
-
getY = text => textInformation.get(text).y,
|
|
32124
|
+
getY1Initial = text => textInformation.get(text).y1Initial,
|
|
32084
32125
|
getHeight = text => textInformation.get(text).height,
|
|
32126
|
+
getY1 = text => textInformation.get(text).y1,
|
|
32127
|
+
getX = text => textInformation.get(text).x,
|
|
32085
32128
|
getX1 = text => textInformation.get(text).x1,
|
|
32086
32129
|
getX2 = text => textInformation.get(text).x2,
|
|
32087
|
-
|
|
32088
|
-
|
|
32130
|
+
getAdjustAttempts = text => textInformation.get(text).attempts,
|
|
32131
|
+
setY1 = (text, y) => {
|
|
32132
|
+
textInformation.get(text).y1 = y;
|
|
32133
|
+
},
|
|
32134
|
+
setAdjustAttempts = (text, attempts) => {
|
|
32135
|
+
textInformation.get(text).attempts = attempts;
|
|
32089
32136
|
};
|
|
32137
|
+
function adjustPositionInOneGroup(texts) {
|
|
32138
|
+
var text;
|
|
32139
|
+
if (1 !== texts.length) for (let i = texts.length - 1; i > 0; i--) {
|
|
32140
|
+
const curText = texts[i],
|
|
32141
|
+
upperText = texts[i - 1],
|
|
32142
|
+
lowerText = texts[i + 1];
|
|
32143
|
+
if (isIntersect(getY1(upperText) + getHeight(upperText), getY1(curText))) {
|
|
32144
|
+
const {
|
|
32145
|
+
y: y
|
|
32146
|
+
} = labelling(curText);
|
|
32147
|
+
lowerText && isIntersect(y + getHeight(curText) / 2, getY1(lowerText)) || y + getHeight(curText) / 2 <= maxY && setY1(curText, getY1(curText) + y - (text = curText, textInformation.get(text).y));
|
|
32148
|
+
}
|
|
32149
|
+
}
|
|
32150
|
+
}
|
|
32151
|
+
texts.sort((a, b) => a.attribute.x - b.attribute.x);
|
|
32090
32152
|
for (const text of texts) {
|
|
32091
32153
|
const {
|
|
32154
|
+
y1: y1,
|
|
32155
|
+
y2: y2,
|
|
32156
|
+
x1: x1,
|
|
32157
|
+
x2: x2
|
|
32158
|
+
} = text.AABBBounds,
|
|
32159
|
+
{
|
|
32160
|
+
x: x,
|
|
32161
|
+
y: y
|
|
32162
|
+
} = text.attribute;
|
|
32163
|
+
textInformation.set(text, {
|
|
32164
|
+
y1Initial: y1,
|
|
32092
32165
|
y1: y1,
|
|
32093
32166
|
y2: y2,
|
|
32094
|
-
|
|
32095
|
-
x2: x2
|
|
32096
|
-
} = text.AABBBounds;
|
|
32097
|
-
textInformation.set(text, {
|
|
32098
|
-
y0: y1,
|
|
32099
|
-
y: y1,
|
|
32167
|
+
y: y,
|
|
32100
32168
|
height: y2 - y1,
|
|
32101
32169
|
x1: x1,
|
|
32102
|
-
x2: x2
|
|
32170
|
+
x2: x2,
|
|
32171
|
+
x: x,
|
|
32172
|
+
attempts: 0
|
|
32103
32173
|
});
|
|
32174
|
+
let hasRange = !1;
|
|
32175
|
+
for (const [range, xGroupTexts] of xMap) {
|
|
32176
|
+
const {
|
|
32177
|
+
start: start,
|
|
32178
|
+
end: end
|
|
32179
|
+
} = range;
|
|
32180
|
+
if (x1 >= start && x2 <= end) xGroupTexts.push(text), hasRange = !0;else if (isNumberClose(x, getX(xGroupTexts[0]), void 0, 5)) {
|
|
32181
|
+
const newRange = {
|
|
32182
|
+
start: Math.min(start, x1),
|
|
32183
|
+
end: Math.max(end, x2)
|
|
32184
|
+
};
|
|
32185
|
+
xGroupTexts.push(text), xMap.set(newRange, xGroupTexts), xMap.delete(range), hasRange = !0;
|
|
32186
|
+
} else if (getIntersectionLength([start, end], [x1, x2]) / (end - start) > .5) {
|
|
32187
|
+
const newRange = {
|
|
32188
|
+
start: Math.min(start, x1),
|
|
32189
|
+
end: Math.max(end, x2)
|
|
32190
|
+
};
|
|
32191
|
+
xGroupTexts.push(text), xMap.set(newRange, xGroupTexts), xMap.delete(range), hasRange = !0;
|
|
32192
|
+
}
|
|
32193
|
+
if (hasRange) break;
|
|
32194
|
+
}
|
|
32195
|
+
hasRange || xMap.set({
|
|
32196
|
+
start: x1,
|
|
32197
|
+
end: x2
|
|
32198
|
+
}, [text]);
|
|
32104
32199
|
}
|
|
32105
|
-
for (
|
|
32106
|
-
|
|
32107
|
-
|
|
32108
|
-
|
|
32109
|
-
|
|
32110
|
-
|
|
32111
|
-
|
|
32112
|
-
|
|
32113
|
-
|
|
32114
|
-
|
|
32115
|
-
|
|
32116
|
-
|
|
32117
|
-
|
|
32118
|
-
|
|
32119
|
-
|
|
32120
|
-
|
|
32200
|
+
for (const xTexts of xMap.values()) xTexts.sort((a, b) => getY1Initial(a) - getY1Initial(b)), adjustPositionInOneGroup(xTexts);
|
|
32201
|
+
if (!1 !== globalShiftY.enable) {
|
|
32202
|
+
const {
|
|
32203
|
+
maxIterations = 10,
|
|
32204
|
+
maxError = .1,
|
|
32205
|
+
padding = 1,
|
|
32206
|
+
maxAttempts = 1e3,
|
|
32207
|
+
deltaYTolerance = Number.MAX_VALUE
|
|
32208
|
+
} = globalShiftY;
|
|
32209
|
+
for (let iter = 0; iter < maxIterations; iter++) {
|
|
32210
|
+
texts.sort((a, b) => getY1(a) - getY1(b));
|
|
32211
|
+
let error = 0;
|
|
32212
|
+
for (let i = 0; i < n - 1; i++) {
|
|
32213
|
+
const curText = texts[i];
|
|
32214
|
+
if (getAdjustAttempts(curText) >= maxAttempts) continue;
|
|
32215
|
+
let nextText,
|
|
32216
|
+
j = i + 1;
|
|
32217
|
+
for (; (nextText = texts[j]) && !isXIntersect([getX1(curText), getX2(curText)], [getX1(nextText), getX2(nextText)]);) j += 1;
|
|
32218
|
+
if (nextText) {
|
|
32219
|
+
const y1 = getY1(curText),
|
|
32220
|
+
h0 = getHeight(curText),
|
|
32221
|
+
nextY1 = getY1(nextText),
|
|
32222
|
+
delta = nextY1 - (y1 + h0);
|
|
32223
|
+
if (delta < padding) {
|
|
32224
|
+
const newDelta = (padding - delta) / 2;
|
|
32225
|
+
if (error = Math.max(error, newDelta), y1 + newDelta + getHeight(nextText) > maxY) {
|
|
32226
|
+
const newY1 = y1 - (padding - delta),
|
|
32227
|
+
curTextDelta = getY1Initial(curText) - newY1;
|
|
32228
|
+
Math.abs(curTextDelta) <= deltaYTolerance && (setY1(curText, newY1), setAdjustAttempts(curText, getAdjustAttempts(curText) + 1));
|
|
32229
|
+
} else if (y1 - newDelta < 0) {
|
|
32230
|
+
const newY1 = nextY1 + (padding - delta),
|
|
32231
|
+
nextTextDelta = getY1Initial(nextText) - newY1;
|
|
32232
|
+
Math.abs(nextTextDelta) <= deltaYTolerance && (setY1(nextText, newY1), setAdjustAttempts(nextText, getAdjustAttempts(nextText) + 1));
|
|
32233
|
+
} else {
|
|
32234
|
+
const newCurY1 = y1 - newDelta,
|
|
32235
|
+
curTextDelta = getY1Initial(curText) - newCurY1,
|
|
32236
|
+
newNextY1 = nextY1 + newDelta,
|
|
32237
|
+
nextTextDelta = getY1Initial(nextText) - newNextY1;
|
|
32238
|
+
Math.abs(curTextDelta) <= deltaYTolerance && Math.abs(nextTextDelta) <= deltaYTolerance && (setY1(curText, newCurY1), setY1(nextText, newNextY1), setAdjustAttempts(curText, getAdjustAttempts(curText) + 1), setAdjustAttempts(nextText, getAdjustAttempts(nextText) + 1));
|
|
32239
|
+
}
|
|
32240
|
+
}
|
|
32121
32241
|
}
|
|
32122
32242
|
}
|
|
32243
|
+
if (error < maxError) break;
|
|
32123
32244
|
}
|
|
32124
|
-
if (error < maxError) break;
|
|
32125
32245
|
}
|
|
32126
32246
|
for (const text of texts) {
|
|
32127
|
-
const finalY = text.attribute.y +
|
|
32247
|
+
const finalY = text.attribute.y + getY1(text) - getY1Initial(text);
|
|
32128
32248
|
text.setAttribute("y", finalY);
|
|
32129
32249
|
}
|
|
32130
|
-
|
|
32250
|
+
const result = [];
|
|
32251
|
+
texts.sort((a, b) => a.attribute.x - b.attribute.x);
|
|
32252
|
+
let start = 0,
|
|
32253
|
+
end = texts.length - 1;
|
|
32254
|
+
for (; start <= end;) start === end ? result.push(texts[start]) : (result.push(texts[start]), result.push(texts[end])), start++, end--;
|
|
32255
|
+
return result;
|
|
32131
32256
|
}
|
|
32132
32257
|
|
|
32133
32258
|
var __rest$b = undefined && undefined.__rest || function (s, e) {
|
|
@@ -32366,20 +32491,26 @@
|
|
|
32366
32491
|
{
|
|
32367
32492
|
dx = 0,
|
|
32368
32493
|
dy = 0
|
|
32369
|
-
} = clampText(text, bmpTool.width, bmpTool.height);
|
|
32370
|
-
0 === dx && 0 === dy || text.setAttributes({
|
|
32494
|
+
} = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
|
|
32495
|
+
0 === dx && 0 === dy || (text.setAttributes({
|
|
32371
32496
|
x: text.attribute.x + dx,
|
|
32372
32497
|
y: text.attribute.y + dy
|
|
32373
|
-
});
|
|
32498
|
+
}), text._isClamped = !0);
|
|
32374
32499
|
}
|
|
32375
|
-
result = shiftY(result, Object.assign({
|
|
32500
|
+
result = shiftY(result, Object.assign(Object.assign({
|
|
32376
32501
|
maxY: bmpTool.height
|
|
32377
|
-
}, strategy)
|
|
32502
|
+
}, strategy), {
|
|
32503
|
+
labelling: text => {
|
|
32504
|
+
const baseMark = this.getRelatedGraphic(text.attribute),
|
|
32505
|
+
graphicBound = this._isCollectionBase ? this.getGraphicBounds(null, this._idToPoint.get(text.attribute.id)) : this.getGraphicBounds(baseMark, text);
|
|
32506
|
+
return this.labeling(text.AABBBounds, graphicBound, "bottom", this.attribute.offset);
|
|
32507
|
+
}
|
|
32508
|
+
}));
|
|
32378
32509
|
for (let i = 0; i < result.length; i++) {
|
|
32379
32510
|
const text = result[i],
|
|
32380
32511
|
bounds = text.AABBBounds,
|
|
32381
32512
|
range = boundToRange(bmpTool, bounds, !0);
|
|
32382
|
-
canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding) ? bitmap.setRange(range) : hideOnHit ? text.setAttributes({
|
|
32513
|
+
canPlace(bmpTool, bitmap, bounds, clampForce, text._isClamped ? 0 : overlapPadding) ? bitmap.setRange(range) : hideOnHit ? text.setAttributes({
|
|
32383
32514
|
visible: !1
|
|
32384
32515
|
}) : bitmap.setRange(range);
|
|
32385
32516
|
}
|
|
@@ -32436,7 +32567,7 @@
|
|
|
32436
32567
|
const {
|
|
32437
32568
|
dx = 0,
|
|
32438
32569
|
dy = 0
|
|
32439
|
-
} = clampText(text, bmpTool.width, bmpTool.height);
|
|
32570
|
+
} = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
|
|
32440
32571
|
if (0 === dx && 0 === dy) {
|
|
32441
32572
|
if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
|
|
32442
32573
|
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
|
|
@@ -47843,10 +47974,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
47843
47974
|
return this.options.state;
|
|
47844
47975
|
}
|
|
47845
47976
|
start(element) {
|
|
47846
|
-
element && this._marks && this._marks.includes(element.mark) && element.addState(this.options.state);
|
|
47977
|
+
element && this._marks && this._marks.includes(element.mark) && (element.addState(this.options.state), this._prevActiveElement = element);
|
|
47847
47978
|
}
|
|
47848
47979
|
reset(element) {
|
|
47849
|
-
|
|
47980
|
+
const el = null != element ? element : this._prevActiveElement;
|
|
47981
|
+
el && this._marks && this._marks.includes(el.mark) && el.removeState(this.options.state);
|
|
47850
47982
|
}
|
|
47851
47983
|
}
|
|
47852
47984
|
ElementActive.type = "element-active", ElementActive.defaultOptions = {
|
|
@@ -47884,7 +48016,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
47884
48016
|
|
|
47885
48017
|
class ElementSelect extends BaseInteraction {
|
|
47886
48018
|
constructor(view, options) {
|
|
47887
|
-
super(view, options), this.type = ElementSelect.type, this._resetType = [], this.
|
|
48019
|
+
super(view, options), this.type = ElementSelect.type, this._resetType = [], this.resetAll = () => {
|
|
47888
48020
|
const {
|
|
47889
48021
|
state: state,
|
|
47890
48022
|
reverseState: reverseState
|
|
@@ -47896,7 +48028,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
47896
48028
|
}, this.handleStart = e => {
|
|
47897
48029
|
this.start(e.element);
|
|
47898
48030
|
}, this.handleReset = e => {
|
|
47899
|
-
this.
|
|
48031
|
+
if (!this._statedElements || !this._statedElements.length) return;
|
|
48032
|
+
const element = e.element,
|
|
48033
|
+
hasActiveElement = element && this._marks && this._marks.includes(element.mark);
|
|
48034
|
+
(this._resetType.includes("view") && !hasActiveElement || this._resetType.includes("self") && hasActiveElement) && this.resetAll();
|
|
47900
48035
|
}, this.options = Object.assign({}, ElementSelect.defaultOptions, options), this._marks = view.getMarksBySelector(this.options.selector), this._stateMarks = groupMarksByState(this._marks, [this.options.state, this.options.reverseState]);
|
|
47901
48036
|
}
|
|
47902
48037
|
getStartState() {
|
|
@@ -47930,20 +48065,18 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
47930
48065
|
if (element.hasState(state)) {
|
|
47931
48066
|
if (this._resetType.includes("self")) {
|
|
47932
48067
|
const newStatedElements = this._statedElements && this._statedElements.filter(el => el !== element);
|
|
47933
|
-
newStatedElements && newStatedElements.length ? this._statedElements = this.updateStates(newStatedElements, this._statedElements, state, reverseState) : this.
|
|
48068
|
+
newStatedElements && newStatedElements.length ? this._statedElements = this.updateStates(newStatedElements, this._statedElements, state, reverseState) : this.resetAll();
|
|
47934
48069
|
}
|
|
47935
48070
|
} else this._timer && clearTimeout(this._timer), element.addState(state), this._statedElements = this.updateStates(isMultiple && this._statedElements ? [...this._statedElements, element] : [element], this._statedElements, state, reverseState), this.dispatchEvent("start", {
|
|
47936
48071
|
elements: this._statedElements,
|
|
47937
48072
|
options: this.options
|
|
47938
48073
|
}), this._resetType.includes("timeout") && (this._timer = setTimeout(() => {
|
|
47939
|
-
this.
|
|
48074
|
+
this.resetAll();
|
|
47940
48075
|
}, this.options.triggerOff));
|
|
47941
|
-
} else this._resetType.includes("view") && this._statedElements && this._statedElements.length && this.
|
|
48076
|
+
} else this._resetType.includes("view") && this._statedElements && this._statedElements.length && this.resetAll();
|
|
47942
48077
|
}
|
|
47943
48078
|
reset(element) {
|
|
47944
|
-
|
|
47945
|
-
const hasActiveElement = element && this._marks && this._marks.includes(element.mark);
|
|
47946
|
-
(this._resetType.includes("view") && !hasActiveElement || this._resetType.includes("self") && hasActiveElement) && this.clearPrevElements();
|
|
48079
|
+
element ? this._marks && this._marks.includes(element.mark) && element.removeState([this.options.state, this.options.reverseState]) : this.resetAll();
|
|
47947
48080
|
}
|
|
47948
48081
|
}
|
|
47949
48082
|
ElementSelect.type = "element-select", ElementSelect.defaultOptions = {
|
|
@@ -47956,7 +48089,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
47956
48089
|
super(view, options), this.type = ElementHighlight.type, this.handleStart = e => {
|
|
47957
48090
|
this.start(e.element);
|
|
47958
48091
|
}, this.handleReset = e => {
|
|
47959
|
-
this.
|
|
48092
|
+
if (!this._statedElements || !this._statedElements.length) return;
|
|
48093
|
+
const element = e.element;
|
|
48094
|
+
if (element) {
|
|
48095
|
+
const hasActiveElement = this._marks && this._marks.includes(element.mark);
|
|
48096
|
+
"view" !== this._resetType || hasActiveElement ? "self" === this._resetType && hasActiveElement && this.resetAll() : this.resetAll();
|
|
48097
|
+
}
|
|
47960
48098
|
}, this.options = Object.assign({}, ElementHighlight.defaultOptions, options), this._marks = view.getMarksBySelector(this.options.selector), this._stateMarks = groupMarksByState(this._marks, [this.options.highlightState, this.options.blurState]);
|
|
47961
48099
|
}
|
|
47962
48100
|
getStartState() {
|
|
@@ -47974,7 +48112,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
47974
48112
|
handler: this.handleReset
|
|
47975
48113
|
}), events;
|
|
47976
48114
|
}
|
|
47977
|
-
|
|
48115
|
+
resetAll() {
|
|
47978
48116
|
const {
|
|
47979
48117
|
highlightState: highlightState,
|
|
47980
48118
|
blurState: blurState
|
|
@@ -47995,12 +48133,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
47995
48133
|
elements: [element],
|
|
47996
48134
|
options: this.options
|
|
47997
48135
|
});
|
|
47998
|
-
} else this._lastElement && "view" === this._resetType && this.
|
|
48136
|
+
} else this._lastElement && "view" === this._resetType && this.resetAll();
|
|
47999
48137
|
}
|
|
48000
48138
|
reset(element) {
|
|
48001
|
-
|
|
48002
|
-
const hasActiveElement = element && this._marks && this._marks.includes(element.mark);
|
|
48003
|
-
"view" !== this._resetType || hasActiveElement ? "self" === this._resetType && hasActiveElement && this.clearPrevElements() : this.clearPrevElements();
|
|
48139
|
+
element ? this._marks && this._marks.includes(element.mark) && element.removeState([this.options.highlightState, this.options.blurState]) : this.resetAll();
|
|
48004
48140
|
}
|
|
48005
48141
|
}
|
|
48006
48142
|
ElementHighlight.type = "element-highlight", ElementHighlight.defaultOptions = {
|
|
@@ -48015,7 +48151,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
48015
48151
|
super(view, options), this.type = ElementHighlightByKey.type, this.handleStart = e => {
|
|
48016
48152
|
this.start(e.element);
|
|
48017
48153
|
}, this.handleReset = e => {
|
|
48018
|
-
e.element && this._marks && this._marks.includes(e.element.mark) && this.
|
|
48154
|
+
e.element && this._marks && this._marks.includes(e.element.mark) && this.resetAll();
|
|
48019
48155
|
}, this.options = Object.assign({}, ElementHighlightByKey.defaultOptions, options), this._marks = view.getMarksBySelector(this.options.selector);
|
|
48020
48156
|
}
|
|
48021
48157
|
getStartState() {
|
|
@@ -48030,7 +48166,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
48030
48166
|
handler: this.handleReset
|
|
48031
48167
|
}];
|
|
48032
48168
|
}
|
|
48033
|
-
|
|
48169
|
+
resetAll() {
|
|
48034
48170
|
const states = [this.options.highlightState, this.options.blurState];
|
|
48035
48171
|
this._marks.forEach(mark => {
|
|
48036
48172
|
mark.elements.forEach(el => {
|
|
@@ -48056,21 +48192,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
48056
48192
|
}
|
|
48057
48193
|
}
|
|
48058
48194
|
reset(element) {
|
|
48059
|
-
|
|
48060
|
-
const highlightKey = element.key;
|
|
48061
|
-
if (isNil$1(highlightKey)) return;
|
|
48062
|
-
this._marks.forEach(mark => {
|
|
48063
|
-
mark.elements.forEach(el => {
|
|
48064
|
-
el.key === highlightKey ? el.updateStates({
|
|
48065
|
-
[this.options.blurState]: !1,
|
|
48066
|
-
[this.options.highlightState]: !0
|
|
48067
|
-
}) : el.updateStates({
|
|
48068
|
-
[this.options.blurState]: !0,
|
|
48069
|
-
[this.options.highlightState]: !1
|
|
48070
|
-
});
|
|
48071
|
-
});
|
|
48072
|
-
});
|
|
48073
|
-
}
|
|
48195
|
+
element ? this._marks && this._marks.includes(element.mark) && element.removeState([this.options.highlightState, this.options.blurState]) : this.resetAll();
|
|
48074
48196
|
}
|
|
48075
48197
|
}
|
|
48076
48198
|
ElementHighlightByKey.type = "element-highlight-by-key", ElementHighlightByKey.defaultOptions = {
|
|
@@ -48085,7 +48207,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
48085
48207
|
super(view, options), this.type = ElementHighlightByGroup.type, this.handleStart = e => {
|
|
48086
48208
|
this.start(e.element);
|
|
48087
48209
|
}, this.handleReset = e => {
|
|
48088
|
-
|
|
48210
|
+
const element = e.element;
|
|
48211
|
+
element && this._marks && this._marks.includes(element.mark) && this.resetAll();
|
|
48089
48212
|
}, this.options = Object.assign({}, ElementHighlightByGroup.defaultOptions, options), this._marks = view.getMarksBySelector(this.options.selector);
|
|
48090
48213
|
}
|
|
48091
48214
|
getStartState() {
|
|
@@ -48100,7 +48223,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
48100
48223
|
handler: this.handleReset
|
|
48101
48224
|
}];
|
|
48102
48225
|
}
|
|
48103
|
-
|
|
48226
|
+
resetAll() {
|
|
48104
48227
|
const states = [this.options.highlightState, this.options.blurState];
|
|
48105
48228
|
this._marks.forEach(mark => {
|
|
48106
48229
|
mark.elements.forEach(el => {
|
|
@@ -48126,7 +48249,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
48126
48249
|
}
|
|
48127
48250
|
}
|
|
48128
48251
|
reset(element) {
|
|
48129
|
-
element
|
|
48252
|
+
element ? this._marks && this._marks.includes(element.mark) && element.removeState([this.options.highlightState, this.options.blurState]) : this.resetAll();
|
|
48130
48253
|
}
|
|
48131
48254
|
}
|
|
48132
48255
|
ElementHighlightByGroup.type = "element-highlight-by-group", ElementHighlightByGroup.defaultOptions = {
|
|
@@ -48142,7 +48265,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
48142
48265
|
var _a, _b;
|
|
48143
48266
|
this.start(null === (_b = null === (_a = e.detail) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b.id);
|
|
48144
48267
|
}, this.handleReset = e => {
|
|
48145
|
-
this.
|
|
48268
|
+
this.resetAll();
|
|
48146
48269
|
}, this.options = Object.assign({}, ElementActiveByLegend.defaultOptions, options), this._marks = view.getMarksBySelector(this.options.selector);
|
|
48147
48270
|
}
|
|
48148
48271
|
getEvents() {
|
|
@@ -48167,13 +48290,16 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
48167
48290
|
});
|
|
48168
48291
|
});
|
|
48169
48292
|
}
|
|
48170
|
-
|
|
48293
|
+
resetAll() {
|
|
48171
48294
|
this._marks.forEach(mark => {
|
|
48172
48295
|
mark.elements.forEach(el => {
|
|
48173
48296
|
el.removeState(this.options.state);
|
|
48174
48297
|
});
|
|
48175
48298
|
});
|
|
48176
48299
|
}
|
|
48300
|
+
reset(element) {
|
|
48301
|
+
element ? this._marks && this._marks.includes(element.mark) && element.removeState(this.options.state) : this.resetAll();
|
|
48302
|
+
}
|
|
48177
48303
|
}
|
|
48178
48304
|
ElementActiveByLegend.type = "element-active-by-legend", ElementActiveByLegend.defaultOptions = {
|
|
48179
48305
|
state: InteractionStateEnum.active,
|
|
@@ -48186,7 +48312,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
48186
48312
|
var _a, _b;
|
|
48187
48313
|
this.start(null === (_b = null === (_a = e.detail) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b.id);
|
|
48188
48314
|
}, this.handleReset = e => {
|
|
48189
|
-
this.
|
|
48315
|
+
this.resetAll();
|
|
48190
48316
|
}, this.options = Object.assign({}, ElementHighlightByLegend.defaultOptions, options), this._marks = view.getMarksBySelector(this.options.selector);
|
|
48191
48317
|
}
|
|
48192
48318
|
getStartState() {
|
|
@@ -48216,14 +48342,17 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
48216
48342
|
});
|
|
48217
48343
|
});
|
|
48218
48344
|
}
|
|
48219
|
-
|
|
48220
|
-
const states = [this.options.
|
|
48345
|
+
resetAll() {
|
|
48346
|
+
const states = [this.options.highlightState, this.options.blurState];
|
|
48221
48347
|
this._marks.forEach(mark => {
|
|
48222
48348
|
mark.elements.forEach(el => {
|
|
48223
48349
|
el.removeState(states);
|
|
48224
48350
|
});
|
|
48225
48351
|
});
|
|
48226
48352
|
}
|
|
48353
|
+
reset(element) {
|
|
48354
|
+
element ? this._marks && this._marks.includes(element.mark) && element.removeState([this.options.highlightState, this.options.blurState]) : this.resetAll();
|
|
48355
|
+
}
|
|
48227
48356
|
}
|
|
48228
48357
|
ElementHighlightByLegend.type = "element-highlight-by-legend", ElementHighlightByLegend.defaultOptions = {
|
|
48229
48358
|
highlightState: InteractionStateEnum.highlight,
|
|
@@ -48239,7 +48368,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
48239
48368
|
this.start(itemKey);
|
|
48240
48369
|
}
|
|
48241
48370
|
}, this.handleReset = e => {
|
|
48242
|
-
(this.options.shouldReset ? this.options.shouldReset(e) : this._filterByName(e)) && this.
|
|
48371
|
+
(this.options.shouldReset ? this.options.shouldReset(e) : this._filterByName(e)) && this.resetAll();
|
|
48243
48372
|
}, this.options = Object.assign({}, ElementHighlightByName.defaultOptions, options), this._marks = view.getMarksBySelector(this.options.selector);
|
|
48244
48373
|
}
|
|
48245
48374
|
getStartState() {
|
|
@@ -48277,7 +48406,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
48277
48406
|
});
|
|
48278
48407
|
});
|
|
48279
48408
|
}
|
|
48280
|
-
|
|
48409
|
+
resetAll() {
|
|
48281
48410
|
const states = [this.options.blurState, this.options.highlightState];
|
|
48282
48411
|
this._marks.forEach(mark => {
|
|
48283
48412
|
mark.elements.forEach(el => {
|
|
@@ -48285,6 +48414,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
48285
48414
|
});
|
|
48286
48415
|
});
|
|
48287
48416
|
}
|
|
48417
|
+
reset(element) {
|
|
48418
|
+
element ? this._marks && this._marks.includes(element.mark) && element.removeState([this.options.highlightState, this.options.blurState]) : this.resetAll();
|
|
48419
|
+
}
|
|
48288
48420
|
}
|
|
48289
48421
|
ElementHighlightByName.type = "element-highlight-by-name", ElementHighlightByName.defaultOptions = {
|
|
48290
48422
|
trigger: "pointerover",
|
|
@@ -61748,7 +61880,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
61748
61880
|
};
|
|
61749
61881
|
registerVChartCore();
|
|
61750
61882
|
|
|
61751
|
-
const version = "1.12.
|
|
61883
|
+
const version = "1.12.13";
|
|
61752
61884
|
|
|
61753
61885
|
const addVChartProperty = (data, op) => {
|
|
61754
61886
|
const context = op.beforeCall();
|
|
@@ -73992,10 +74124,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
73992
74124
|
largeThreshold: this._spec.largeThreshold
|
|
73993
74125
|
};
|
|
73994
74126
|
this._boxPlotMark = this._createMark(BoxPlotSeries.mark.boxPlot, {
|
|
74127
|
+
groupKey: this._seriesField,
|
|
73995
74128
|
isSeriesMark: true
|
|
73996
74129
|
}, progressive);
|
|
73997
74130
|
this._outlierMark = this._createMark(BoxPlotSeries.mark.outlier, {
|
|
73998
74131
|
key: DEFAULT_DATA_INDEX,
|
|
74132
|
+
groupKey: this._seriesField,
|
|
73999
74133
|
dataView: this._outlierDataView.getDataView(),
|
|
74000
74134
|
dataProductId: this._outlierDataView.getProductId()
|
|
74001
74135
|
}, progressive);
|
|
@@ -80896,19 +81030,22 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
80896
81030
|
const outerLabelMark = this._funnelOuterLabelMark.label;
|
|
80897
81031
|
if (outerLabelMark) {
|
|
80898
81032
|
this.setMarkStyle(outerLabelMark, {
|
|
80899
|
-
text: (datum) => {
|
|
80900
|
-
const text = `${datum[this.getCategoryField()]}`;
|
|
80901
|
-
if (isFunction$1(this._spec.outerLabel.formatMethod)) {
|
|
80902
|
-
return this._spec.outerLabel.formatMethod(text, datum);
|
|
80903
|
-
}
|
|
80904
|
-
return text;
|
|
80905
|
-
},
|
|
81033
|
+
text: (datum) => `${datum[this.getCategoryField()]}`,
|
|
80906
81034
|
x: (datum) => this._computeOuterLabelPosition(datum).x,
|
|
80907
81035
|
y: (datum) => this._computeOuterLabelPosition(datum).y,
|
|
80908
81036
|
textAlign: (datum) => this._computeOuterLabelPosition(datum).align,
|
|
80909
81037
|
textBaseline: (datum) => this._computeOuterLabelPosition(datum).textBaseline,
|
|
80910
|
-
maxLineWidth: (datum) => this._computeOuterLabelLimit(datum)
|
|
81038
|
+
maxLineWidth: (datum) => this._computeOuterLabelLimit(datum),
|
|
81039
|
+
width: 0,
|
|
81040
|
+
height: 0
|
|
80911
81041
|
}, 'normal', AttributeLevel.Series);
|
|
81042
|
+
if (isFunction$1(this._spec.outerLabel.formatMethod)) {
|
|
81043
|
+
this.setMarkStyle(outerLabelMark, {
|
|
81044
|
+
text: (datum) => {
|
|
81045
|
+
return this._spec.outerLabel.formatMethod(`${datum[this.getCategoryField()]}`, datum);
|
|
81046
|
+
}
|
|
81047
|
+
}, 'normal', AttributeLevel.User_Mark);
|
|
81048
|
+
}
|
|
80912
81049
|
}
|
|
80913
81050
|
const outerLabelLineMark = this._funnelOuterLabelMark.line;
|
|
80914
81051
|
if (outerLabelLineMark && outerLabelMark) {
|