@visactor/vrender 0.20.15 → 0.20.17
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/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/index.es.js +740 -713
- package/dist/index.js +740 -713
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.es.js
CHANGED
|
@@ -1696,7 +1696,9 @@ class TextMeasure {
|
|
|
1696
1696
|
} = this.textSpec;
|
|
1697
1697
|
return {
|
|
1698
1698
|
width: metrics.width,
|
|
1699
|
-
height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize
|
|
1699
|
+
height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize,
|
|
1700
|
+
fontBoundingBoxAscent: metrics.fontBoundingBoxAscent,
|
|
1701
|
+
fontBoundingBoxDescent: metrics.fontBoundingBoxDescent
|
|
1700
1702
|
};
|
|
1701
1703
|
}
|
|
1702
1704
|
quickMeasure(text) {
|
|
@@ -1710,7 +1712,7 @@ class TextMeasure {
|
|
|
1710
1712
|
for (let i = 0; i < text.length; i++) {
|
|
1711
1713
|
const char = text[i];
|
|
1712
1714
|
let size = this._measureSpecialChar(char);
|
|
1713
|
-
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);
|
|
1715
|
+
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), !isNil$1(size.fontBoundingBoxAscent) && (totalSize.fontBoundingBoxAscent = size.fontBoundingBoxAscent), !isNil$1(size.fontBoundingBoxDescent) && (totalSize.fontBoundingBoxDescent = size.fontBoundingBoxDescent);
|
|
1714
1716
|
}
|
|
1715
1717
|
return totalSize;
|
|
1716
1718
|
}
|
|
@@ -1759,7 +1761,9 @@ class TextMeasure {
|
|
|
1759
1761
|
const numberBounds = this._standardMethod(TextMeasure.NUMBERS_CHAR_SET);
|
|
1760
1762
|
this._numberCharSize = {
|
|
1761
1763
|
width: numberBounds.width / TextMeasure.NUMBERS_CHAR_SET.length,
|
|
1762
|
-
height: numberBounds.height
|
|
1764
|
+
height: numberBounds.height,
|
|
1765
|
+
fontBoundingBoxAscent: numberBounds.fontBoundingBoxAscent,
|
|
1766
|
+
fontBoundingBoxDescent: numberBounds.fontBoundingBoxDescent
|
|
1763
1767
|
};
|
|
1764
1768
|
}
|
|
1765
1769
|
return this._numberCharSize;
|
|
@@ -1772,7 +1776,9 @@ class TextMeasure {
|
|
|
1772
1776
|
const alphabetBounds = this._standardMethod(TextMeasure.ALPHABET_CHAR_SET);
|
|
1773
1777
|
this._letterCharSize = {
|
|
1774
1778
|
width: alphabetBounds.width / TextMeasure.ALPHABET_CHAR_SET.length,
|
|
1775
|
-
height: alphabetBounds.height
|
|
1779
|
+
height: alphabetBounds.height,
|
|
1780
|
+
fontBoundingBoxAscent: alphabetBounds.fontBoundingBoxAscent,
|
|
1781
|
+
fontBoundingBoxDescent: alphabetBounds.fontBoundingBoxDescent
|
|
1776
1782
|
};
|
|
1777
1783
|
}
|
|
1778
1784
|
return this._letterCharSize;
|
|
@@ -4143,6 +4149,292 @@ const DefaultRichTextIconAttribute = Object.assign(Object.assign({}, DefaultImag
|
|
|
4143
4149
|
class Application {}
|
|
4144
4150
|
const application = new Application();
|
|
4145
4151
|
|
|
4152
|
+
const parse = function () {
|
|
4153
|
+
const tokens = {
|
|
4154
|
+
linearGradient: /^(linear\-gradient)/i,
|
|
4155
|
+
radialGradient: /^(radial\-gradient)/i,
|
|
4156
|
+
conicGradient: /^(conic\-gradient)/i,
|
|
4157
|
+
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,
|
|
4158
|
+
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
|
4159
|
+
positionKeywords: /^(left|center|right|top|bottom)/i,
|
|
4160
|
+
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
|
|
4161
|
+
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
|
|
4162
|
+
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
|
|
4163
|
+
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
|
4164
|
+
fromAngleValue: /^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
|
4165
|
+
startCall: /^\(/,
|
|
4166
|
+
endCall: /^\)/,
|
|
4167
|
+
comma: /^,/,
|
|
4168
|
+
hexColor: /(^\#[0-9a-fA-F]+)/,
|
|
4169
|
+
literalColor: /^([a-zA-Z]+)/,
|
|
4170
|
+
rgbColor: /^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,
|
|
4171
|
+
rgbaColor: /^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,
|
|
4172
|
+
number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
|
|
4173
|
+
};
|
|
4174
|
+
let input = "";
|
|
4175
|
+
function error(msg) {
|
|
4176
|
+
const err = new Error(input + ": " + msg);
|
|
4177
|
+
throw err.source = input, err;
|
|
4178
|
+
}
|
|
4179
|
+
function getAST() {
|
|
4180
|
+
const ast = matchListing(matchDefinition);
|
|
4181
|
+
return input.length > 0 && error("Invalid input not EOF"), ast;
|
|
4182
|
+
}
|
|
4183
|
+
function matchDefinition() {
|
|
4184
|
+
return matchGradient("linear", tokens.linearGradient, matchLinearOrientation) || matchGradient("radial", tokens.radialGradient, matchListRadialOrientations) || matchGradient("conic", tokens.conicGradient, matchConicalOrientation);
|
|
4185
|
+
}
|
|
4186
|
+
function matchGradient(gradientType, pattern, orientationMatcher) {
|
|
4187
|
+
return function (pattern, callback) {
|
|
4188
|
+
const captures = scan(pattern);
|
|
4189
|
+
if (captures) {
|
|
4190
|
+
scan(tokens.startCall) || error("Missing (");
|
|
4191
|
+
const result = callback(captures);
|
|
4192
|
+
return scan(tokens.endCall) || error("Missing )"), result;
|
|
4193
|
+
}
|
|
4194
|
+
}(pattern, function (captures) {
|
|
4195
|
+
const orientation = orientationMatcher();
|
|
4196
|
+
return orientation && (scan(tokens.comma) || error("Missing comma before color stops")), {
|
|
4197
|
+
type: gradientType,
|
|
4198
|
+
orientation: orientation,
|
|
4199
|
+
colorStops: matchListing(matchColorStop)
|
|
4200
|
+
};
|
|
4201
|
+
});
|
|
4202
|
+
}
|
|
4203
|
+
function matchLinearOrientation() {
|
|
4204
|
+
return match("directional", tokens.sideOrCorner, 1) || match("angular", tokens.angleValue, 1);
|
|
4205
|
+
}
|
|
4206
|
+
function matchConicalOrientation() {
|
|
4207
|
+
return match("angular", tokens.fromAngleValue, 1);
|
|
4208
|
+
}
|
|
4209
|
+
function matchListRadialOrientations() {
|
|
4210
|
+
let radialOrientations,
|
|
4211
|
+
lookaheadCache,
|
|
4212
|
+
radialOrientation = matchRadialOrientation();
|
|
4213
|
+
return radialOrientation && (radialOrientations = [], radialOrientations.push(radialOrientation), lookaheadCache = input, scan(tokens.comma) && (radialOrientation = matchRadialOrientation(), radialOrientation ? radialOrientations.push(radialOrientation) : input = lookaheadCache)), radialOrientations;
|
|
4214
|
+
}
|
|
4215
|
+
function matchRadialOrientation() {
|
|
4216
|
+
let radialType = function () {
|
|
4217
|
+
const circle = match("shape", /^(circle)/i, 0);
|
|
4218
|
+
circle && (circle.style = matchLength() || matchExtentKeyword());
|
|
4219
|
+
return circle;
|
|
4220
|
+
}() || function () {
|
|
4221
|
+
const ellipse = match("shape", /^(ellipse)/i, 0);
|
|
4222
|
+
ellipse && (ellipse.style = matchDistance() || matchExtentKeyword());
|
|
4223
|
+
return ellipse;
|
|
4224
|
+
}();
|
|
4225
|
+
if (radialType) radialType.at = matchAtPosition();else {
|
|
4226
|
+
const extent = matchExtentKeyword();
|
|
4227
|
+
if (extent) {
|
|
4228
|
+
radialType = extent;
|
|
4229
|
+
const positionAt = matchAtPosition();
|
|
4230
|
+
positionAt && (radialType.at = positionAt);
|
|
4231
|
+
} else {
|
|
4232
|
+
const defaultPosition = matchPositioning();
|
|
4233
|
+
defaultPosition && (radialType = {
|
|
4234
|
+
type: "default-radial",
|
|
4235
|
+
at: defaultPosition
|
|
4236
|
+
});
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4239
|
+
return radialType;
|
|
4240
|
+
}
|
|
4241
|
+
function matchExtentKeyword() {
|
|
4242
|
+
return match("extent-keyword", tokens.extentKeywords, 1);
|
|
4243
|
+
}
|
|
4244
|
+
function matchAtPosition() {
|
|
4245
|
+
if (match("position", /^at/, 0)) {
|
|
4246
|
+
const positioning = matchPositioning();
|
|
4247
|
+
return positioning || error("Missing positioning value"), positioning;
|
|
4248
|
+
}
|
|
4249
|
+
}
|
|
4250
|
+
function matchPositioning() {
|
|
4251
|
+
const location = {
|
|
4252
|
+
x: matchDistance(),
|
|
4253
|
+
y: matchDistance()
|
|
4254
|
+
};
|
|
4255
|
+
if (location.x || location.y) return {
|
|
4256
|
+
type: "position",
|
|
4257
|
+
value: location
|
|
4258
|
+
};
|
|
4259
|
+
}
|
|
4260
|
+
function matchListing(matcher) {
|
|
4261
|
+
let captures = matcher();
|
|
4262
|
+
const result = [];
|
|
4263
|
+
if (captures) for (result.push(captures); scan(tokens.comma);) captures = matcher(), captures ? result.push(captures) : error("One extra comma");
|
|
4264
|
+
return result;
|
|
4265
|
+
}
|
|
4266
|
+
function matchColorStop() {
|
|
4267
|
+
const color = match("hex", tokens.hexColor, 1) || match("rgba", tokens.rgbaColor, 1) || match("rgb", tokens.rgbColor, 1) || match("literal", tokens.literalColor, 0);
|
|
4268
|
+
return color || error("Expected color definition"), color.length = matchDistance(), color;
|
|
4269
|
+
}
|
|
4270
|
+
function matchDistance() {
|
|
4271
|
+
return match("%", tokens.percentageValue, 1) || match("position-keyword", tokens.positionKeywords, 1) || matchLength();
|
|
4272
|
+
}
|
|
4273
|
+
function matchLength() {
|
|
4274
|
+
return match("px", tokens.pixelValue, 1) || match("em", tokens.emValue, 1);
|
|
4275
|
+
}
|
|
4276
|
+
function match(type, pattern, captureIndex) {
|
|
4277
|
+
const captures = scan(pattern);
|
|
4278
|
+
if (captures) return {
|
|
4279
|
+
type: type,
|
|
4280
|
+
value: captures[captureIndex]
|
|
4281
|
+
};
|
|
4282
|
+
}
|
|
4283
|
+
function scan(regexp) {
|
|
4284
|
+
const blankCaptures = /^[\n\r\t\s]+/.exec(input);
|
|
4285
|
+
blankCaptures && consume(blankCaptures[0].length);
|
|
4286
|
+
const captures = regexp.exec(input);
|
|
4287
|
+
return captures && consume(captures[0].length), captures;
|
|
4288
|
+
}
|
|
4289
|
+
function consume(size) {
|
|
4290
|
+
input = input.substr(size);
|
|
4291
|
+
}
|
|
4292
|
+
return function (code) {
|
|
4293
|
+
return input = code.toString(), getAST();
|
|
4294
|
+
};
|
|
4295
|
+
}();
|
|
4296
|
+
class GradientParser {
|
|
4297
|
+
static IsGradient(c) {
|
|
4298
|
+
return !("string" == typeof c && !c.includes("gradient"));
|
|
4299
|
+
}
|
|
4300
|
+
static IsGradientStr(c) {
|
|
4301
|
+
return "string" == typeof c && c.includes("gradient");
|
|
4302
|
+
}
|
|
4303
|
+
static Parse(c) {
|
|
4304
|
+
if (GradientParser.IsGradientStr(c)) try {
|
|
4305
|
+
const datum = parse(c)[0];
|
|
4306
|
+
if (datum) {
|
|
4307
|
+
if ("linear" === datum.type) return GradientParser.ParseLinear(datum);
|
|
4308
|
+
if ("radial" === datum.type) return GradientParser.ParseRadial(datum);
|
|
4309
|
+
if ("conic" === datum.type) return GradientParser.ParseConic(datum);
|
|
4310
|
+
}
|
|
4311
|
+
} catch (err) {
|
|
4312
|
+
return c;
|
|
4313
|
+
}
|
|
4314
|
+
return c;
|
|
4315
|
+
}
|
|
4316
|
+
static ParseConic(datum) {
|
|
4317
|
+
const {
|
|
4318
|
+
orientation: orientation,
|
|
4319
|
+
colorStops = []
|
|
4320
|
+
} = datum,
|
|
4321
|
+
halfPi = pi / 2,
|
|
4322
|
+
sa = parseFloat(orientation.value) / 180 * pi - halfPi;
|
|
4323
|
+
return {
|
|
4324
|
+
gradient: "conical",
|
|
4325
|
+
x: .5,
|
|
4326
|
+
y: .5,
|
|
4327
|
+
startAngle: sa,
|
|
4328
|
+
endAngle: sa + pi2,
|
|
4329
|
+
stops: colorStops.map(item => ({
|
|
4330
|
+
color: item.value,
|
|
4331
|
+
offset: parseFloat(item.length.value) / 100
|
|
4332
|
+
}))
|
|
4333
|
+
};
|
|
4334
|
+
}
|
|
4335
|
+
static ParseRadial(datum) {
|
|
4336
|
+
const {
|
|
4337
|
+
colorStops = []
|
|
4338
|
+
} = datum;
|
|
4339
|
+
return {
|
|
4340
|
+
gradient: "radial",
|
|
4341
|
+
x0: .5,
|
|
4342
|
+
y0: .5,
|
|
4343
|
+
x1: .5,
|
|
4344
|
+
y1: .5,
|
|
4345
|
+
r0: 0,
|
|
4346
|
+
r1: 1,
|
|
4347
|
+
stops: colorStops.map(item => ({
|
|
4348
|
+
color: item.value,
|
|
4349
|
+
offset: parseFloat(item.length.value) / 100
|
|
4350
|
+
}))
|
|
4351
|
+
};
|
|
4352
|
+
}
|
|
4353
|
+
static ParseLinear(datum) {
|
|
4354
|
+
const {
|
|
4355
|
+
orientation: orientation,
|
|
4356
|
+
colorStops = []
|
|
4357
|
+
} = datum,
|
|
4358
|
+
halfPi = pi / 2;
|
|
4359
|
+
let angle = "angular" === orientation.type ? parseFloat(orientation.value) / 180 * pi : 0;
|
|
4360
|
+
for (; angle < 0;) angle += pi2;
|
|
4361
|
+
for (; angle >= pi2;) angle -= pi2;
|
|
4362
|
+
let x0 = 0,
|
|
4363
|
+
y0 = 0,
|
|
4364
|
+
x1 = 0,
|
|
4365
|
+
y1 = 0;
|
|
4366
|
+
return angle < halfPi ? (x0 = 0, y0 = 1, x1 = Math.sin(angle), y1 = y0 - Math.cos(angle)) : angle < pi ? (x0 = 0, y0 = 0, x1 = Math.cos(angle - halfPi), y1 = Math.sin(angle - halfPi)) : angle < pi + halfPi ? (x0 = 1, y0 = 0, x1 = x0 - Math.sin(angle - pi), y1 = Math.cos(angle - pi)) : (x0 = 1, x1 = x0 - Math.cos(angle - halfPi - pi), y1 -= Math.sin(angle - halfPi - pi)), {
|
|
4367
|
+
gradient: "linear",
|
|
4368
|
+
x0: x0,
|
|
4369
|
+
y0: y0,
|
|
4370
|
+
x1: x1,
|
|
4371
|
+
y1: y1,
|
|
4372
|
+
stops: colorStops.map(item => ({
|
|
4373
|
+
color: item.value,
|
|
4374
|
+
offset: parseFloat(item.length.value) / 100
|
|
4375
|
+
}))
|
|
4376
|
+
};
|
|
4377
|
+
}
|
|
4378
|
+
}
|
|
4379
|
+
|
|
4380
|
+
function getScaledStroke(context, width, dpr) {
|
|
4381
|
+
let strokeWidth = width;
|
|
4382
|
+
const {
|
|
4383
|
+
a: a,
|
|
4384
|
+
b: b,
|
|
4385
|
+
c: c,
|
|
4386
|
+
d: d
|
|
4387
|
+
} = context.currentMatrix,
|
|
4388
|
+
scaleX = Math.sign(a) * Math.sqrt(a * a + b * b),
|
|
4389
|
+
scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);
|
|
4390
|
+
return scaleX + scaleY === 0 ? 0 : (strokeWidth = strokeWidth / Math.abs(scaleX + scaleY) * 2 * dpr, strokeWidth);
|
|
4391
|
+
}
|
|
4392
|
+
function createColor(context, c, params) {
|
|
4393
|
+
let offsetX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
4394
|
+
let offsetY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
4395
|
+
if (!c || !0 === c) return "black";
|
|
4396
|
+
let result, color;
|
|
4397
|
+
if (isArray$1(c)) for (let i = 0; i < c.length && (color = c[i], !color); i++);else color = c;
|
|
4398
|
+
if (color = GradientParser.Parse(color), "string" == typeof color) return color;
|
|
4399
|
+
if (params.AABBBounds && (!params.attribute || 0 !== params.attribute.scaleX || 0 !== params.attribute.scaleY)) {
|
|
4400
|
+
const bounds = params.AABBBounds;
|
|
4401
|
+
let w = bounds.x2 - bounds.x1,
|
|
4402
|
+
h = bounds.y2 - bounds.y1,
|
|
4403
|
+
x = bounds.x1 - offsetX,
|
|
4404
|
+
y = bounds.y1 - offsetY;
|
|
4405
|
+
if (params.attribute) {
|
|
4406
|
+
const {
|
|
4407
|
+
scaleX = 1,
|
|
4408
|
+
scaleY = 1
|
|
4409
|
+
} = params.attribute;
|
|
4410
|
+
w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY;
|
|
4411
|
+
}
|
|
4412
|
+
"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));
|
|
4413
|
+
}
|
|
4414
|
+
return result || "orange";
|
|
4415
|
+
}
|
|
4416
|
+
function createLinearGradient(context, color, x, y, w, h) {
|
|
4417
|
+
var _a, _b, _c, _d;
|
|
4418
|
+
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);
|
|
4419
|
+
return color.stops.forEach(stop => {
|
|
4420
|
+
canvasGradient.addColorStop(stop.offset, stop.color);
|
|
4421
|
+
}), canvasGradient;
|
|
4422
|
+
}
|
|
4423
|
+
function createRadialGradient(context, color, x, y, w, h) {
|
|
4424
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4425
|
+
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));
|
|
4426
|
+
return color.stops.forEach(stop => {
|
|
4427
|
+
canvasGradient.addColorStop(stop.offset, stop.color);
|
|
4428
|
+
}), canvasGradient;
|
|
4429
|
+
}
|
|
4430
|
+
function createConicGradient(context, color, x, y, w, h) {
|
|
4431
|
+
var _a, _b;
|
|
4432
|
+
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);
|
|
4433
|
+
return color.stops.forEach(stop => {
|
|
4434
|
+
canvasGradient.addColorStop(stop.offset, stop.color);
|
|
4435
|
+
}), canvasGradient.GetPattern(w + x, h + y, undefined);
|
|
4436
|
+
}
|
|
4437
|
+
|
|
4146
4438
|
const DIRECTION_KEY = {
|
|
4147
4439
|
horizontal: {
|
|
4148
4440
|
width: "width",
|
|
@@ -4194,14 +4486,16 @@ const setTextStyle = (ctx, character) => {
|
|
|
4194
4486
|
fontFamily: character.fontFamily || "sans-serif"
|
|
4195
4487
|
});
|
|
4196
4488
|
};
|
|
4197
|
-
function applyFillStyle(ctx, character) {
|
|
4489
|
+
function applyFillStyle(ctx, character, b) {
|
|
4198
4490
|
const fillStyle = character && character.fill || defaultFormatting.fill;
|
|
4199
4491
|
if (!fillStyle) return void (ctx.globalAlpha = 0);
|
|
4200
4492
|
const {
|
|
4201
4493
|
fillOpacity = 1,
|
|
4202
4494
|
opacity = 1
|
|
4203
4495
|
} = character;
|
|
4204
|
-
ctx.globalAlpha = fillOpacity * opacity, ctx.fillStyle =
|
|
4496
|
+
ctx.globalAlpha = fillOpacity * opacity, ctx.fillStyle = b ? createColor(ctx, fillStyle, {
|
|
4497
|
+
AABBBounds: b
|
|
4498
|
+
}) : fillStyle, setTextStyle(ctx, character);
|
|
4205
4499
|
}
|
|
4206
4500
|
function applyStrokeStyle(ctx, character) {
|
|
4207
4501
|
const strokeStyle = character && character.stroke || defaultFormatting.stroke;
|
|
@@ -11113,697 +11407,411 @@ class DefaultMatrixAllocate {
|
|
|
11113
11407
|
allocate(a, b, c, d, e, f) {
|
|
11114
11408
|
if (!this.pools.length) return new Matrix(a, b, c, d, e, f);
|
|
11115
11409
|
const m = this.pools.pop();
|
|
11116
|
-
return m.a = a, m.b = b, m.c = c, m.d = d, m.e = e, m.f = f, m;
|
|
11117
|
-
}
|
|
11118
|
-
allocateByObj(matrix) {
|
|
11119
|
-
if (!this.pools.length) return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
|
|
11120
|
-
const m = this.pools.pop();
|
|
11121
|
-
return m.a = matrix.a, m.b = matrix.b, m.c = matrix.c, m.d = matrix.d, m.e = matrix.e, m.f = matrix.f, m;
|
|
11122
|
-
}
|
|
11123
|
-
free(d) {
|
|
11124
|
-
this.pools.push(d);
|
|
11125
|
-
}
|
|
11126
|
-
get length() {
|
|
11127
|
-
return this.pools.length;
|
|
11128
|
-
}
|
|
11129
|
-
release() {
|
|
11130
|
-
this.pools = [];
|
|
11131
|
-
}
|
|
11132
|
-
}
|
|
11133
|
-
class DefaultMat4Allocate {
|
|
11134
|
-
constructor() {
|
|
11135
|
-
this.pools = [];
|
|
11136
|
-
}
|
|
11137
|
-
static identity(out) {
|
|
11138
|
-
return identityMat4(out);
|
|
11139
|
-
}
|
|
11140
|
-
allocate() {
|
|
11141
|
-
if (!this.pools.length) return createMat4();
|
|
11142
|
-
const m = this.pools.pop();
|
|
11143
|
-
return DefaultMat4Allocate.identity(m), m;
|
|
11144
|
-
}
|
|
11145
|
-
allocateByObj(d) {
|
|
11146
|
-
let m;
|
|
11147
|
-
m = this.pools.length ? this.pools.pop() : createMat4();
|
|
11148
|
-
for (let i = 0; i < m.length; i++) m[i] = d[i];
|
|
11149
|
-
return m;
|
|
11150
|
-
}
|
|
11151
|
-
free(m) {
|
|
11152
|
-
m && this.pools.push(m);
|
|
11153
|
-
}
|
|
11154
|
-
get length() {
|
|
11155
|
-
return this.pools.length;
|
|
11156
|
-
}
|
|
11157
|
-
release() {
|
|
11158
|
-
this.pools = [];
|
|
11159
|
-
}
|
|
11160
|
-
}
|
|
11161
|
-
const matrixAllocate = new DefaultMatrixAllocate();
|
|
11162
|
-
const mat4Allocate = new DefaultMat4Allocate();
|
|
11163
|
-
|
|
11164
|
-
var __decorate$1B = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
11165
|
-
var d,
|
|
11166
|
-
c = arguments.length,
|
|
11167
|
-
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
11168
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
11169
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11170
|
-
},
|
|
11171
|
-
__metadata$1d = undefined && undefined.__metadata || function (k, v) {
|
|
11172
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
11173
|
-
},
|
|
11174
|
-
__param$R = undefined && undefined.__param || function (paramIndex, decorator) {
|
|
11175
|
-
return function (target, key) {
|
|
11176
|
-
decorator(target, key, paramIndex);
|
|
11177
|
-
};
|
|
11178
|
-
};
|
|
11179
|
-
function getExtraModelMatrix(dx, dy, graphic) {
|
|
11180
|
-
const {
|
|
11181
|
-
alpha: alpha,
|
|
11182
|
-
beta: beta
|
|
11183
|
-
} = graphic.attribute;
|
|
11184
|
-
if (!alpha && !beta) return null;
|
|
11185
|
-
const {
|
|
11186
|
-
anchor3d = graphic.attribute.anchor
|
|
11187
|
-
} = graphic.attribute,
|
|
11188
|
-
_anchor = [0, 0];
|
|
11189
|
-
if (anchor3d) {
|
|
11190
|
-
if ("string" == typeof anchor3d[0]) {
|
|
11191
|
-
const ratio = parseFloat(anchor3d[0]) / 100,
|
|
11192
|
-
bounds = graphic.AABBBounds;
|
|
11193
|
-
_anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11194
|
-
} else _anchor[0] = anchor3d[0];
|
|
11195
|
-
if ("string" == typeof anchor3d[1]) {
|
|
11196
|
-
const ratio = parseFloat(anchor3d[1]) / 100,
|
|
11197
|
-
bounds = graphic.AABBBounds;
|
|
11198
|
-
_anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11199
|
-
} else _anchor[1] = anchor3d[1];
|
|
11200
|
-
}
|
|
11201
|
-
if ("text" === graphic.type) {
|
|
11202
|
-
const {
|
|
11203
|
-
textAlign: textAlign
|
|
11204
|
-
} = graphic.attribute;
|
|
11205
|
-
_anchor[0] += textDrawOffsetX(textAlign, graphic.clipedWidth);
|
|
11206
|
-
}
|
|
11207
|
-
_anchor[0] += dx, _anchor[1] += dy;
|
|
11208
|
-
const modelMatrix = mat4Allocate.allocate();
|
|
11209
|
-
return translate(modelMatrix, modelMatrix, [_anchor[0], _anchor[1], 0]), beta && rotateX(modelMatrix, modelMatrix, beta), alpha && rotateY(modelMatrix, modelMatrix, alpha), translate(modelMatrix, modelMatrix, [-_anchor[0], -_anchor[1], 0]), modelMatrix;
|
|
11210
|
-
}
|
|
11211
|
-
function getModelMatrix(out, graphic, theme) {
|
|
11212
|
-
var _a;
|
|
11213
|
-
const {
|
|
11214
|
-
x = theme.x,
|
|
11215
|
-
y = theme.y,
|
|
11216
|
-
z = theme.z,
|
|
11217
|
-
dx = theme.dx,
|
|
11218
|
-
dy = theme.dy,
|
|
11219
|
-
dz = theme.dz,
|
|
11220
|
-
scaleX = theme.scaleX,
|
|
11221
|
-
scaleY = theme.scaleY,
|
|
11222
|
-
scaleZ = theme.scaleZ,
|
|
11223
|
-
alpha = theme.alpha,
|
|
11224
|
-
beta = theme.beta,
|
|
11225
|
-
angle = theme.angle,
|
|
11226
|
-
anchor3d = graphic.attribute.anchor,
|
|
11227
|
-
anchor: anchor
|
|
11228
|
-
} = graphic.attribute,
|
|
11229
|
-
_anchor = [0, 0, 0];
|
|
11230
|
-
if (anchor3d) {
|
|
11231
|
-
if ("string" == typeof anchor3d[0]) {
|
|
11232
|
-
const ratio = parseFloat(anchor3d[0]) / 100,
|
|
11233
|
-
bounds = graphic.AABBBounds;
|
|
11234
|
-
_anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11235
|
-
} else _anchor[0] = anchor3d[0];
|
|
11236
|
-
if ("string" == typeof anchor3d[1]) {
|
|
11237
|
-
const ratio = parseFloat(anchor3d[1]) / 100,
|
|
11238
|
-
bounds = graphic.AABBBounds;
|
|
11239
|
-
_anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11240
|
-
} else _anchor[1] = anchor3d[1];
|
|
11241
|
-
_anchor[2] = null !== (_a = anchor3d[2]) && void 0 !== _a ? _a : 0;
|
|
11242
|
-
}
|
|
11243
|
-
if (identityMat4(out), translate(out, out, [x + dx, y + dy, z + dz]), translate(out, out, [_anchor[0], _anchor[1], _anchor[2]]), rotateX(out, out, beta), rotateY(out, out, alpha), translate(out, out, [-_anchor[0], -_anchor[1], _anchor[2]]), scaleMat4(out, out, [scaleX, scaleY, scaleZ]), angle) {
|
|
11244
|
-
const m = mat4Allocate.allocate(),
|
|
11245
|
-
_anchor = [0, 0];
|
|
11246
|
-
if (anchor) {
|
|
11247
|
-
if ("string" == typeof anchor3d[0]) {
|
|
11248
|
-
const ratio = parseFloat(anchor3d[0]) / 100,
|
|
11249
|
-
bounds = graphic.AABBBounds;
|
|
11250
|
-
_anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11251
|
-
} else _anchor[0] = anchor3d[0];
|
|
11252
|
-
if ("string" == typeof anchor3d[1]) {
|
|
11253
|
-
const ratio = parseFloat(anchor3d[1]) / 100,
|
|
11254
|
-
bounds = graphic.AABBBounds;
|
|
11255
|
-
_anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11256
|
-
} else _anchor[1] = anchor3d[1];
|
|
11257
|
-
}
|
|
11258
|
-
translate(m, m, [_anchor[0], _anchor[1], 0]), rotateZ(m, m, angle), translate(m, m, [-_anchor[0], -_anchor[1], 0]), multiplyMat4Mat4(out, out, m);
|
|
11259
|
-
}
|
|
11260
|
-
}
|
|
11261
|
-
function shouldUseMat4(graphic) {
|
|
11262
|
-
const {
|
|
11263
|
-
alpha: alpha,
|
|
11264
|
-
beta: beta
|
|
11265
|
-
} = graphic.attribute;
|
|
11266
|
-
return alpha || beta;
|
|
11267
|
-
}
|
|
11268
|
-
let DefaultGraphicService = class {
|
|
11269
|
-
constructor(creator) {
|
|
11270
|
-
this.creator = creator, this.hooks = {
|
|
11271
|
-
onAttributeUpdate: new SyncHook(["graphic"]),
|
|
11272
|
-
onSetStage: new SyncHook(["graphic", "stage"]),
|
|
11273
|
-
onRemove: new SyncHook(["graphic"]),
|
|
11274
|
-
onRelease: new SyncHook(["graphic"]),
|
|
11275
|
-
onAddIncremental: new SyncHook(["graphic", "group", "stage"]),
|
|
11276
|
-
onClearIncremental: new SyncHook(["graphic", "group", "stage"]),
|
|
11277
|
-
beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
|
|
11278
|
-
afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"])
|
|
11279
|
-
}, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds();
|
|
11280
|
-
}
|
|
11281
|
-
onAttributeUpdate(graphic) {
|
|
11282
|
-
this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
|
|
11283
|
-
}
|
|
11284
|
-
onSetStage(graphic, stage) {
|
|
11285
|
-
this.hooks.onSetStage.taps.length && this.hooks.onSetStage.call(graphic, stage);
|
|
11286
|
-
}
|
|
11287
|
-
onRemove(graphic) {
|
|
11288
|
-
this.hooks.onRemove.taps.length && this.hooks.onRemove.call(graphic);
|
|
11289
|
-
}
|
|
11290
|
-
onRelease(graphic) {
|
|
11291
|
-
this.hooks.onRelease.taps.length && this.hooks.onRelease.call(graphic);
|
|
11292
|
-
}
|
|
11293
|
-
onAddIncremental(graphic, group, stage) {
|
|
11294
|
-
this.hooks.onAddIncremental.taps.length && this.hooks.onAddIncremental.call(graphic, group, stage);
|
|
11295
|
-
}
|
|
11296
|
-
onClearIncremental(group, stage) {
|
|
11297
|
-
this.hooks.onClearIncremental.taps.length && this.hooks.onClearIncremental.call(group, stage);
|
|
11298
|
-
}
|
|
11299
|
-
beforeUpdateAABBBounds(graphic, stage, willUpdate, bounds) {
|
|
11300
|
-
this.hooks.beforeUpdateAABBBounds.taps.length && this.hooks.beforeUpdateAABBBounds.call(graphic, stage, willUpdate, bounds);
|
|
11301
|
-
}
|
|
11302
|
-
afterUpdateAABBBounds(graphic, stage, bounds, params, selfChange) {
|
|
11303
|
-
this.hooks.afterUpdateAABBBounds.taps.length && this.hooks.afterUpdateAABBBounds.call(graphic, stage, bounds, params, selfChange);
|
|
11304
|
-
}
|
|
11305
|
-
updatePathProxyAABBBounds(aabbBounds, graphic) {
|
|
11306
|
-
const path = "function" == typeof graphic.pathProxy ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;
|
|
11307
|
-
if (!path) return !1;
|
|
11308
|
-
const boundsContext = new BoundsContext(aabbBounds);
|
|
11309
|
-
return renderCommandList(path.commandList, boundsContext, 0, 0), !0;
|
|
11310
|
-
}
|
|
11311
|
-
updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
|
|
11312
|
-
const {
|
|
11313
|
-
textAlign: textAlign,
|
|
11314
|
-
textBaseline: textBaseline
|
|
11315
|
-
} = attribute;
|
|
11316
|
-
if (null != attribute.forceBoundsHeight) {
|
|
11317
|
-
const h = isNumber$1(attribute.forceBoundsHeight) ? attribute.forceBoundsHeight : attribute.forceBoundsHeight(),
|
|
11318
|
-
dy = textLayoutOffsetY(textBaseline, h, h);
|
|
11319
|
-
aabbBounds.set(aabbBounds.x1, dy, aabbBounds.x2, dy + h);
|
|
11320
|
-
}
|
|
11321
|
-
if (null != attribute.forceBoundsWidth) {
|
|
11322
|
-
const w = isNumber$1(attribute.forceBoundsWidth) ? attribute.forceBoundsWidth : attribute.forceBoundsWidth(),
|
|
11323
|
-
dx = textDrawOffsetX(textAlign, w);
|
|
11324
|
-
aabbBounds.set(dx, aabbBounds.y1, dx + w, aabbBounds.y2);
|
|
11325
|
-
}
|
|
11326
|
-
}
|
|
11327
|
-
combindShadowAABBBounds(bounds, graphic) {
|
|
11328
|
-
if (graphic && graphic.shadowRoot) {
|
|
11329
|
-
const b = graphic.shadowRoot.AABBBounds;
|
|
11330
|
-
bounds.union(b);
|
|
11331
|
-
}
|
|
11332
|
-
}
|
|
11333
|
-
transformAABBBounds(attribute, aabbBounds, theme, miter, graphic) {
|
|
11334
|
-
if (!aabbBounds.empty()) {
|
|
11335
|
-
const {
|
|
11336
|
-
scaleX = theme.scaleX,
|
|
11337
|
-
scaleY = theme.scaleY,
|
|
11338
|
-
stroke = theme.stroke,
|
|
11339
|
-
shadowBlur = theme.shadowBlur,
|
|
11340
|
-
lineWidth = theme.lineWidth,
|
|
11341
|
-
pickStrokeBuffer = theme.pickStrokeBuffer,
|
|
11342
|
-
strokeBoundsBuffer = theme.strokeBoundsBuffer
|
|
11343
|
-
} = attribute,
|
|
11344
|
-
tb1 = this.tempAABBBounds1,
|
|
11345
|
-
tb2 = this.tempAABBBounds2;
|
|
11346
|
-
if (stroke && lineWidth) {
|
|
11347
|
-
const scaledHalfLineWidth = (lineWidth + pickStrokeBuffer) / Math.abs(scaleX + scaleY);
|
|
11348
|
-
boundStroke(tb1, scaledHalfLineWidth, miter, strokeBoundsBuffer), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
11349
|
-
}
|
|
11350
|
-
if (shadowBlur) {
|
|
11351
|
-
const {
|
|
11352
|
-
shadowOffsetX = theme.shadowOffsetX,
|
|
11353
|
-
shadowOffsetY = theme.shadowOffsetY
|
|
11354
|
-
} = attribute,
|
|
11355
|
-
shadowBlurWidth = shadowBlur / Math.abs(scaleX + scaleY) * 2;
|
|
11356
|
-
boundStroke(tb1, shadowBlurWidth, !1, strokeBoundsBuffer + 1), tb1.translate(shadowOffsetX, shadowOffsetY), aabbBounds.union(tb1);
|
|
11357
|
-
}
|
|
11358
|
-
}
|
|
11359
|
-
if (this.combindShadowAABBBounds(aabbBounds, graphic), aabbBounds.empty()) return;
|
|
11360
|
-
let updateMatrix = !0;
|
|
11361
|
-
const m = graphic.transMatrix;
|
|
11362
|
-
graphic && graphic.isContainer && (updateMatrix = !(1 === m.a && 0 === m.b && 0 === m.c && 1 === m.d && 0 === m.e && 0 === m.f)), updateMatrix && transformBoundsWithMatrix(aabbBounds, aabbBounds, m);
|
|
11410
|
+
return m.a = a, m.b = b, m.c = c, m.d = d, m.e = e, m.f = f, m;
|
|
11363
11411
|
}
|
|
11364
|
-
|
|
11365
|
-
if (!
|
|
11366
|
-
|
|
11367
|
-
|
|
11368
|
-
if (!graphic.valid) return aabbBounds.clear(), !1;
|
|
11369
|
-
const {
|
|
11370
|
-
visible = theme.visible
|
|
11371
|
-
} = attribute;
|
|
11372
|
-
return !!visible || (aabbBounds.clear(), !1);
|
|
11412
|
+
allocateByObj(matrix) {
|
|
11413
|
+
if (!this.pools.length) return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
|
|
11414
|
+
const m = this.pools.pop();
|
|
11415
|
+
return m.a = matrix.a, m.b = matrix.b, m.c = matrix.c, m.d = matrix.d, m.e = matrix.e, m.f = matrix.f, m;
|
|
11373
11416
|
}
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
tb2 = this.tempAABBBounds2;
|
|
11377
|
-
return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), {
|
|
11378
|
-
tb1: tb1,
|
|
11379
|
-
tb2: tb2
|
|
11380
|
-
};
|
|
11417
|
+
free(d) {
|
|
11418
|
+
this.pools.push(d);
|
|
11381
11419
|
}
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
const result = {
|
|
11386
|
-
x: 0,
|
|
11387
|
-
y: 0,
|
|
11388
|
-
z: 0,
|
|
11389
|
-
lastModelMatrix: null
|
|
11390
|
-
};
|
|
11391
|
-
class BaseRender {
|
|
11392
|
-
init(contributions) {
|
|
11393
|
-
contributions && (this._renderContribitions = contributions.getContributions()), this._renderContribitions || (this._renderContribitions = []), this.builtinContributions && this.builtinContributions.forEach(item => this._renderContribitions.push(item)), this._renderContribitions.length && (this._renderContribitions.sort((a, b) => b.order - a.order), this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke));
|
|
11420
|
+
get length() {
|
|
11421
|
+
return this.pools.length;
|
|
11394
11422
|
}
|
|
11395
|
-
|
|
11396
|
-
this.
|
|
11397
|
-
if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
|
|
11398
|
-
if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
|
|
11399
|
-
}
|
|
11400
|
-
c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
|
|
11401
|
-
});
|
|
11423
|
+
release() {
|
|
11424
|
+
this.pools = [];
|
|
11402
11425
|
}
|
|
11403
|
-
|
|
11404
|
-
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
}
|
|
11408
|
-
c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
|
|
11409
|
-
});
|
|
11426
|
+
}
|
|
11427
|
+
class DefaultMat4Allocate {
|
|
11428
|
+
constructor() {
|
|
11429
|
+
this.pools = [];
|
|
11410
11430
|
}
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
fill = defaultAttribute.fill,
|
|
11414
|
-
background: background,
|
|
11415
|
-
stroke = defaultAttribute.stroke,
|
|
11416
|
-
opacity = defaultAttribute.opacity,
|
|
11417
|
-
fillOpacity = defaultAttribute.fillOpacity,
|
|
11418
|
-
lineWidth = defaultAttribute.lineWidth,
|
|
11419
|
-
strokeOpacity = defaultAttribute.strokeOpacity,
|
|
11420
|
-
visible = defaultAttribute.visible
|
|
11421
|
-
} = graphic.attribute,
|
|
11422
|
-
fVisible = fillVisible(opacity, fillOpacity, fill),
|
|
11423
|
-
sVisible = strokeVisible(opacity, strokeOpacity),
|
|
11424
|
-
doFill = runFill(fill, background),
|
|
11425
|
-
doStroke = runStroke(stroke, lineWidth);
|
|
11426
|
-
return !(!graphic.valid || !visible) && !(!doFill && !doStroke) && !!(fVisible || sVisible || fillCb || strokeCb || background) && {
|
|
11427
|
-
fVisible: fVisible,
|
|
11428
|
-
sVisible: sVisible,
|
|
11429
|
-
doFill: doFill,
|
|
11430
|
-
doStroke: doStroke
|
|
11431
|
-
};
|
|
11431
|
+
static identity(out) {
|
|
11432
|
+
return identityMat4(out);
|
|
11432
11433
|
}
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
const
|
|
11436
|
-
|
|
11437
|
-
y = graphicAttribute.y,
|
|
11438
|
-
z = graphicAttribute.z,
|
|
11439
|
-
scaleX = graphicAttribute.scaleX,
|
|
11440
|
-
scaleY = graphicAttribute.scaleY,
|
|
11441
|
-
angle = graphicAttribute.angle,
|
|
11442
|
-
postMatrix: postMatrix
|
|
11443
|
-
} = graphic.attribute,
|
|
11444
|
-
lastModelMatrix = context.modelMatrix,
|
|
11445
|
-
camera = context.camera;
|
|
11446
|
-
result.x = x, result.y = y, result.z = z, result.lastModelMatrix = lastModelMatrix;
|
|
11447
|
-
const shouldTransform3d = camera && (use3dMatrixIn3dMode || shouldUseMat4(graphic)),
|
|
11448
|
-
onlyTranslate = shouldTransform3d ? graphic.transMatrix.onlyTranslate() && !postMatrix : 1 === scaleX && 1 === scaleY && 0 === angle && !postMatrix;
|
|
11449
|
-
if (shouldTransform3d) {
|
|
11450
|
-
const nextModelMatrix = mat4Allocate.allocate(),
|
|
11451
|
-
modelMatrix = mat4Allocate.allocate();
|
|
11452
|
-
getModelMatrix(modelMatrix, graphic, graphicAttribute), multiplyMat4Mat4(nextModelMatrix, lastModelMatrix || nextModelMatrix, modelMatrix), result.x = 0, result.y = 0, result.z = 0, context.modelMatrix = nextModelMatrix, context.setTransform(1, 0, 0, 1, 0, 0, !0), mat4Allocate.free(modelMatrix);
|
|
11453
|
-
}
|
|
11454
|
-
if (onlyTranslate && !lastModelMatrix) {
|
|
11455
|
-
const point = graphic.getOffsetXY(graphicAttribute);
|
|
11456
|
-
result.x += point.x, result.y += point.y, result.z = z, context.setTransformForCurrent();
|
|
11457
|
-
} else if (shouldTransform3d) result.x = 0, result.y = 0, result.z = 0, context.setTransform(1, 0, 0, 1, 0, 0, !0);else if (camera && context.project) {
|
|
11458
|
-
const point = graphic.getOffsetXY(graphicAttribute);
|
|
11459
|
-
result.x += point.x, result.y += point.y, this.transformWithoutTranslate(context, result.x, result.y, result.z, scaleX, scaleY, angle);
|
|
11460
|
-
} else context.transformFromMatrix(graphic.transMatrix, !0), result.x = 0, result.y = 0, result.z = 0;
|
|
11461
|
-
return result;
|
|
11434
|
+
allocate() {
|
|
11435
|
+
if (!this.pools.length) return createMat4();
|
|
11436
|
+
const m = this.pools.pop();
|
|
11437
|
+
return DefaultMat4Allocate.identity(m), m;
|
|
11462
11438
|
}
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
height = bounds.y2 - bounds.y1,
|
|
11469
|
-
p1 = context.project(0, 0, z),
|
|
11470
|
-
p2 = context.project(width, 0, z),
|
|
11471
|
-
p3 = context.project(width, height, z),
|
|
11472
|
-
_p1 = {
|
|
11473
|
-
x: 0,
|
|
11474
|
-
y: 0
|
|
11475
|
-
},
|
|
11476
|
-
_p2 = {
|
|
11477
|
-
x: width,
|
|
11478
|
-
y: 0
|
|
11479
|
-
},
|
|
11480
|
-
_p3 = {
|
|
11481
|
-
x: width,
|
|
11482
|
-
y: height
|
|
11483
|
-
};
|
|
11484
|
-
context.camera = null;
|
|
11485
|
-
const denom = 1 / (_p1.x * (_p3.y - _p2.y) - _p2.x * _p3.y + _p3.x * _p2.y + (_p2.x - _p3.x) * _p1.y),
|
|
11486
|
-
m11 = -(_p1.y * (p3.x - p2.x) - _p2.y * p3.x + _p3.y * p2.x + (_p2.y - _p3.y) * p1.x) * denom,
|
|
11487
|
-
m12 = (_p2.y * p3.y + _p1.y * (p2.y - p3.y) - _p3.y * p2.y + (_p3.y - _p2.y) * p1.y) * denom,
|
|
11488
|
-
m21 = (_p1.x * (p3.x - p2.x) - _p2.x * p3.x + _p3.x * p2.x + (_p2.x - _p3.x) * p1.x) * denom,
|
|
11489
|
-
m22 = -(_p2.x * p3.y + _p1.x * (p2.y - p3.y) - _p3.x * p2.y + (_p3.x - _p2.x) * p1.y) * denom,
|
|
11490
|
-
dx = (_p1.x * (_p3.y * p2.x - _p2.y * p3.x) + _p1.y * (_p2.x * p3.x - _p3.x * p2.x) + (_p3.x * _p2.y - _p2.x * _p3.y) * p1.x) * denom,
|
|
11491
|
-
dy = (_p1.x * (_p3.y * p2.y - _p2.y * p3.y) + _p1.y * (_p2.x * p3.y - _p3.x * p2.y) + (_p3.x * _p2.y - _p2.x * _p3.y) * p1.y) * denom;
|
|
11492
|
-
context.setTransform(m11, m12, m21, m22, dx, dy, !0);
|
|
11493
|
-
}
|
|
11439
|
+
allocateByObj(d) {
|
|
11440
|
+
let m;
|
|
11441
|
+
m = this.pools.length ? this.pools.pop() : createMat4();
|
|
11442
|
+
for (let i = 0; i < m.length; i++) m[i] = d[i];
|
|
11443
|
+
return m;
|
|
11494
11444
|
}
|
|
11495
|
-
|
|
11496
|
-
|
|
11445
|
+
free(m) {
|
|
11446
|
+
m && this.pools.push(m);
|
|
11497
11447
|
}
|
|
11498
|
-
|
|
11499
|
-
|
|
11500
|
-
context.translate(p.x, p.y, !1), context.scale(scaleX, scaleY, !1), context.rotate(angle, !1), context.translate(-p.x, -p.y, !1), context.setTransformForCurrent();
|
|
11448
|
+
get length() {
|
|
11449
|
+
return this.pools.length;
|
|
11501
11450
|
}
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11451
|
+
release() {
|
|
11452
|
+
this.pools = [];
|
|
11453
|
+
}
|
|
11454
|
+
}
|
|
11455
|
+
const matrixAllocate = new DefaultMatrixAllocate();
|
|
11456
|
+
const mat4Allocate = new DefaultMat4Allocate();
|
|
11457
|
+
|
|
11458
|
+
var __decorate$1B = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
11459
|
+
var d,
|
|
11460
|
+
c = arguments.length,
|
|
11461
|
+
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
11462
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
11463
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11464
|
+
},
|
|
11465
|
+
__metadata$1d = undefined && undefined.__metadata || function (k, v) {
|
|
11466
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
11467
|
+
},
|
|
11468
|
+
__param$R = undefined && undefined.__param || function (paramIndex, decorator) {
|
|
11469
|
+
return function (target, key) {
|
|
11470
|
+
decorator(target, key, paramIndex);
|
|
11471
|
+
};
|
|
11472
|
+
};
|
|
11473
|
+
function getExtraModelMatrix(dx, dy, graphic) {
|
|
11474
|
+
const {
|
|
11475
|
+
alpha: alpha,
|
|
11476
|
+
beta: beta
|
|
11477
|
+
} = graphic.attribute;
|
|
11478
|
+
if (!alpha && !beta) return null;
|
|
11479
|
+
const {
|
|
11480
|
+
anchor3d = graphic.attribute.anchor
|
|
11481
|
+
} = graphic.attribute,
|
|
11482
|
+
_anchor = [0, 0];
|
|
11483
|
+
if (anchor3d) {
|
|
11484
|
+
if ("string" == typeof anchor3d[0]) {
|
|
11485
|
+
const ratio = parseFloat(anchor3d[0]) / 100,
|
|
11486
|
+
bounds = graphic.AABBBounds;
|
|
11487
|
+
_anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11488
|
+
} else _anchor[0] = anchor3d[0];
|
|
11489
|
+
if ("string" == typeof anchor3d[1]) {
|
|
11490
|
+
const ratio = parseFloat(anchor3d[1]) / 100,
|
|
11491
|
+
bounds = graphic.AABBBounds;
|
|
11492
|
+
_anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11493
|
+
} else _anchor[1] = anchor3d[1];
|
|
11494
|
+
}
|
|
11495
|
+
if ("text" === graphic.type) {
|
|
11507
11496
|
const {
|
|
11508
|
-
|
|
11497
|
+
textAlign: textAlign
|
|
11509
11498
|
} = graphic.attribute;
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11499
|
+
_anchor[0] += textDrawOffsetX(textAlign, graphic.clipedWidth);
|
|
11500
|
+
}
|
|
11501
|
+
_anchor[0] += dx, _anchor[1] += dy;
|
|
11502
|
+
const modelMatrix = mat4Allocate.allocate();
|
|
11503
|
+
return translate(modelMatrix, modelMatrix, [_anchor[0], _anchor[1], 0]), beta && rotateX(modelMatrix, modelMatrix, beta), alpha && rotateY(modelMatrix, modelMatrix, alpha), translate(modelMatrix, modelMatrix, [-_anchor[0], -_anchor[1], 0]), modelMatrix;
|
|
11504
|
+
}
|
|
11505
|
+
function getModelMatrix(out, graphic, theme) {
|
|
11506
|
+
var _a;
|
|
11507
|
+
const {
|
|
11508
|
+
x = theme.x,
|
|
11509
|
+
y = theme.y,
|
|
11510
|
+
z = theme.z,
|
|
11511
|
+
dx = theme.dx,
|
|
11512
|
+
dy = theme.dy,
|
|
11513
|
+
dz = theme.dz,
|
|
11514
|
+
scaleX = theme.scaleX,
|
|
11515
|
+
scaleY = theme.scaleY,
|
|
11516
|
+
scaleZ = theme.scaleZ,
|
|
11517
|
+
alpha = theme.alpha,
|
|
11518
|
+
beta = theme.beta,
|
|
11519
|
+
angle = theme.angle,
|
|
11520
|
+
anchor3d = graphic.attribute.anchor,
|
|
11521
|
+
anchor: anchor
|
|
11522
|
+
} = graphic.attribute,
|
|
11523
|
+
_anchor = [0, 0, 0];
|
|
11524
|
+
if (anchor3d) {
|
|
11525
|
+
if ("string" == typeof anchor3d[0]) {
|
|
11526
|
+
const ratio = parseFloat(anchor3d[0]) / 100,
|
|
11527
|
+
bounds = graphic.AABBBounds;
|
|
11528
|
+
_anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11529
|
+
} else _anchor[0] = anchor3d[0];
|
|
11530
|
+
if ("string" == typeof anchor3d[1]) {
|
|
11531
|
+
const ratio = parseFloat(anchor3d[1]) / 100,
|
|
11532
|
+
bounds = graphic.AABBBounds;
|
|
11533
|
+
_anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11534
|
+
} else _anchor[1] = anchor3d[1];
|
|
11535
|
+
_anchor[2] = null !== (_a = anchor3d[2]) && void 0 !== _a ? _a : 0;
|
|
11520
11536
|
}
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
endCall: /^\)/,
|
|
11538
|
-
comma: /^,/,
|
|
11539
|
-
hexColor: /(^\#[0-9a-fA-F]+)/,
|
|
11540
|
-
literalColor: /^([a-zA-Z]+)/,
|
|
11541
|
-
rgbColor: /^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,
|
|
11542
|
-
rgbaColor: /^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,
|
|
11543
|
-
number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
|
|
11544
|
-
};
|
|
11545
|
-
let input = "";
|
|
11546
|
-
function error(msg) {
|
|
11547
|
-
const err = new Error(input + ": " + msg);
|
|
11548
|
-
throw err.source = input, err;
|
|
11537
|
+
if (identityMat4(out), translate(out, out, [x + dx, y + dy, z + dz]), translate(out, out, [_anchor[0], _anchor[1], _anchor[2]]), rotateX(out, out, beta), rotateY(out, out, alpha), translate(out, out, [-_anchor[0], -_anchor[1], _anchor[2]]), scaleMat4(out, out, [scaleX, scaleY, scaleZ]), angle) {
|
|
11538
|
+
const m = mat4Allocate.allocate(),
|
|
11539
|
+
_anchor = [0, 0];
|
|
11540
|
+
if (anchor) {
|
|
11541
|
+
if ("string" == typeof anchor3d[0]) {
|
|
11542
|
+
const ratio = parseFloat(anchor3d[0]) / 100,
|
|
11543
|
+
bounds = graphic.AABBBounds;
|
|
11544
|
+
_anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11545
|
+
} else _anchor[0] = anchor3d[0];
|
|
11546
|
+
if ("string" == typeof anchor3d[1]) {
|
|
11547
|
+
const ratio = parseFloat(anchor3d[1]) / 100,
|
|
11548
|
+
bounds = graphic.AABBBounds;
|
|
11549
|
+
_anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11550
|
+
} else _anchor[1] = anchor3d[1];
|
|
11551
|
+
}
|
|
11552
|
+
translate(m, m, [_anchor[0], _anchor[1], 0]), rotateZ(m, m, angle), translate(m, m, [-_anchor[0], -_anchor[1], 0]), multiplyMat4Mat4(out, out, m);
|
|
11549
11553
|
}
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11554
|
+
}
|
|
11555
|
+
function shouldUseMat4(graphic) {
|
|
11556
|
+
const {
|
|
11557
|
+
alpha: alpha,
|
|
11558
|
+
beta: beta
|
|
11559
|
+
} = graphic.attribute;
|
|
11560
|
+
return alpha || beta;
|
|
11561
|
+
}
|
|
11562
|
+
let DefaultGraphicService = class {
|
|
11563
|
+
constructor(creator) {
|
|
11564
|
+
this.creator = creator, this.hooks = {
|
|
11565
|
+
onAttributeUpdate: new SyncHook(["graphic"]),
|
|
11566
|
+
onSetStage: new SyncHook(["graphic", "stage"]),
|
|
11567
|
+
onRemove: new SyncHook(["graphic"]),
|
|
11568
|
+
onRelease: new SyncHook(["graphic"]),
|
|
11569
|
+
onAddIncremental: new SyncHook(["graphic", "group", "stage"]),
|
|
11570
|
+
onClearIncremental: new SyncHook(["graphic", "group", "stage"]),
|
|
11571
|
+
beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
|
|
11572
|
+
afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"])
|
|
11573
|
+
}, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds();
|
|
11553
11574
|
}
|
|
11554
|
-
|
|
11555
|
-
|
|
11575
|
+
onAttributeUpdate(graphic) {
|
|
11576
|
+
this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
|
|
11556
11577
|
}
|
|
11557
|
-
|
|
11558
|
-
|
|
11559
|
-
const captures = scan(pattern);
|
|
11560
|
-
if (captures) {
|
|
11561
|
-
scan(tokens.startCall) || error("Missing (");
|
|
11562
|
-
const result = callback(captures);
|
|
11563
|
-
return scan(tokens.endCall) || error("Missing )"), result;
|
|
11564
|
-
}
|
|
11565
|
-
}(pattern, function (captures) {
|
|
11566
|
-
const orientation = orientationMatcher();
|
|
11567
|
-
return orientation && (scan(tokens.comma) || error("Missing comma before color stops")), {
|
|
11568
|
-
type: gradientType,
|
|
11569
|
-
orientation: orientation,
|
|
11570
|
-
colorStops: matchListing(matchColorStop)
|
|
11571
|
-
};
|
|
11572
|
-
});
|
|
11578
|
+
onSetStage(graphic, stage) {
|
|
11579
|
+
this.hooks.onSetStage.taps.length && this.hooks.onSetStage.call(graphic, stage);
|
|
11573
11580
|
}
|
|
11574
|
-
|
|
11575
|
-
|
|
11581
|
+
onRemove(graphic) {
|
|
11582
|
+
this.hooks.onRemove.taps.length && this.hooks.onRemove.call(graphic);
|
|
11576
11583
|
}
|
|
11577
|
-
|
|
11578
|
-
|
|
11584
|
+
onRelease(graphic) {
|
|
11585
|
+
this.hooks.onRelease.taps.length && this.hooks.onRelease.call(graphic);
|
|
11579
11586
|
}
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
lookaheadCache,
|
|
11583
|
-
radialOrientation = matchRadialOrientation();
|
|
11584
|
-
return radialOrientation && (radialOrientations = [], radialOrientations.push(radialOrientation), lookaheadCache = input, scan(tokens.comma) && (radialOrientation = matchRadialOrientation(), radialOrientation ? radialOrientations.push(radialOrientation) : input = lookaheadCache)), radialOrientations;
|
|
11587
|
+
onAddIncremental(graphic, group, stage) {
|
|
11588
|
+
this.hooks.onAddIncremental.taps.length && this.hooks.onAddIncremental.call(graphic, group, stage);
|
|
11585
11589
|
}
|
|
11586
|
-
|
|
11587
|
-
|
|
11588
|
-
const circle = match("shape", /^(circle)/i, 0);
|
|
11589
|
-
circle && (circle.style = matchLength() || matchExtentKeyword());
|
|
11590
|
-
return circle;
|
|
11591
|
-
}() || function () {
|
|
11592
|
-
const ellipse = match("shape", /^(ellipse)/i, 0);
|
|
11593
|
-
ellipse && (ellipse.style = matchDistance() || matchExtentKeyword());
|
|
11594
|
-
return ellipse;
|
|
11595
|
-
}();
|
|
11596
|
-
if (radialType) radialType.at = matchAtPosition();else {
|
|
11597
|
-
const extent = matchExtentKeyword();
|
|
11598
|
-
if (extent) {
|
|
11599
|
-
radialType = extent;
|
|
11600
|
-
const positionAt = matchAtPosition();
|
|
11601
|
-
positionAt && (radialType.at = positionAt);
|
|
11602
|
-
} else {
|
|
11603
|
-
const defaultPosition = matchPositioning();
|
|
11604
|
-
defaultPosition && (radialType = {
|
|
11605
|
-
type: "default-radial",
|
|
11606
|
-
at: defaultPosition
|
|
11607
|
-
});
|
|
11608
|
-
}
|
|
11609
|
-
}
|
|
11610
|
-
return radialType;
|
|
11590
|
+
onClearIncremental(group, stage) {
|
|
11591
|
+
this.hooks.onClearIncremental.taps.length && this.hooks.onClearIncremental.call(group, stage);
|
|
11611
11592
|
}
|
|
11612
|
-
|
|
11613
|
-
|
|
11593
|
+
beforeUpdateAABBBounds(graphic, stage, willUpdate, bounds) {
|
|
11594
|
+
this.hooks.beforeUpdateAABBBounds.taps.length && this.hooks.beforeUpdateAABBBounds.call(graphic, stage, willUpdate, bounds);
|
|
11614
11595
|
}
|
|
11615
|
-
|
|
11616
|
-
|
|
11617
|
-
const positioning = matchPositioning();
|
|
11618
|
-
return positioning || error("Missing positioning value"), positioning;
|
|
11619
|
-
}
|
|
11596
|
+
afterUpdateAABBBounds(graphic, stage, bounds, params, selfChange) {
|
|
11597
|
+
this.hooks.afterUpdateAABBBounds.taps.length && this.hooks.afterUpdateAABBBounds.call(graphic, stage, bounds, params, selfChange);
|
|
11620
11598
|
}
|
|
11621
|
-
|
|
11622
|
-
const
|
|
11623
|
-
|
|
11624
|
-
|
|
11625
|
-
|
|
11626
|
-
if (location.x || location.y) return {
|
|
11627
|
-
type: "position",
|
|
11628
|
-
value: location
|
|
11629
|
-
};
|
|
11599
|
+
updatePathProxyAABBBounds(aabbBounds, graphic) {
|
|
11600
|
+
const path = "function" == typeof graphic.pathProxy ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;
|
|
11601
|
+
if (!path) return !1;
|
|
11602
|
+
const boundsContext = new BoundsContext(aabbBounds);
|
|
11603
|
+
return renderCommandList(path.commandList, boundsContext, 0, 0), !0;
|
|
11630
11604
|
}
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
|
|
11605
|
+
updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
|
|
11606
|
+
const {
|
|
11607
|
+
textAlign: textAlign,
|
|
11608
|
+
textBaseline: textBaseline
|
|
11609
|
+
} = attribute;
|
|
11610
|
+
if (null != attribute.forceBoundsHeight) {
|
|
11611
|
+
const h = isNumber$1(attribute.forceBoundsHeight) ? attribute.forceBoundsHeight : attribute.forceBoundsHeight(),
|
|
11612
|
+
dy = textLayoutOffsetY(textBaseline, h, h);
|
|
11613
|
+
aabbBounds.set(aabbBounds.x1, dy, aabbBounds.x2, dy + h);
|
|
11614
|
+
}
|
|
11615
|
+
if (null != attribute.forceBoundsWidth) {
|
|
11616
|
+
const w = isNumber$1(attribute.forceBoundsWidth) ? attribute.forceBoundsWidth : attribute.forceBoundsWidth(),
|
|
11617
|
+
dx = textDrawOffsetX(textAlign, w);
|
|
11618
|
+
aabbBounds.set(dx, aabbBounds.y1, dx + w, aabbBounds.y2);
|
|
11619
|
+
}
|
|
11636
11620
|
}
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
|
|
11621
|
+
combindShadowAABBBounds(bounds, graphic) {
|
|
11622
|
+
if (graphic && graphic.shadowRoot) {
|
|
11623
|
+
const b = graphic.shadowRoot.AABBBounds;
|
|
11624
|
+
bounds.union(b);
|
|
11625
|
+
}
|
|
11640
11626
|
}
|
|
11641
|
-
|
|
11642
|
-
|
|
11627
|
+
transformAABBBounds(attribute, aabbBounds, theme, miter, graphic) {
|
|
11628
|
+
if (!aabbBounds.empty()) {
|
|
11629
|
+
const {
|
|
11630
|
+
scaleX = theme.scaleX,
|
|
11631
|
+
scaleY = theme.scaleY,
|
|
11632
|
+
stroke = theme.stroke,
|
|
11633
|
+
shadowBlur = theme.shadowBlur,
|
|
11634
|
+
lineWidth = theme.lineWidth,
|
|
11635
|
+
pickStrokeBuffer = theme.pickStrokeBuffer,
|
|
11636
|
+
strokeBoundsBuffer = theme.strokeBoundsBuffer
|
|
11637
|
+
} = attribute,
|
|
11638
|
+
tb1 = this.tempAABBBounds1,
|
|
11639
|
+
tb2 = this.tempAABBBounds2;
|
|
11640
|
+
if (stroke && lineWidth) {
|
|
11641
|
+
const scaledHalfLineWidth = (lineWidth + pickStrokeBuffer) / Math.abs(scaleX + scaleY);
|
|
11642
|
+
boundStroke(tb1, scaledHalfLineWidth, miter, strokeBoundsBuffer), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
11643
|
+
}
|
|
11644
|
+
if (shadowBlur) {
|
|
11645
|
+
const {
|
|
11646
|
+
shadowOffsetX = theme.shadowOffsetX,
|
|
11647
|
+
shadowOffsetY = theme.shadowOffsetY
|
|
11648
|
+
} = attribute,
|
|
11649
|
+
shadowBlurWidth = shadowBlur / Math.abs(scaleX + scaleY) * 2;
|
|
11650
|
+
boundStroke(tb1, shadowBlurWidth, !1, strokeBoundsBuffer + 1), tb1.translate(shadowOffsetX, shadowOffsetY), aabbBounds.union(tb1);
|
|
11651
|
+
}
|
|
11652
|
+
}
|
|
11653
|
+
if (this.combindShadowAABBBounds(aabbBounds, graphic), aabbBounds.empty()) return;
|
|
11654
|
+
let updateMatrix = !0;
|
|
11655
|
+
const m = graphic.transMatrix;
|
|
11656
|
+
graphic && graphic.isContainer && (updateMatrix = !(1 === m.a && 0 === m.b && 0 === m.c && 1 === m.d && 0 === m.e && 0 === m.f)), updateMatrix && transformBoundsWithMatrix(aabbBounds, aabbBounds, m);
|
|
11643
11657
|
}
|
|
11644
|
-
|
|
11645
|
-
|
|
11658
|
+
validCheck(attribute, theme, aabbBounds, graphic) {
|
|
11659
|
+
if (!graphic) return !0;
|
|
11660
|
+
if (null != attribute.forceBoundsHeight || null != attribute.forceBoundsWidth) return !0;
|
|
11661
|
+
if (graphic.shadowRoot) return !0;
|
|
11662
|
+
if (!graphic.valid) return aabbBounds.clear(), !1;
|
|
11663
|
+
const {
|
|
11664
|
+
visible = theme.visible
|
|
11665
|
+
} = attribute;
|
|
11666
|
+
return !!visible || (aabbBounds.clear(), !1);
|
|
11646
11667
|
}
|
|
11647
|
-
|
|
11648
|
-
const
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
|
|
11668
|
+
updateTempAABBBounds(aabbBounds) {
|
|
11669
|
+
const tb1 = this.tempAABBBounds1,
|
|
11670
|
+
tb2 = this.tempAABBBounds2;
|
|
11671
|
+
return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), {
|
|
11672
|
+
tb1: tb1,
|
|
11673
|
+
tb2: tb2
|
|
11652
11674
|
};
|
|
11653
11675
|
}
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
11665
|
-
|
|
11666
|
-
}();
|
|
11667
|
-
class GradientParser {
|
|
11668
|
-
static IsGradient(c) {
|
|
11669
|
-
return !("string" == typeof c && !c.includes("gradient"));
|
|
11670
|
-
}
|
|
11671
|
-
static IsGradientStr(c) {
|
|
11672
|
-
return "string" == typeof c && c.includes("gradient");
|
|
11676
|
+
};
|
|
11677
|
+
DefaultGraphicService = __decorate$1B([injectable(), __param$R(0, inject(GraphicCreator$1)), __metadata$1d("design:paramtypes", [Object])], DefaultGraphicService);
|
|
11678
|
+
|
|
11679
|
+
const result = {
|
|
11680
|
+
x: 0,
|
|
11681
|
+
y: 0,
|
|
11682
|
+
z: 0,
|
|
11683
|
+
lastModelMatrix: null
|
|
11684
|
+
};
|
|
11685
|
+
class BaseRender {
|
|
11686
|
+
init(contributions) {
|
|
11687
|
+
contributions && (this._renderContribitions = contributions.getContributions()), this._renderContribitions || (this._renderContribitions = []), this.builtinContributions && this.builtinContributions.forEach(item => this._renderContribitions.push(item)), this._renderContribitions.length && (this._renderContribitions.sort((a, b) => b.order - a.order), this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke));
|
|
11673
11688
|
}
|
|
11674
|
-
|
|
11675
|
-
|
|
11676
|
-
|
|
11677
|
-
|
|
11678
|
-
if ("linear" === datum.type) return GradientParser.ParseLinear(datum);
|
|
11679
|
-
if ("radial" === datum.type) return GradientParser.ParseRadial(datum);
|
|
11680
|
-
if ("conic" === datum.type) return GradientParser.ParseConic(datum);
|
|
11689
|
+
beforeRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
|
|
11690
|
+
this._beforeRenderContribitions && this._beforeRenderContribitions.forEach(c => {
|
|
11691
|
+
if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
|
|
11692
|
+
if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
|
|
11681
11693
|
}
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
}
|
|
11685
|
-
return c;
|
|
11694
|
+
c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
|
|
11695
|
+
});
|
|
11686
11696
|
}
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
}
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
return {
|
|
11695
|
-
gradient: "conical",
|
|
11696
|
-
x: .5,
|
|
11697
|
-
y: .5,
|
|
11698
|
-
startAngle: sa,
|
|
11699
|
-
endAngle: sa + pi2,
|
|
11700
|
-
stops: colorStops.map(item => ({
|
|
11701
|
-
color: item.value,
|
|
11702
|
-
offset: parseFloat(item.length.value) / 100
|
|
11703
|
-
}))
|
|
11704
|
-
};
|
|
11697
|
+
afterRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
|
|
11698
|
+
this._afterRenderContribitions && this._afterRenderContribitions.forEach(c => {
|
|
11699
|
+
if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
|
|
11700
|
+
if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
|
|
11701
|
+
}
|
|
11702
|
+
c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
|
|
11703
|
+
});
|
|
11705
11704
|
}
|
|
11706
|
-
|
|
11705
|
+
valid(graphic, defaultAttribute, fillCb, strokeCb) {
|
|
11707
11706
|
const {
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
|
|
11715
|
-
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
|
|
11720
|
-
|
|
11721
|
-
|
|
11707
|
+
fill = defaultAttribute.fill,
|
|
11708
|
+
background: background,
|
|
11709
|
+
stroke = defaultAttribute.stroke,
|
|
11710
|
+
opacity = defaultAttribute.opacity,
|
|
11711
|
+
fillOpacity = defaultAttribute.fillOpacity,
|
|
11712
|
+
lineWidth = defaultAttribute.lineWidth,
|
|
11713
|
+
strokeOpacity = defaultAttribute.strokeOpacity,
|
|
11714
|
+
visible = defaultAttribute.visible
|
|
11715
|
+
} = graphic.attribute,
|
|
11716
|
+
fVisible = fillVisible(opacity, fillOpacity, fill),
|
|
11717
|
+
sVisible = strokeVisible(opacity, strokeOpacity),
|
|
11718
|
+
doFill = runFill(fill, background),
|
|
11719
|
+
doStroke = runStroke(stroke, lineWidth);
|
|
11720
|
+
return !(!graphic.valid || !visible) && !(!doFill && !doStroke) && !!(fVisible || sVisible || fillCb || strokeCb || background) && {
|
|
11721
|
+
fVisible: fVisible,
|
|
11722
|
+
sVisible: sVisible,
|
|
11723
|
+
doFill: doFill,
|
|
11724
|
+
doStroke: doStroke
|
|
11722
11725
|
};
|
|
11723
11726
|
}
|
|
11724
|
-
|
|
11727
|
+
transform(graphic, graphicAttribute, context) {
|
|
11728
|
+
let use3dMatrixIn3dMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
|
11725
11729
|
const {
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
|
|
11731
|
-
|
|
11732
|
-
|
|
11733
|
-
|
|
11734
|
-
|
|
11735
|
-
|
|
11736
|
-
|
|
11737
|
-
|
|
11738
|
-
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
};
|
|
11730
|
+
x = graphicAttribute.x,
|
|
11731
|
+
y = graphicAttribute.y,
|
|
11732
|
+
z = graphicAttribute.z,
|
|
11733
|
+
scaleX = graphicAttribute.scaleX,
|
|
11734
|
+
scaleY = graphicAttribute.scaleY,
|
|
11735
|
+
angle = graphicAttribute.angle,
|
|
11736
|
+
postMatrix: postMatrix
|
|
11737
|
+
} = graphic.attribute,
|
|
11738
|
+
lastModelMatrix = context.modelMatrix,
|
|
11739
|
+
camera = context.camera;
|
|
11740
|
+
result.x = x, result.y = y, result.z = z, result.lastModelMatrix = lastModelMatrix;
|
|
11741
|
+
const shouldTransform3d = camera && (use3dMatrixIn3dMode || shouldUseMat4(graphic)),
|
|
11742
|
+
onlyTranslate = shouldTransform3d ? graphic.transMatrix.onlyTranslate() && !postMatrix : 1 === scaleX && 1 === scaleY && 0 === angle && !postMatrix;
|
|
11743
|
+
if (shouldTransform3d) {
|
|
11744
|
+
const nextModelMatrix = mat4Allocate.allocate(),
|
|
11745
|
+
modelMatrix = mat4Allocate.allocate();
|
|
11746
|
+
getModelMatrix(modelMatrix, graphic, graphicAttribute), multiplyMat4Mat4(nextModelMatrix, lastModelMatrix || nextModelMatrix, modelMatrix), result.x = 0, result.y = 0, result.z = 0, context.modelMatrix = nextModelMatrix, context.setTransform(1, 0, 0, 1, 0, 0, !0), mat4Allocate.free(modelMatrix);
|
|
11747
|
+
}
|
|
11748
|
+
if (onlyTranslate && !lastModelMatrix) {
|
|
11749
|
+
const point = graphic.getOffsetXY(graphicAttribute);
|
|
11750
|
+
result.x += point.x, result.y += point.y, result.z = z, context.setTransformForCurrent();
|
|
11751
|
+
} else if (shouldTransform3d) result.x = 0, result.y = 0, result.z = 0, context.setTransform(1, 0, 0, 1, 0, 0, !0);else if (camera && context.project) {
|
|
11752
|
+
const point = graphic.getOffsetXY(graphicAttribute);
|
|
11753
|
+
result.x += point.x, result.y += point.y, this.transformWithoutTranslate(context, result.x, result.y, result.z, scaleX, scaleY, angle);
|
|
11754
|
+
} else context.transformFromMatrix(graphic.transMatrix, !0), result.x = 0, result.y = 0, result.z = 0;
|
|
11755
|
+
return result;
|
|
11748
11756
|
}
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
|
|
11764
|
-
|
|
11765
|
-
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
|
|
11772
|
-
|
|
11773
|
-
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
scaleY = 1
|
|
11780
|
-
} = params.attribute;
|
|
11781
|
-
w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY;
|
|
11757
|
+
transformUseContext2d(graphic, graphicAttribute, z, context) {
|
|
11758
|
+
const camera = context.camera;
|
|
11759
|
+
if (this.camera = camera, camera) {
|
|
11760
|
+
const bounds = graphic.AABBBounds,
|
|
11761
|
+
width = bounds.x2 - bounds.x1,
|
|
11762
|
+
height = bounds.y2 - bounds.y1,
|
|
11763
|
+
p1 = context.project(0, 0, z),
|
|
11764
|
+
p2 = context.project(width, 0, z),
|
|
11765
|
+
p3 = context.project(width, height, z),
|
|
11766
|
+
_p1 = {
|
|
11767
|
+
x: 0,
|
|
11768
|
+
y: 0
|
|
11769
|
+
},
|
|
11770
|
+
_p2 = {
|
|
11771
|
+
x: width,
|
|
11772
|
+
y: 0
|
|
11773
|
+
},
|
|
11774
|
+
_p3 = {
|
|
11775
|
+
x: width,
|
|
11776
|
+
y: height
|
|
11777
|
+
};
|
|
11778
|
+
context.camera = null;
|
|
11779
|
+
const denom = 1 / (_p1.x * (_p3.y - _p2.y) - _p2.x * _p3.y + _p3.x * _p2.y + (_p2.x - _p3.x) * _p1.y),
|
|
11780
|
+
m11 = -(_p1.y * (p3.x - p2.x) - _p2.y * p3.x + _p3.y * p2.x + (_p2.y - _p3.y) * p1.x) * denom,
|
|
11781
|
+
m12 = (_p2.y * p3.y + _p1.y * (p2.y - p3.y) - _p3.y * p2.y + (_p3.y - _p2.y) * p1.y) * denom,
|
|
11782
|
+
m21 = (_p1.x * (p3.x - p2.x) - _p2.x * p3.x + _p3.x * p2.x + (_p2.x - _p3.x) * p1.x) * denom,
|
|
11783
|
+
m22 = -(_p2.x * p3.y + _p1.x * (p2.y - p3.y) - _p3.x * p2.y + (_p3.x - _p2.x) * p1.y) * denom,
|
|
11784
|
+
dx = (_p1.x * (_p3.y * p2.x - _p2.y * p3.x) + _p1.y * (_p2.x * p3.x - _p3.x * p2.x) + (_p3.x * _p2.y - _p2.x * _p3.y) * p1.x) * denom,
|
|
11785
|
+
dy = (_p1.x * (_p3.y * p2.y - _p2.y * p3.y) + _p1.y * (_p2.x * p3.y - _p3.x * p2.y) + (_p3.x * _p2.y - _p2.x * _p3.y) * p1.y) * denom;
|
|
11786
|
+
context.setTransform(m11, m12, m21, m22, dx, dy, !0);
|
|
11782
11787
|
}
|
|
11783
|
-
"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));
|
|
11784
11788
|
}
|
|
11785
|
-
|
|
11786
|
-
|
|
11787
|
-
|
|
11788
|
-
|
|
11789
|
-
|
|
11790
|
-
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
|
|
11789
|
+
restoreTransformUseContext2d(graphic, graphicAttribute, z, context) {
|
|
11790
|
+
this.camera && (context.camera = this.camera);
|
|
11791
|
+
}
|
|
11792
|
+
transformWithoutTranslate(context, x, y, z, scaleX, scaleY, angle) {
|
|
11793
|
+
const p = context.project(x, y, z);
|
|
11794
|
+
context.translate(p.x, p.y, !1), context.scale(scaleX, scaleY, !1), context.rotate(angle, !1), context.translate(-p.x, -p.y, !1), context.setTransformForCurrent();
|
|
11795
|
+
}
|
|
11796
|
+
_draw(graphic, defaultAttr, computed3dMatrix, drawContext, params) {
|
|
11797
|
+
const {
|
|
11798
|
+
context: context
|
|
11799
|
+
} = drawContext;
|
|
11800
|
+
if (!context) return;
|
|
11801
|
+
const {
|
|
11802
|
+
renderable: renderable
|
|
11803
|
+
} = graphic.attribute;
|
|
11804
|
+
if (!1 === renderable) return;
|
|
11805
|
+
context.highPerformanceSave();
|
|
11806
|
+
const data = this.transform(graphic, defaultAttr, context, computed3dMatrix),
|
|
11807
|
+
{
|
|
11808
|
+
x: x,
|
|
11809
|
+
y: y,
|
|
11810
|
+
z: z,
|
|
11811
|
+
lastModelMatrix: lastModelMatrix
|
|
11812
|
+
} = data;
|
|
11813
|
+
this.z = z, drawPathProxy(graphic, context, x, y, drawContext, params) || (this.drawShape(graphic, context, x, y, drawContext, params), this.z = 0, context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix), context.highPerformanceRestore();
|
|
11814
|
+
}
|
|
11807
11815
|
}
|
|
11808
11816
|
|
|
11809
11817
|
var __decorate$1A = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
@@ -12683,7 +12691,7 @@ function drawEachCurve(path, curve, lastCurve, defined0, offsetX, offsetY, offse
|
|
|
12683
12691
|
originP2: originP2
|
|
12684
12692
|
} = curve;
|
|
12685
12693
|
let validP;
|
|
12686
|
-
if (originP1 && !1 !== originP1.defined ? validP = p0 : originP1 && !1 !== originP2.defined && (validP = null !== (_a = curve.p3) && void 0 !== _a ? _a : curve.p1), defined0) {
|
|
12694
|
+
if (originP1 && !1 !== originP1.defined && !lastCurve ? validP = p0 : originP1 && !1 !== originP2.defined && (validP = null !== (_a = curve.p3) && void 0 !== _a ? _a : curve.p1), defined0) {
|
|
12687
12695
|
newDefined0 = !defined0;
|
|
12688
12696
|
const x = validP ? validP.x : curve.p0.x,
|
|
12689
12697
|
y = validP ? validP.y : curve.p0.y;
|
|
@@ -14219,7 +14227,10 @@ class ShadowRootDrawItemInterceptorContribution {
|
|
|
14219
14227
|
const {
|
|
14220
14228
|
context: context
|
|
14221
14229
|
} = drawContext;
|
|
14222
|
-
|
|
14230
|
+
context.highPerformanceSave();
|
|
14231
|
+
const t1 = graphic.parent.globalTransMatrix,
|
|
14232
|
+
t2 = graphic.stage.window.getViewBoxTransform().clone().multiply(t1.a, t1.b, t1.c, t1.d, t1.e, t1.f);
|
|
14233
|
+
if (graphic.parent && context.setTransformFromMatrix(t2, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
|
|
14223
14234
|
tempDirtyBounds.copy(drawContribution.dirtyBounds), tempBackupDirtyBounds.copy(drawContribution.backupDirtyBounds);
|
|
14224
14235
|
const m = graphic.globalTransMatrix.getInverse();
|
|
14225
14236
|
drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m), drawContribution.backupDirtyBounds.copy(drawContribution.dirtyBounds);
|
|
@@ -15242,6 +15253,9 @@ class BaseSymbol {
|
|
|
15242
15253
|
bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
|
|
15243
15254
|
} else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
|
|
15244
15255
|
}
|
|
15256
|
+
parseSize(size) {
|
|
15257
|
+
return isNumber$1(size) ? size : Math.min(size[0], size[1]);
|
|
15258
|
+
}
|
|
15245
15259
|
}
|
|
15246
15260
|
|
|
15247
15261
|
function circle(ctx, r, x, y, z) {
|
|
@@ -15252,13 +15266,13 @@ class CircleSymbol extends BaseSymbol {
|
|
|
15252
15266
|
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";
|
|
15253
15267
|
}
|
|
15254
15268
|
draw(ctx, size, x, y, z) {
|
|
15255
|
-
return circle(ctx, size / 2, x, y, z);
|
|
15269
|
+
return circle(ctx, this.parseSize(size) / 2, x, y, z);
|
|
15256
15270
|
}
|
|
15257
15271
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15258
|
-
return circle(ctx, size / 2 + offset, x, y, z);
|
|
15272
|
+
return circle(ctx, this.parseSize(size) / 2 + offset, x, y, z);
|
|
15259
15273
|
}
|
|
15260
15274
|
drawToSvgPath(size, x, y, z) {
|
|
15261
|
-
const r = size / 2;
|
|
15275
|
+
const r = this.parseSize(size) / 2;
|
|
15262
15276
|
return `M ${x - r}, ${y} a ${r},${r} 0 1,0 ${2 * r},0 a ${r},${r} 0 1,0 -${2 * r},0`;
|
|
15263
15277
|
}
|
|
15264
15278
|
}
|
|
@@ -15275,10 +15289,10 @@ class CrossSymbol extends BaseSymbol {
|
|
|
15275
15289
|
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";
|
|
15276
15290
|
}
|
|
15277
15291
|
draw(ctx, size, x, y, z) {
|
|
15278
|
-
return cross(ctx, size / 6, x, y, z);
|
|
15292
|
+
return cross(ctx, this.parseSize(size) / 6, x, y, z);
|
|
15279
15293
|
}
|
|
15280
15294
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15281
|
-
return crossOffset(ctx, size / 6, x, y, offset, z);
|
|
15295
|
+
return crossOffset(ctx, this.parseSize(size) / 6, x, y, offset, z);
|
|
15282
15296
|
}
|
|
15283
15297
|
}
|
|
15284
15298
|
var cross$1 = new CrossSymbol();
|
|
@@ -15291,13 +15305,13 @@ class DiamondSymbol extends BaseSymbol {
|
|
|
15291
15305
|
super(...arguments), this.type = "diamond", this.pathStr = "M-0.5,0L0,-0.5L0.5,0L0,0.5Z";
|
|
15292
15306
|
}
|
|
15293
15307
|
draw(ctx, size, x, y, z) {
|
|
15294
|
-
return diamond(ctx, size / 2, x, y, z);
|
|
15308
|
+
return diamond(ctx, this.parseSize(size) / 2, x, y, z);
|
|
15295
15309
|
}
|
|
15296
15310
|
drawFitDir(ctx, size, x, y, z) {
|
|
15297
|
-
return diamond(ctx, size / 2, x, y, z);
|
|
15311
|
+
return diamond(ctx, this.parseSize(size) / 2, x, y, z);
|
|
15298
15312
|
}
|
|
15299
15313
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15300
|
-
return diamond(ctx, size / 2 + offset, x, y, z);
|
|
15314
|
+
return diamond(ctx, this.parseSize(size) / 2 + offset, x, y, z);
|
|
15301
15315
|
}
|
|
15302
15316
|
}
|
|
15303
15317
|
var diamond$1 = new DiamondSymbol();
|
|
@@ -15311,10 +15325,10 @@ class SquareSymbol extends BaseSymbol {
|
|
|
15311
15325
|
super(...arguments), this.type = "square", this.pathStr = "M-0.5,-0.5h1v1h-1Z";
|
|
15312
15326
|
}
|
|
15313
15327
|
draw(ctx, size, x, y) {
|
|
15314
|
-
return square(ctx, size / 2, x, y);
|
|
15328
|
+
return square(ctx, this.parseSize(size) / 2, x, y);
|
|
15315
15329
|
}
|
|
15316
15330
|
drawOffset(ctx, size, x, y, offset) {
|
|
15317
|
-
return square(ctx, size / 2 + offset, x, y);
|
|
15331
|
+
return square(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
15318
15332
|
}
|
|
15319
15333
|
}
|
|
15320
15334
|
var square$1 = new SquareSymbol();
|
|
@@ -15328,10 +15342,10 @@ class TriangleUpSymbol extends BaseSymbol {
|
|
|
15328
15342
|
super(...arguments), this.type = "triangleUp", this.pathStr = "M0.5,0.5 L-0.5,0.5 L0,-0.5 Z";
|
|
15329
15343
|
}
|
|
15330
15344
|
draw(ctx, size, x, y) {
|
|
15331
|
-
return trianglUpOffset(ctx, size / 2, x, y);
|
|
15345
|
+
return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
15332
15346
|
}
|
|
15333
15347
|
drawOffset(ctx, size, x, y, offset) {
|
|
15334
|
-
return trianglUpOffset(ctx, size / 2, x, y, offset);
|
|
15348
|
+
return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
15335
15349
|
}
|
|
15336
15350
|
}
|
|
15337
15351
|
var triangleUp = new TriangleUpSymbol();
|
|
@@ -15363,10 +15377,10 @@ class StarSymbol extends BaseSymbol {
|
|
|
15363
15377
|
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";
|
|
15364
15378
|
}
|
|
15365
15379
|
draw(ctx, size, transX, transY) {
|
|
15366
|
-
return star(ctx, size / 2, transX, transY);
|
|
15380
|
+
return star(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15367
15381
|
}
|
|
15368
15382
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15369
|
-
return star(ctx, size / 2 + offset, transX, transY);
|
|
15383
|
+
return star(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15370
15384
|
}
|
|
15371
15385
|
}
|
|
15372
15386
|
var star$1 = new StarSymbol();
|
|
@@ -15384,10 +15398,10 @@ class ArrowSymbol extends BaseSymbol {
|
|
|
15384
15398
|
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";
|
|
15385
15399
|
}
|
|
15386
15400
|
draw(ctx, size, transX, transY) {
|
|
15387
|
-
return arrow(ctx, size / 2, transX, transY);
|
|
15401
|
+
return arrow(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15388
15402
|
}
|
|
15389
15403
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15390
|
-
return arrow(ctx, size / 2 + offset, transX, transY);
|
|
15404
|
+
return arrow(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15391
15405
|
}
|
|
15392
15406
|
}
|
|
15393
15407
|
var arrow$1 = new ArrowSymbol();
|
|
@@ -15401,10 +15415,10 @@ class WedgeSymbol extends BaseSymbol {
|
|
|
15401
15415
|
super(...arguments), this.type = "wedge", this.pathStr = "M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z";
|
|
15402
15416
|
}
|
|
15403
15417
|
draw(ctx, size, transX, transY) {
|
|
15404
|
-
return wedge(ctx, size / 2, transX, transY);
|
|
15418
|
+
return wedge(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15405
15419
|
}
|
|
15406
15420
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15407
|
-
return wedge(ctx, size / 2 + offset, transX, transY);
|
|
15421
|
+
return wedge(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15408
15422
|
}
|
|
15409
15423
|
}
|
|
15410
15424
|
var wedge$1 = new WedgeSymbol();
|
|
@@ -15417,10 +15431,10 @@ class StrokeSymbol extends BaseSymbol {
|
|
|
15417
15431
|
super(...arguments), this.type = "stroke", this.pathStr = "";
|
|
15418
15432
|
}
|
|
15419
15433
|
draw(ctx, size, transX, transY) {
|
|
15420
|
-
return stroke(ctx, size / 2, transX, transY);
|
|
15434
|
+
return stroke(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15421
15435
|
}
|
|
15422
15436
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15423
|
-
return stroke(ctx, size / 2 + offset, transX, transY);
|
|
15437
|
+
return stroke(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15424
15438
|
}
|
|
15425
15439
|
}
|
|
15426
15440
|
var stroke$1 = new StrokeSymbol();
|
|
@@ -15442,10 +15456,10 @@ class WyeSymbol extends BaseSymbol {
|
|
|
15442
15456
|
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";
|
|
15443
15457
|
}
|
|
15444
15458
|
draw(ctx, size, transX, transY) {
|
|
15445
|
-
return wye(ctx, size / 2, transX, transY);
|
|
15459
|
+
return wye(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15446
15460
|
}
|
|
15447
15461
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15448
|
-
return wye(ctx, size / 2 + offset, transX, transY);
|
|
15462
|
+
return wye(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15449
15463
|
}
|
|
15450
15464
|
}
|
|
15451
15465
|
var wye$1 = new WyeSymbol();
|
|
@@ -15458,10 +15472,10 @@ class TriangleLeftSymbol extends BaseSymbol {
|
|
|
15458
15472
|
super(...arguments), this.type = "triangleLeft", this.pathStr = "M-0.5,0 L0.5,0.5 L0.5,-0.5 Z";
|
|
15459
15473
|
}
|
|
15460
15474
|
draw(ctx, size, x, y) {
|
|
15461
|
-
return trianglLeftOffset(ctx, size / 2, x, y, 0);
|
|
15475
|
+
return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, 0);
|
|
15462
15476
|
}
|
|
15463
15477
|
drawOffset(ctx, size, x, y, offset) {
|
|
15464
|
-
return trianglLeftOffset(ctx, size / 2, x, y, offset);
|
|
15478
|
+
return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
15465
15479
|
}
|
|
15466
15480
|
}
|
|
15467
15481
|
var triangleLeft = new TriangleLeftSymbol();
|
|
@@ -15475,10 +15489,10 @@ class TriangleRightSymbol extends BaseSymbol {
|
|
|
15475
15489
|
super(...arguments), this.type = "triangleRight", this.pathStr = "M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z";
|
|
15476
15490
|
}
|
|
15477
15491
|
draw(ctx, size, x, y) {
|
|
15478
|
-
return trianglRightOffset(ctx, size / 2, x, y);
|
|
15492
|
+
return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
15479
15493
|
}
|
|
15480
15494
|
drawOffset(ctx, size, x, y, offset) {
|
|
15481
|
-
return trianglRightOffset(ctx, size / 2, x, y, offset);
|
|
15495
|
+
return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
15482
15496
|
}
|
|
15483
15497
|
}
|
|
15484
15498
|
var triangleRight = new TriangleRightSymbol();
|
|
@@ -15492,10 +15506,10 @@ class TriangleDownSymbol extends BaseSymbol {
|
|
|
15492
15506
|
super(...arguments), this.type = "triangleDown", this.pathStr = "M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z";
|
|
15493
15507
|
}
|
|
15494
15508
|
draw(ctx, size, x, y) {
|
|
15495
|
-
return trianglDownOffset(ctx, size / 2, x, y);
|
|
15509
|
+
return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
15496
15510
|
}
|
|
15497
15511
|
drawOffset(ctx, size, x, y, offset) {
|
|
15498
|
-
return trianglDownOffset(ctx, size / 2, x, y, offset);
|
|
15512
|
+
return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
15499
15513
|
}
|
|
15500
15514
|
}
|
|
15501
15515
|
var triangleDown = new TriangleDownSymbol();
|
|
@@ -15510,10 +15524,10 @@ class ThinTriangleSymbol extends BaseSymbol {
|
|
|
15510
15524
|
super(...arguments), this.type = "thinTriangle", this.pathStr = "M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z";
|
|
15511
15525
|
}
|
|
15512
15526
|
draw(ctx, size, x, y) {
|
|
15513
|
-
return thinTriangle(ctx, size / 2 / sqrt3, x, y);
|
|
15527
|
+
return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3, x, y);
|
|
15514
15528
|
}
|
|
15515
15529
|
drawOffset(ctx, size, x, y, offset) {
|
|
15516
|
-
return thinTriangle(ctx, size / 2 / sqrt3 + offset, x, y);
|
|
15530
|
+
return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3 + offset, x, y);
|
|
15517
15531
|
}
|
|
15518
15532
|
}
|
|
15519
15533
|
var thinTriangle$1 = new ThinTriangleSymbol();
|
|
@@ -15527,10 +15541,10 @@ class Arrow2LeftSymbol extends BaseSymbol {
|
|
|
15527
15541
|
super(...arguments), this.type = "arrow2Left", this.pathStr = "M 0.25 -0.5 L -0.25 0 l 0.25 0.5";
|
|
15528
15542
|
}
|
|
15529
15543
|
draw(ctx, size, transX, transY) {
|
|
15530
|
-
return arrow2Left(ctx, size / 4, transX, transY);
|
|
15544
|
+
return arrow2Left(ctx, this.parseSize(size) / 4, transX, transY);
|
|
15531
15545
|
}
|
|
15532
15546
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15533
|
-
return arrow2Left(ctx, size / 4 + offset, transX, transY);
|
|
15547
|
+
return arrow2Left(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
15534
15548
|
}
|
|
15535
15549
|
}
|
|
15536
15550
|
var arrow2Left$1 = new Arrow2LeftSymbol();
|
|
@@ -15544,10 +15558,10 @@ class Arrow2RightSymbol extends BaseSymbol {
|
|
|
15544
15558
|
super(...arguments), this.type = "arrow2Right", this.pathStr = "M -0.25 -0.5 l 0.25 0 l -0.25 0.5";
|
|
15545
15559
|
}
|
|
15546
15560
|
draw(ctx, size, transX, transY) {
|
|
15547
|
-
return arrow2Right(ctx, size / 4, transX, transY);
|
|
15561
|
+
return arrow2Right(ctx, this.parseSize(size) / 4, transX, transY);
|
|
15548
15562
|
}
|
|
15549
15563
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15550
|
-
return arrow2Right(ctx, size / 4 + offset, transX, transY);
|
|
15564
|
+
return arrow2Right(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
15551
15565
|
}
|
|
15552
15566
|
}
|
|
15553
15567
|
var arrow2Right$1 = new Arrow2RightSymbol();
|
|
@@ -15561,10 +15575,10 @@ class Arrow2UpSymbol extends BaseSymbol {
|
|
|
15561
15575
|
super(...arguments), this.type = "arrow2Up", this.pathStr = "M -0.5 0.25 L 0 -0.25 l 0.5 0.25";
|
|
15562
15576
|
}
|
|
15563
15577
|
draw(ctx, size, transX, transY) {
|
|
15564
|
-
return arrow2Up(ctx, size / 4, transX, transY);
|
|
15578
|
+
return arrow2Up(ctx, this.parseSize(size) / 4, transX, transY);
|
|
15565
15579
|
}
|
|
15566
15580
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15567
|
-
return arrow2Up(ctx, size / 4 + offset, transX, transY);
|
|
15581
|
+
return arrow2Up(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
15568
15582
|
}
|
|
15569
15583
|
}
|
|
15570
15584
|
var arrow2Up$1 = new Arrow2UpSymbol();
|
|
@@ -15578,10 +15592,10 @@ class Arrow2DownSymbol extends BaseSymbol {
|
|
|
15578
15592
|
super(...arguments), this.type = "arrow2Down", this.pathStr = "M -0.5 -0.25 L 0 0.25 l 0.5 -0.25";
|
|
15579
15593
|
}
|
|
15580
15594
|
draw(ctx, size, transX, transY) {
|
|
15581
|
-
return arrow2Down(ctx, size / 4, transX, transY);
|
|
15595
|
+
return arrow2Down(ctx, this.parseSize(size) / 4, transX, transY);
|
|
15582
15596
|
}
|
|
15583
15597
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15584
|
-
return arrow2Down(ctx, size / 4 + offset, transX, transY);
|
|
15598
|
+
return arrow2Down(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
15585
15599
|
}
|
|
15586
15600
|
}
|
|
15587
15601
|
var arrow2Down$1 = new Arrow2DownSymbol();
|
|
@@ -15594,13 +15608,13 @@ class LineVSymbol extends BaseSymbol {
|
|
|
15594
15608
|
super(...arguments), this.type = "lineV", this.pathStr = "M0,-0.5L0,0.5";
|
|
15595
15609
|
}
|
|
15596
15610
|
draw(ctx, size, x, y, z) {
|
|
15597
|
-
return lineV(ctx, size / 2, x, y);
|
|
15611
|
+
return lineV(ctx, this.parseSize(size) / 2, x, y);
|
|
15598
15612
|
}
|
|
15599
15613
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15600
|
-
return lineV(ctx, size / 2 + offset, x, y);
|
|
15614
|
+
return lineV(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
15601
15615
|
}
|
|
15602
15616
|
drawToSvgPath(size, x, y, z) {
|
|
15603
|
-
const r = size / 2;
|
|
15617
|
+
const r = this.parseSize(size) / 2;
|
|
15604
15618
|
return `M ${x}, ${y - r} L ${x},${y + r}`;
|
|
15605
15619
|
}
|
|
15606
15620
|
}
|
|
@@ -15614,13 +15628,13 @@ class LineHSymbol extends BaseSymbol {
|
|
|
15614
15628
|
super(...arguments), this.type = "lineH", this.pathStr = "M-0.5,0L0.5,0";
|
|
15615
15629
|
}
|
|
15616
15630
|
draw(ctx, size, x, y, z) {
|
|
15617
|
-
return lineH(ctx, size / 2, x, y);
|
|
15631
|
+
return lineH(ctx, this.parseSize(size) / 2, x, y);
|
|
15618
15632
|
}
|
|
15619
15633
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15620
|
-
return lineH(ctx, size / 2 + offset, x, y);
|
|
15634
|
+
return lineH(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
15621
15635
|
}
|
|
15622
15636
|
drawToSvgPath(size, x, y, z) {
|
|
15623
|
-
const r = size / 2;
|
|
15637
|
+
const r = this.parseSize(size) / 2;
|
|
15624
15638
|
return `M ${x - r}, ${y} L ${x + r},${y}`;
|
|
15625
15639
|
}
|
|
15626
15640
|
}
|
|
@@ -15634,13 +15648,13 @@ class CloseSymbol extends BaseSymbol {
|
|
|
15634
15648
|
super(...arguments), this.type = "close", this.pathStr = "M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5";
|
|
15635
15649
|
}
|
|
15636
15650
|
draw(ctx, size, x, y, z) {
|
|
15637
|
-
return close(ctx, size / 2, x, y);
|
|
15651
|
+
return close(ctx, this.parseSize(size) / 2, x, y);
|
|
15638
15652
|
}
|
|
15639
15653
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15640
|
-
return close(ctx, size / 2 + offset, x, y);
|
|
15654
|
+
return close(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
15641
15655
|
}
|
|
15642
15656
|
drawToSvgPath(size, x, y, z) {
|
|
15643
|
-
const r = size / 2;
|
|
15657
|
+
const r = this.parseSize(size) / 2;
|
|
15644
15658
|
return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`;
|
|
15645
15659
|
}
|
|
15646
15660
|
}
|
|
@@ -15674,15 +15688,18 @@ class CustomSymbolClass {
|
|
|
15674
15688
|
this.pathStr = "", this.type = type, isArray$1(path) ? this.svgCache = path : this.path = path, this.isSvg = isSvg;
|
|
15675
15689
|
}
|
|
15676
15690
|
drawOffset(ctx, size, x, y, offset, z, cb) {
|
|
15677
|
-
return this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
|
|
15691
|
+
return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
|
|
15678
15692
|
ctx.beginPath(), renderCommandList(item.path.commandList, ctx, x, y, size, size), cb && cb(item.path, item.attribute);
|
|
15679
15693
|
}), !1) : (renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset), !1);
|
|
15680
15694
|
}
|
|
15681
15695
|
draw(ctx, size, x, y, z, cb) {
|
|
15682
|
-
return this.drawOffset(ctx, size, x, y, 0, z, cb);
|
|
15696
|
+
return size = this.parseSize(size), this.drawOffset(ctx, size, x, y, 0, z, cb);
|
|
15697
|
+
}
|
|
15698
|
+
parseSize(size) {
|
|
15699
|
+
return isNumber$1(size) ? size : Math.min(size[0], size[1]);
|
|
15683
15700
|
}
|
|
15684
15701
|
bounds(size, bounds) {
|
|
15685
|
-
if (this.isSvg) {
|
|
15702
|
+
if (size = this.parseSize(size), this.isSvg) {
|
|
15686
15703
|
if (!this.svgCache) return;
|
|
15687
15704
|
return bounds.clear(), void this.svgCache.forEach(_ref => {
|
|
15688
15705
|
let {
|
|
@@ -16365,7 +16382,11 @@ class Paragraph {
|
|
|
16365
16382
|
case "sub":
|
|
16366
16383
|
baseline += this.descent / 2;
|
|
16367
16384
|
}
|
|
16368
|
-
"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)
|
|
16385
|
+
"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);
|
|
16386
|
+
const {
|
|
16387
|
+
lineWidth = 1
|
|
16388
|
+
} = this.character;
|
|
16389
|
+
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();
|
|
16369
16390
|
}
|
|
16370
16391
|
getWidthWithEllips(direction) {
|
|
16371
16392
|
let text = this.text;
|
|
@@ -16588,12 +16609,18 @@ class Line {
|
|
|
16588
16609
|
paragraph.ellipsis = "hide", otherParagraphWidth += paragraph.width;
|
|
16589
16610
|
}
|
|
16590
16611
|
}
|
|
16591
|
-
this.paragraphs.
|
|
16612
|
+
this.paragraphs.forEach((paragraph, index) => {
|
|
16592
16613
|
if (paragraph instanceof RichTextIcon) return paragraph.setAttributes({
|
|
16593
16614
|
x: x + paragraph._x,
|
|
16594
16615
|
y: y + paragraph._y
|
|
16595
16616
|
}), void drawIcon(paragraph, ctx, x + paragraph._x, y + paragraph._y, this.ascent);
|
|
16596
|
-
|
|
16617
|
+
const b = {
|
|
16618
|
+
x1: this.left,
|
|
16619
|
+
y1: this.top,
|
|
16620
|
+
x2: this.left + this.actualWidth,
|
|
16621
|
+
y2: this.top + this.height
|
|
16622
|
+
};
|
|
16623
|
+
applyStrokeStyle(ctx, paragraph.character), applyFillStyle(ctx, paragraph.character, b), paragraph.draw(ctx, y + this.ascent, x, 0 === index, this.textAlign);
|
|
16597
16624
|
});
|
|
16598
16625
|
}
|
|
16599
16626
|
getWidthWithEllips(ellipsis) {
|
|
@@ -16616,7 +16643,7 @@ class Line {
|
|
|
16616
16643
|
paragraph.ellipsis = "hide", otherParagraphWidth += paragraph.width;
|
|
16617
16644
|
}
|
|
16618
16645
|
let width = 0;
|
|
16619
|
-
return this.paragraphs.
|
|
16646
|
+
return this.paragraphs.forEach((paragraph, index) => {
|
|
16620
16647
|
width += paragraph instanceof RichTextIcon ? paragraph.width : paragraph.getWidthWithEllips(this.direction);
|
|
16621
16648
|
}), width;
|
|
16622
16649
|
}
|
|
@@ -16656,7 +16683,7 @@ class Wrapper {
|
|
|
16656
16683
|
}
|
|
16657
16684
|
}
|
|
16658
16685
|
|
|
16659
|
-
const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
16686
|
+
const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", "fontFamily", "fontStyle", "fontWeight", "lineWidth", "opacity", "fillOpacity", "strokeOpacity", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
16660
16687
|
class RichText extends Graphic {
|
|
16661
16688
|
constructor(params) {
|
|
16662
16689
|
super(params), this.type = "richtext", this._currentHoverIcon = null, this.numberType = RICHTEXT_NUMBER_TYPE, this.onBeforeAttributeUpdate = (val, attributes, key) => {
|
|
@@ -28608,7 +28635,7 @@ const registerWrapText = _registerWrapText;
|
|
|
28608
28635
|
|
|
28609
28636
|
const roughModule = _roughModule;
|
|
28610
28637
|
|
|
28611
|
-
const version = "0.20.
|
|
28638
|
+
const version = "0.20.17";
|
|
28612
28639
|
preLoadAllModule();
|
|
28613
28640
|
if (isBrowserEnv()) {
|
|
28614
28641
|
loadBrowserEnv(container);
|