@visactor/vrender 0.20.14 → 0.20.16
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 +765 -731
- package/dist/index.js +765 -731
- 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 +5 -5
package/dist/index.es.js
CHANGED
|
@@ -3990,7 +3990,8 @@ const DefaultAttribute = Object.assign(Object.assign(Object.assign({
|
|
|
3990
3990
|
globalZIndex: 1,
|
|
3991
3991
|
globalCompositeOperation: "",
|
|
3992
3992
|
overflow: "hidden",
|
|
3993
|
-
shadowPickMode: "graphic"
|
|
3993
|
+
shadowPickMode: "graphic",
|
|
3994
|
+
keepStrokeScale: !1
|
|
3994
3995
|
}, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
|
|
3995
3996
|
function addAttributeToPrototype(obj, c, keys) {
|
|
3996
3997
|
keys.forEach(key => {
|
|
@@ -4142,6 +4143,292 @@ const DefaultRichTextIconAttribute = Object.assign(Object.assign({}, DefaultImag
|
|
|
4142
4143
|
class Application {}
|
|
4143
4144
|
const application = new Application();
|
|
4144
4145
|
|
|
4146
|
+
const parse = function () {
|
|
4147
|
+
const tokens = {
|
|
4148
|
+
linearGradient: /^(linear\-gradient)/i,
|
|
4149
|
+
radialGradient: /^(radial\-gradient)/i,
|
|
4150
|
+
conicGradient: /^(conic\-gradient)/i,
|
|
4151
|
+
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,
|
|
4152
|
+
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
|
4153
|
+
positionKeywords: /^(left|center|right|top|bottom)/i,
|
|
4154
|
+
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
|
|
4155
|
+
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
|
|
4156
|
+
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
|
|
4157
|
+
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
|
4158
|
+
fromAngleValue: /^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
|
4159
|
+
startCall: /^\(/,
|
|
4160
|
+
endCall: /^\)/,
|
|
4161
|
+
comma: /^,/,
|
|
4162
|
+
hexColor: /(^\#[0-9a-fA-F]+)/,
|
|
4163
|
+
literalColor: /^([a-zA-Z]+)/,
|
|
4164
|
+
rgbColor: /^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,
|
|
4165
|
+
rgbaColor: /^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,
|
|
4166
|
+
number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
|
|
4167
|
+
};
|
|
4168
|
+
let input = "";
|
|
4169
|
+
function error(msg) {
|
|
4170
|
+
const err = new Error(input + ": " + msg);
|
|
4171
|
+
throw err.source = input, err;
|
|
4172
|
+
}
|
|
4173
|
+
function getAST() {
|
|
4174
|
+
const ast = matchListing(matchDefinition);
|
|
4175
|
+
return input.length > 0 && error("Invalid input not EOF"), ast;
|
|
4176
|
+
}
|
|
4177
|
+
function matchDefinition() {
|
|
4178
|
+
return matchGradient("linear", tokens.linearGradient, matchLinearOrientation) || matchGradient("radial", tokens.radialGradient, matchListRadialOrientations) || matchGradient("conic", tokens.conicGradient, matchConicalOrientation);
|
|
4179
|
+
}
|
|
4180
|
+
function matchGradient(gradientType, pattern, orientationMatcher) {
|
|
4181
|
+
return function (pattern, callback) {
|
|
4182
|
+
const captures = scan(pattern);
|
|
4183
|
+
if (captures) {
|
|
4184
|
+
scan(tokens.startCall) || error("Missing (");
|
|
4185
|
+
const result = callback(captures);
|
|
4186
|
+
return scan(tokens.endCall) || error("Missing )"), result;
|
|
4187
|
+
}
|
|
4188
|
+
}(pattern, function (captures) {
|
|
4189
|
+
const orientation = orientationMatcher();
|
|
4190
|
+
return orientation && (scan(tokens.comma) || error("Missing comma before color stops")), {
|
|
4191
|
+
type: gradientType,
|
|
4192
|
+
orientation: orientation,
|
|
4193
|
+
colorStops: matchListing(matchColorStop)
|
|
4194
|
+
};
|
|
4195
|
+
});
|
|
4196
|
+
}
|
|
4197
|
+
function matchLinearOrientation() {
|
|
4198
|
+
return match("directional", tokens.sideOrCorner, 1) || match("angular", tokens.angleValue, 1);
|
|
4199
|
+
}
|
|
4200
|
+
function matchConicalOrientation() {
|
|
4201
|
+
return match("angular", tokens.fromAngleValue, 1);
|
|
4202
|
+
}
|
|
4203
|
+
function matchListRadialOrientations() {
|
|
4204
|
+
let radialOrientations,
|
|
4205
|
+
lookaheadCache,
|
|
4206
|
+
radialOrientation = matchRadialOrientation();
|
|
4207
|
+
return radialOrientation && (radialOrientations = [], radialOrientations.push(radialOrientation), lookaheadCache = input, scan(tokens.comma) && (radialOrientation = matchRadialOrientation(), radialOrientation ? radialOrientations.push(radialOrientation) : input = lookaheadCache)), radialOrientations;
|
|
4208
|
+
}
|
|
4209
|
+
function matchRadialOrientation() {
|
|
4210
|
+
let radialType = function () {
|
|
4211
|
+
const circle = match("shape", /^(circle)/i, 0);
|
|
4212
|
+
circle && (circle.style = matchLength() || matchExtentKeyword());
|
|
4213
|
+
return circle;
|
|
4214
|
+
}() || function () {
|
|
4215
|
+
const ellipse = match("shape", /^(ellipse)/i, 0);
|
|
4216
|
+
ellipse && (ellipse.style = matchDistance() || matchExtentKeyword());
|
|
4217
|
+
return ellipse;
|
|
4218
|
+
}();
|
|
4219
|
+
if (radialType) radialType.at = matchAtPosition();else {
|
|
4220
|
+
const extent = matchExtentKeyword();
|
|
4221
|
+
if (extent) {
|
|
4222
|
+
radialType = extent;
|
|
4223
|
+
const positionAt = matchAtPosition();
|
|
4224
|
+
positionAt && (radialType.at = positionAt);
|
|
4225
|
+
} else {
|
|
4226
|
+
const defaultPosition = matchPositioning();
|
|
4227
|
+
defaultPosition && (radialType = {
|
|
4228
|
+
type: "default-radial",
|
|
4229
|
+
at: defaultPosition
|
|
4230
|
+
});
|
|
4231
|
+
}
|
|
4232
|
+
}
|
|
4233
|
+
return radialType;
|
|
4234
|
+
}
|
|
4235
|
+
function matchExtentKeyword() {
|
|
4236
|
+
return match("extent-keyword", tokens.extentKeywords, 1);
|
|
4237
|
+
}
|
|
4238
|
+
function matchAtPosition() {
|
|
4239
|
+
if (match("position", /^at/, 0)) {
|
|
4240
|
+
const positioning = matchPositioning();
|
|
4241
|
+
return positioning || error("Missing positioning value"), positioning;
|
|
4242
|
+
}
|
|
4243
|
+
}
|
|
4244
|
+
function matchPositioning() {
|
|
4245
|
+
const location = {
|
|
4246
|
+
x: matchDistance(),
|
|
4247
|
+
y: matchDistance()
|
|
4248
|
+
};
|
|
4249
|
+
if (location.x || location.y) return {
|
|
4250
|
+
type: "position",
|
|
4251
|
+
value: location
|
|
4252
|
+
};
|
|
4253
|
+
}
|
|
4254
|
+
function matchListing(matcher) {
|
|
4255
|
+
let captures = matcher();
|
|
4256
|
+
const result = [];
|
|
4257
|
+
if (captures) for (result.push(captures); scan(tokens.comma);) captures = matcher(), captures ? result.push(captures) : error("One extra comma");
|
|
4258
|
+
return result;
|
|
4259
|
+
}
|
|
4260
|
+
function matchColorStop() {
|
|
4261
|
+
const color = match("hex", tokens.hexColor, 1) || match("rgba", tokens.rgbaColor, 1) || match("rgb", tokens.rgbColor, 1) || match("literal", tokens.literalColor, 0);
|
|
4262
|
+
return color || error("Expected color definition"), color.length = matchDistance(), color;
|
|
4263
|
+
}
|
|
4264
|
+
function matchDistance() {
|
|
4265
|
+
return match("%", tokens.percentageValue, 1) || match("position-keyword", tokens.positionKeywords, 1) || matchLength();
|
|
4266
|
+
}
|
|
4267
|
+
function matchLength() {
|
|
4268
|
+
return match("px", tokens.pixelValue, 1) || match("em", tokens.emValue, 1);
|
|
4269
|
+
}
|
|
4270
|
+
function match(type, pattern, captureIndex) {
|
|
4271
|
+
const captures = scan(pattern);
|
|
4272
|
+
if (captures) return {
|
|
4273
|
+
type: type,
|
|
4274
|
+
value: captures[captureIndex]
|
|
4275
|
+
};
|
|
4276
|
+
}
|
|
4277
|
+
function scan(regexp) {
|
|
4278
|
+
const blankCaptures = /^[\n\r\t\s]+/.exec(input);
|
|
4279
|
+
blankCaptures && consume(blankCaptures[0].length);
|
|
4280
|
+
const captures = regexp.exec(input);
|
|
4281
|
+
return captures && consume(captures[0].length), captures;
|
|
4282
|
+
}
|
|
4283
|
+
function consume(size) {
|
|
4284
|
+
input = input.substr(size);
|
|
4285
|
+
}
|
|
4286
|
+
return function (code) {
|
|
4287
|
+
return input = code.toString(), getAST();
|
|
4288
|
+
};
|
|
4289
|
+
}();
|
|
4290
|
+
class GradientParser {
|
|
4291
|
+
static IsGradient(c) {
|
|
4292
|
+
return !("string" == typeof c && !c.includes("gradient"));
|
|
4293
|
+
}
|
|
4294
|
+
static IsGradientStr(c) {
|
|
4295
|
+
return "string" == typeof c && c.includes("gradient");
|
|
4296
|
+
}
|
|
4297
|
+
static Parse(c) {
|
|
4298
|
+
if (GradientParser.IsGradientStr(c)) try {
|
|
4299
|
+
const datum = parse(c)[0];
|
|
4300
|
+
if (datum) {
|
|
4301
|
+
if ("linear" === datum.type) return GradientParser.ParseLinear(datum);
|
|
4302
|
+
if ("radial" === datum.type) return GradientParser.ParseRadial(datum);
|
|
4303
|
+
if ("conic" === datum.type) return GradientParser.ParseConic(datum);
|
|
4304
|
+
}
|
|
4305
|
+
} catch (err) {
|
|
4306
|
+
return c;
|
|
4307
|
+
}
|
|
4308
|
+
return c;
|
|
4309
|
+
}
|
|
4310
|
+
static ParseConic(datum) {
|
|
4311
|
+
const {
|
|
4312
|
+
orientation: orientation,
|
|
4313
|
+
colorStops = []
|
|
4314
|
+
} = datum,
|
|
4315
|
+
halfPi = pi / 2,
|
|
4316
|
+
sa = parseFloat(orientation.value) / 180 * pi - halfPi;
|
|
4317
|
+
return {
|
|
4318
|
+
gradient: "conical",
|
|
4319
|
+
x: .5,
|
|
4320
|
+
y: .5,
|
|
4321
|
+
startAngle: sa,
|
|
4322
|
+
endAngle: sa + pi2,
|
|
4323
|
+
stops: colorStops.map(item => ({
|
|
4324
|
+
color: item.value,
|
|
4325
|
+
offset: parseFloat(item.length.value) / 100
|
|
4326
|
+
}))
|
|
4327
|
+
};
|
|
4328
|
+
}
|
|
4329
|
+
static ParseRadial(datum) {
|
|
4330
|
+
const {
|
|
4331
|
+
colorStops = []
|
|
4332
|
+
} = datum;
|
|
4333
|
+
return {
|
|
4334
|
+
gradient: "radial",
|
|
4335
|
+
x0: .5,
|
|
4336
|
+
y0: .5,
|
|
4337
|
+
x1: .5,
|
|
4338
|
+
y1: .5,
|
|
4339
|
+
r0: 0,
|
|
4340
|
+
r1: 1,
|
|
4341
|
+
stops: colorStops.map(item => ({
|
|
4342
|
+
color: item.value,
|
|
4343
|
+
offset: parseFloat(item.length.value) / 100
|
|
4344
|
+
}))
|
|
4345
|
+
};
|
|
4346
|
+
}
|
|
4347
|
+
static ParseLinear(datum) {
|
|
4348
|
+
const {
|
|
4349
|
+
orientation: orientation,
|
|
4350
|
+
colorStops = []
|
|
4351
|
+
} = datum,
|
|
4352
|
+
halfPi = pi / 2;
|
|
4353
|
+
let angle = "angular" === orientation.type ? parseFloat(orientation.value) / 180 * pi : 0;
|
|
4354
|
+
for (; angle < 0;) angle += pi2;
|
|
4355
|
+
for (; angle >= pi2;) angle -= pi2;
|
|
4356
|
+
let x0 = 0,
|
|
4357
|
+
y0 = 0,
|
|
4358
|
+
x1 = 0,
|
|
4359
|
+
y1 = 0;
|
|
4360
|
+
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)), {
|
|
4361
|
+
gradient: "linear",
|
|
4362
|
+
x0: x0,
|
|
4363
|
+
y0: y0,
|
|
4364
|
+
x1: x1,
|
|
4365
|
+
y1: y1,
|
|
4366
|
+
stops: colorStops.map(item => ({
|
|
4367
|
+
color: item.value,
|
|
4368
|
+
offset: parseFloat(item.length.value) / 100
|
|
4369
|
+
}))
|
|
4370
|
+
};
|
|
4371
|
+
}
|
|
4372
|
+
}
|
|
4373
|
+
|
|
4374
|
+
function getScaledStroke(context, width, dpr) {
|
|
4375
|
+
let strokeWidth = width;
|
|
4376
|
+
const {
|
|
4377
|
+
a: a,
|
|
4378
|
+
b: b,
|
|
4379
|
+
c: c,
|
|
4380
|
+
d: d
|
|
4381
|
+
} = context.currentMatrix,
|
|
4382
|
+
scaleX = Math.sign(a) * Math.sqrt(a * a + b * b),
|
|
4383
|
+
scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);
|
|
4384
|
+
return scaleX + scaleY === 0 ? 0 : (strokeWidth = strokeWidth / Math.abs(scaleX + scaleY) * 2 * dpr, strokeWidth);
|
|
4385
|
+
}
|
|
4386
|
+
function createColor(context, c, params) {
|
|
4387
|
+
let offsetX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
4388
|
+
let offsetY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
4389
|
+
if (!c || !0 === c) return "black";
|
|
4390
|
+
let result, color;
|
|
4391
|
+
if (isArray$1(c)) for (let i = 0; i < c.length && (color = c[i], !color); i++);else color = c;
|
|
4392
|
+
if (color = GradientParser.Parse(color), "string" == typeof color) return color;
|
|
4393
|
+
if (params.AABBBounds && (!params.attribute || 0 !== params.attribute.scaleX || 0 !== params.attribute.scaleY)) {
|
|
4394
|
+
const bounds = params.AABBBounds;
|
|
4395
|
+
let w = bounds.x2 - bounds.x1,
|
|
4396
|
+
h = bounds.y2 - bounds.y1,
|
|
4397
|
+
x = bounds.x1 - offsetX,
|
|
4398
|
+
y = bounds.y1 - offsetY;
|
|
4399
|
+
if (params.attribute) {
|
|
4400
|
+
const {
|
|
4401
|
+
scaleX = 1,
|
|
4402
|
+
scaleY = 1
|
|
4403
|
+
} = params.attribute;
|
|
4404
|
+
w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY;
|
|
4405
|
+
}
|
|
4406
|
+
"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));
|
|
4407
|
+
}
|
|
4408
|
+
return result || "orange";
|
|
4409
|
+
}
|
|
4410
|
+
function createLinearGradient(context, color, x, y, w, h) {
|
|
4411
|
+
var _a, _b, _c, _d;
|
|
4412
|
+
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);
|
|
4413
|
+
return color.stops.forEach(stop => {
|
|
4414
|
+
canvasGradient.addColorStop(stop.offset, stop.color);
|
|
4415
|
+
}), canvasGradient;
|
|
4416
|
+
}
|
|
4417
|
+
function createRadialGradient(context, color, x, y, w, h) {
|
|
4418
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4419
|
+
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));
|
|
4420
|
+
return color.stops.forEach(stop => {
|
|
4421
|
+
canvasGradient.addColorStop(stop.offset, stop.color);
|
|
4422
|
+
}), canvasGradient;
|
|
4423
|
+
}
|
|
4424
|
+
function createConicGradient(context, color, x, y, w, h) {
|
|
4425
|
+
var _a, _b;
|
|
4426
|
+
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);
|
|
4427
|
+
return color.stops.forEach(stop => {
|
|
4428
|
+
canvasGradient.addColorStop(stop.offset, stop.color);
|
|
4429
|
+
}), canvasGradient.GetPattern(w + x, h + y, undefined);
|
|
4430
|
+
}
|
|
4431
|
+
|
|
4145
4432
|
const DIRECTION_KEY = {
|
|
4146
4433
|
horizontal: {
|
|
4147
4434
|
width: "width",
|
|
@@ -4193,14 +4480,16 @@ const setTextStyle = (ctx, character) => {
|
|
|
4193
4480
|
fontFamily: character.fontFamily || "sans-serif"
|
|
4194
4481
|
});
|
|
4195
4482
|
};
|
|
4196
|
-
function applyFillStyle(ctx, character) {
|
|
4483
|
+
function applyFillStyle(ctx, character, b) {
|
|
4197
4484
|
const fillStyle = character && character.fill || defaultFormatting.fill;
|
|
4198
4485
|
if (!fillStyle) return void (ctx.globalAlpha = 0);
|
|
4199
4486
|
const {
|
|
4200
4487
|
fillOpacity = 1,
|
|
4201
4488
|
opacity = 1
|
|
4202
4489
|
} = character;
|
|
4203
|
-
ctx.globalAlpha = fillOpacity * opacity, ctx.fillStyle =
|
|
4490
|
+
ctx.globalAlpha = fillOpacity * opacity, ctx.fillStyle = b ? createColor(ctx, fillStyle, {
|
|
4491
|
+
AABBBounds: b
|
|
4492
|
+
}) : fillStyle, setTextStyle(ctx, character);
|
|
4204
4493
|
}
|
|
4205
4494
|
function applyStrokeStyle(ctx, character) {
|
|
4206
4495
|
const strokeStyle = character && character.stroke || defaultFormatting.stroke;
|
|
@@ -11114,695 +11403,409 @@ class DefaultMatrixAllocate {
|
|
|
11114
11403
|
const m = this.pools.pop();
|
|
11115
11404
|
return m.a = a, m.b = b, m.c = c, m.d = d, m.e = e, m.f = f, m;
|
|
11116
11405
|
}
|
|
11117
|
-
allocateByObj(matrix) {
|
|
11118
|
-
if (!this.pools.length) return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
|
|
11119
|
-
const m = this.pools.pop();
|
|
11120
|
-
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;
|
|
11121
|
-
}
|
|
11122
|
-
free(d) {
|
|
11123
|
-
this.pools.push(d);
|
|
11124
|
-
}
|
|
11125
|
-
get length() {
|
|
11126
|
-
return this.pools.length;
|
|
11127
|
-
}
|
|
11128
|
-
release() {
|
|
11129
|
-
this.pools = [];
|
|
11130
|
-
}
|
|
11131
|
-
}
|
|
11132
|
-
class DefaultMat4Allocate {
|
|
11133
|
-
constructor() {
|
|
11134
|
-
this.pools = [];
|
|
11135
|
-
}
|
|
11136
|
-
static identity(out) {
|
|
11137
|
-
return identityMat4(out);
|
|
11138
|
-
}
|
|
11139
|
-
allocate() {
|
|
11140
|
-
if (!this.pools.length) return createMat4();
|
|
11141
|
-
const m = this.pools.pop();
|
|
11142
|
-
return DefaultMat4Allocate.identity(m), m;
|
|
11143
|
-
}
|
|
11144
|
-
allocateByObj(d) {
|
|
11145
|
-
let m;
|
|
11146
|
-
m = this.pools.length ? this.pools.pop() : createMat4();
|
|
11147
|
-
for (let i = 0; i < m.length; i++) m[i] = d[i];
|
|
11148
|
-
return m;
|
|
11149
|
-
}
|
|
11150
|
-
free(m) {
|
|
11151
|
-
m && this.pools.push(m);
|
|
11152
|
-
}
|
|
11153
|
-
get length() {
|
|
11154
|
-
return this.pools.length;
|
|
11155
|
-
}
|
|
11156
|
-
release() {
|
|
11157
|
-
this.pools = [];
|
|
11158
|
-
}
|
|
11159
|
-
}
|
|
11160
|
-
const matrixAllocate = new DefaultMatrixAllocate();
|
|
11161
|
-
const mat4Allocate = new DefaultMat4Allocate();
|
|
11162
|
-
|
|
11163
|
-
var __decorate$1B = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
11164
|
-
var d,
|
|
11165
|
-
c = arguments.length,
|
|
11166
|
-
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
11167
|
-
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);
|
|
11168
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11169
|
-
},
|
|
11170
|
-
__metadata$1d = undefined && undefined.__metadata || function (k, v) {
|
|
11171
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
11172
|
-
},
|
|
11173
|
-
__param$R = undefined && undefined.__param || function (paramIndex, decorator) {
|
|
11174
|
-
return function (target, key) {
|
|
11175
|
-
decorator(target, key, paramIndex);
|
|
11176
|
-
};
|
|
11177
|
-
};
|
|
11178
|
-
function getExtraModelMatrix(dx, dy, graphic) {
|
|
11179
|
-
const {
|
|
11180
|
-
alpha: alpha,
|
|
11181
|
-
beta: beta
|
|
11182
|
-
} = graphic.attribute;
|
|
11183
|
-
if (!alpha && !beta) return null;
|
|
11184
|
-
const {
|
|
11185
|
-
anchor3d = graphic.attribute.anchor
|
|
11186
|
-
} = graphic.attribute,
|
|
11187
|
-
_anchor = [0, 0];
|
|
11188
|
-
if (anchor3d) {
|
|
11189
|
-
if ("string" == typeof anchor3d[0]) {
|
|
11190
|
-
const ratio = parseFloat(anchor3d[0]) / 100,
|
|
11191
|
-
bounds = graphic.AABBBounds;
|
|
11192
|
-
_anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11193
|
-
} else _anchor[0] = anchor3d[0];
|
|
11194
|
-
if ("string" == typeof anchor3d[1]) {
|
|
11195
|
-
const ratio = parseFloat(anchor3d[1]) / 100,
|
|
11196
|
-
bounds = graphic.AABBBounds;
|
|
11197
|
-
_anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11198
|
-
} else _anchor[1] = anchor3d[1];
|
|
11199
|
-
}
|
|
11200
|
-
if ("text" === graphic.type) {
|
|
11201
|
-
const {
|
|
11202
|
-
textAlign: textAlign
|
|
11203
|
-
} = graphic.attribute;
|
|
11204
|
-
_anchor[0] += textDrawOffsetX(textAlign, graphic.clipedWidth);
|
|
11205
|
-
}
|
|
11206
|
-
_anchor[0] += dx, _anchor[1] += dy;
|
|
11207
|
-
const modelMatrix = mat4Allocate.allocate();
|
|
11208
|
-
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;
|
|
11209
|
-
}
|
|
11210
|
-
function getModelMatrix(out, graphic, theme) {
|
|
11211
|
-
var _a;
|
|
11212
|
-
const {
|
|
11213
|
-
x = theme.x,
|
|
11214
|
-
y = theme.y,
|
|
11215
|
-
z = theme.z,
|
|
11216
|
-
dx = theme.dx,
|
|
11217
|
-
dy = theme.dy,
|
|
11218
|
-
dz = theme.dz,
|
|
11219
|
-
scaleX = theme.scaleX,
|
|
11220
|
-
scaleY = theme.scaleY,
|
|
11221
|
-
scaleZ = theme.scaleZ,
|
|
11222
|
-
alpha = theme.alpha,
|
|
11223
|
-
beta = theme.beta,
|
|
11224
|
-
angle = theme.angle,
|
|
11225
|
-
anchor3d = graphic.attribute.anchor,
|
|
11226
|
-
anchor: anchor
|
|
11227
|
-
} = graphic.attribute,
|
|
11228
|
-
_anchor = [0, 0, 0];
|
|
11229
|
-
if (anchor3d) {
|
|
11230
|
-
if ("string" == typeof anchor3d[0]) {
|
|
11231
|
-
const ratio = parseFloat(anchor3d[0]) / 100,
|
|
11232
|
-
bounds = graphic.AABBBounds;
|
|
11233
|
-
_anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11234
|
-
} else _anchor[0] = anchor3d[0];
|
|
11235
|
-
if ("string" == typeof anchor3d[1]) {
|
|
11236
|
-
const ratio = parseFloat(anchor3d[1]) / 100,
|
|
11237
|
-
bounds = graphic.AABBBounds;
|
|
11238
|
-
_anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11239
|
-
} else _anchor[1] = anchor3d[1];
|
|
11240
|
-
_anchor[2] = null !== (_a = anchor3d[2]) && void 0 !== _a ? _a : 0;
|
|
11241
|
-
}
|
|
11242
|
-
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) {
|
|
11243
|
-
const m = mat4Allocate.allocate(),
|
|
11244
|
-
_anchor = [0, 0];
|
|
11245
|
-
if (anchor) {
|
|
11246
|
-
if ("string" == typeof anchor3d[0]) {
|
|
11247
|
-
const ratio = parseFloat(anchor3d[0]) / 100,
|
|
11248
|
-
bounds = graphic.AABBBounds;
|
|
11249
|
-
_anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11250
|
-
} else _anchor[0] = anchor3d[0];
|
|
11251
|
-
if ("string" == typeof anchor3d[1]) {
|
|
11252
|
-
const ratio = parseFloat(anchor3d[1]) / 100,
|
|
11253
|
-
bounds = graphic.AABBBounds;
|
|
11254
|
-
_anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11255
|
-
} else _anchor[1] = anchor3d[1];
|
|
11256
|
-
}
|
|
11257
|
-
translate(m, m, [_anchor[0], _anchor[1], 0]), rotateZ(m, m, angle), translate(m, m, [-_anchor[0], -_anchor[1], 0]), multiplyMat4Mat4(out, out, m);
|
|
11258
|
-
}
|
|
11259
|
-
}
|
|
11260
|
-
function shouldUseMat4(graphic) {
|
|
11261
|
-
const {
|
|
11262
|
-
alpha: alpha,
|
|
11263
|
-
beta: beta
|
|
11264
|
-
} = graphic.attribute;
|
|
11265
|
-
return alpha || beta;
|
|
11266
|
-
}
|
|
11267
|
-
let DefaultGraphicService = class {
|
|
11268
|
-
constructor(creator) {
|
|
11269
|
-
this.creator = creator, this.hooks = {
|
|
11270
|
-
onAttributeUpdate: new SyncHook(["graphic"]),
|
|
11271
|
-
onSetStage: new SyncHook(["graphic", "stage"]),
|
|
11272
|
-
onRemove: new SyncHook(["graphic"]),
|
|
11273
|
-
onRelease: new SyncHook(["graphic"]),
|
|
11274
|
-
onAddIncremental: new SyncHook(["graphic", "group", "stage"]),
|
|
11275
|
-
onClearIncremental: new SyncHook(["graphic", "group", "stage"]),
|
|
11276
|
-
beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
|
|
11277
|
-
afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"])
|
|
11278
|
-
}, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds();
|
|
11279
|
-
}
|
|
11280
|
-
onAttributeUpdate(graphic) {
|
|
11281
|
-
this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
|
|
11282
|
-
}
|
|
11283
|
-
onSetStage(graphic, stage) {
|
|
11284
|
-
this.hooks.onSetStage.taps.length && this.hooks.onSetStage.call(graphic, stage);
|
|
11285
|
-
}
|
|
11286
|
-
onRemove(graphic) {
|
|
11287
|
-
this.hooks.onRemove.taps.length && this.hooks.onRemove.call(graphic);
|
|
11288
|
-
}
|
|
11289
|
-
onRelease(graphic) {
|
|
11290
|
-
this.hooks.onRelease.taps.length && this.hooks.onRelease.call(graphic);
|
|
11291
|
-
}
|
|
11292
|
-
onAddIncremental(graphic, group, stage) {
|
|
11293
|
-
this.hooks.onAddIncremental.taps.length && this.hooks.onAddIncremental.call(graphic, group, stage);
|
|
11294
|
-
}
|
|
11295
|
-
onClearIncremental(group, stage) {
|
|
11296
|
-
this.hooks.onClearIncremental.taps.length && this.hooks.onClearIncremental.call(group, stage);
|
|
11297
|
-
}
|
|
11298
|
-
beforeUpdateAABBBounds(graphic, stage, willUpdate, bounds) {
|
|
11299
|
-
this.hooks.beforeUpdateAABBBounds.taps.length && this.hooks.beforeUpdateAABBBounds.call(graphic, stage, willUpdate, bounds);
|
|
11300
|
-
}
|
|
11301
|
-
afterUpdateAABBBounds(graphic, stage, bounds, params, selfChange) {
|
|
11302
|
-
this.hooks.afterUpdateAABBBounds.taps.length && this.hooks.afterUpdateAABBBounds.call(graphic, stage, bounds, params, selfChange);
|
|
11303
|
-
}
|
|
11304
|
-
updatePathProxyAABBBounds(aabbBounds, graphic) {
|
|
11305
|
-
const path = "function" == typeof graphic.pathProxy ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;
|
|
11306
|
-
if (!path) return !1;
|
|
11307
|
-
const boundsContext = new BoundsContext(aabbBounds);
|
|
11308
|
-
return renderCommandList(path.commandList, boundsContext, 0, 0), !0;
|
|
11309
|
-
}
|
|
11310
|
-
updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
|
|
11311
|
-
const {
|
|
11312
|
-
textAlign: textAlign,
|
|
11313
|
-
textBaseline: textBaseline
|
|
11314
|
-
} = attribute;
|
|
11315
|
-
if (null != attribute.forceBoundsHeight) {
|
|
11316
|
-
const h = isNumber$1(attribute.forceBoundsHeight) ? attribute.forceBoundsHeight : attribute.forceBoundsHeight(),
|
|
11317
|
-
dy = textLayoutOffsetY(textBaseline, h, h);
|
|
11318
|
-
aabbBounds.set(aabbBounds.x1, dy, aabbBounds.x2, dy + h);
|
|
11319
|
-
}
|
|
11320
|
-
if (null != attribute.forceBoundsWidth) {
|
|
11321
|
-
const w = isNumber$1(attribute.forceBoundsWidth) ? attribute.forceBoundsWidth : attribute.forceBoundsWidth(),
|
|
11322
|
-
dx = textDrawOffsetX(textAlign, w);
|
|
11323
|
-
aabbBounds.set(dx, aabbBounds.y1, dx + w, aabbBounds.y2);
|
|
11324
|
-
}
|
|
11325
|
-
}
|
|
11326
|
-
combindShadowAABBBounds(bounds, graphic) {
|
|
11327
|
-
if (graphic && graphic.shadowRoot) {
|
|
11328
|
-
const b = graphic.shadowRoot.AABBBounds;
|
|
11329
|
-
bounds.union(b);
|
|
11330
|
-
}
|
|
11331
|
-
}
|
|
11332
|
-
transformAABBBounds(attribute, aabbBounds, theme, miter, graphic) {
|
|
11333
|
-
if (!aabbBounds.empty()) {
|
|
11334
|
-
const {
|
|
11335
|
-
scaleX = theme.scaleX,
|
|
11336
|
-
scaleY = theme.scaleY,
|
|
11337
|
-
stroke = theme.stroke,
|
|
11338
|
-
shadowBlur = theme.shadowBlur,
|
|
11339
|
-
lineWidth = theme.lineWidth,
|
|
11340
|
-
pickStrokeBuffer = theme.pickStrokeBuffer,
|
|
11341
|
-
strokeBoundsBuffer = theme.strokeBoundsBuffer
|
|
11342
|
-
} = attribute,
|
|
11343
|
-
tb1 = this.tempAABBBounds1,
|
|
11344
|
-
tb2 = this.tempAABBBounds2;
|
|
11345
|
-
if (stroke && lineWidth) {
|
|
11346
|
-
const scaledHalfLineWidth = (lineWidth + pickStrokeBuffer) / Math.abs(scaleX + scaleY);
|
|
11347
|
-
boundStroke(tb1, scaledHalfLineWidth, miter, strokeBoundsBuffer), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
11348
|
-
}
|
|
11349
|
-
if (shadowBlur) {
|
|
11350
|
-
const {
|
|
11351
|
-
shadowOffsetX = theme.shadowOffsetX,
|
|
11352
|
-
shadowOffsetY = theme.shadowOffsetY
|
|
11353
|
-
} = attribute,
|
|
11354
|
-
shadowBlurWidth = shadowBlur / Math.abs(scaleX + scaleY) * 2;
|
|
11355
|
-
boundStroke(tb1, shadowBlurWidth, !1, strokeBoundsBuffer + 1), tb1.translate(shadowOffsetX, shadowOffsetY), aabbBounds.union(tb1);
|
|
11356
|
-
}
|
|
11357
|
-
}
|
|
11358
|
-
if (this.combindShadowAABBBounds(aabbBounds, graphic), aabbBounds.empty()) return;
|
|
11359
|
-
let updateMatrix = !0;
|
|
11360
|
-
const m = graphic.transMatrix;
|
|
11361
|
-
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);
|
|
11406
|
+
allocateByObj(matrix) {
|
|
11407
|
+
if (!this.pools.length) return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
|
|
11408
|
+
const m = this.pools.pop();
|
|
11409
|
+
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;
|
|
11362
11410
|
}
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
if (null != attribute.forceBoundsHeight || null != attribute.forceBoundsWidth) return !0;
|
|
11366
|
-
if (graphic.shadowRoot) return !0;
|
|
11367
|
-
if (!graphic.valid) return aabbBounds.clear(), !1;
|
|
11368
|
-
const {
|
|
11369
|
-
visible = theme.visible
|
|
11370
|
-
} = attribute;
|
|
11371
|
-
return !!visible || (aabbBounds.clear(), !1);
|
|
11411
|
+
free(d) {
|
|
11412
|
+
this.pools.push(d);
|
|
11372
11413
|
}
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
tb2 = this.tempAABBBounds2;
|
|
11376
|
-
return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), {
|
|
11377
|
-
tb1: tb1,
|
|
11378
|
-
tb2: tb2
|
|
11379
|
-
};
|
|
11414
|
+
get length() {
|
|
11415
|
+
return this.pools.length;
|
|
11380
11416
|
}
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
const result = {
|
|
11385
|
-
x: 0,
|
|
11386
|
-
y: 0,
|
|
11387
|
-
z: 0,
|
|
11388
|
-
lastModelMatrix: null
|
|
11389
|
-
};
|
|
11390
|
-
class BaseRender {
|
|
11391
|
-
init(contributions) {
|
|
11392
|
-
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));
|
|
11417
|
+
release() {
|
|
11418
|
+
this.pools = [];
|
|
11393
11419
|
}
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11398
|
-
}
|
|
11399
|
-
c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
|
|
11400
|
-
});
|
|
11420
|
+
}
|
|
11421
|
+
class DefaultMat4Allocate {
|
|
11422
|
+
constructor() {
|
|
11423
|
+
this.pools = [];
|
|
11401
11424
|
}
|
|
11402
|
-
|
|
11403
|
-
|
|
11404
|
-
if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
|
|
11405
|
-
if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
|
|
11406
|
-
}
|
|
11407
|
-
c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
|
|
11408
|
-
});
|
|
11425
|
+
static identity(out) {
|
|
11426
|
+
return identityMat4(out);
|
|
11409
11427
|
}
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
stroke = defaultAttribute.stroke,
|
|
11415
|
-
opacity = defaultAttribute.opacity,
|
|
11416
|
-
fillOpacity = defaultAttribute.fillOpacity,
|
|
11417
|
-
lineWidth = defaultAttribute.lineWidth,
|
|
11418
|
-
strokeOpacity = defaultAttribute.strokeOpacity,
|
|
11419
|
-
visible = defaultAttribute.visible
|
|
11420
|
-
} = graphic.attribute,
|
|
11421
|
-
fVisible = fillVisible(opacity, fillOpacity, fill),
|
|
11422
|
-
sVisible = strokeVisible(opacity, strokeOpacity),
|
|
11423
|
-
doFill = runFill(fill, background),
|
|
11424
|
-
doStroke = runStroke(stroke, lineWidth);
|
|
11425
|
-
return !(!graphic.valid || !visible) && !(!doFill && !doStroke) && !!(fVisible || sVisible || fillCb || strokeCb || background) && {
|
|
11426
|
-
fVisible: fVisible,
|
|
11427
|
-
sVisible: sVisible,
|
|
11428
|
-
doFill: doFill,
|
|
11429
|
-
doStroke: doStroke
|
|
11430
|
-
};
|
|
11428
|
+
allocate() {
|
|
11429
|
+
if (!this.pools.length) return createMat4();
|
|
11430
|
+
const m = this.pools.pop();
|
|
11431
|
+
return DefaultMat4Allocate.identity(m), m;
|
|
11431
11432
|
}
|
|
11432
|
-
|
|
11433
|
-
let
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
z = graphicAttribute.z,
|
|
11438
|
-
scaleX = graphicAttribute.scaleX,
|
|
11439
|
-
scaleY = graphicAttribute.scaleY,
|
|
11440
|
-
angle = graphicAttribute.angle,
|
|
11441
|
-
postMatrix: postMatrix
|
|
11442
|
-
} = graphic.attribute,
|
|
11443
|
-
lastModelMatrix = context.modelMatrix,
|
|
11444
|
-
camera = context.camera;
|
|
11445
|
-
result.x = x, result.y = y, result.z = z, result.lastModelMatrix = lastModelMatrix;
|
|
11446
|
-
const shouldTransform3d = camera && (use3dMatrixIn3dMode || shouldUseMat4(graphic)),
|
|
11447
|
-
onlyTranslate = shouldTransform3d ? graphic.transMatrix.onlyTranslate() && !postMatrix : 1 === scaleX && 1 === scaleY && 0 === angle && !postMatrix;
|
|
11448
|
-
if (shouldTransform3d) {
|
|
11449
|
-
const nextModelMatrix = mat4Allocate.allocate(),
|
|
11450
|
-
modelMatrix = mat4Allocate.allocate();
|
|
11451
|
-
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);
|
|
11452
|
-
}
|
|
11453
|
-
if (onlyTranslate && !lastModelMatrix) {
|
|
11454
|
-
const point = graphic.getOffsetXY(graphicAttribute);
|
|
11455
|
-
result.x += point.x, result.y += point.y, result.z = z, context.setTransformForCurrent();
|
|
11456
|
-
} 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) {
|
|
11457
|
-
const point = graphic.getOffsetXY(graphicAttribute);
|
|
11458
|
-
result.x += point.x, result.y += point.y, this.transformWithoutTranslate(context, result.x, result.y, result.z, scaleX, scaleY, angle);
|
|
11459
|
-
} else context.transformFromMatrix(graphic.transMatrix, !0), result.x = 0, result.y = 0, result.z = 0;
|
|
11460
|
-
return result;
|
|
11433
|
+
allocateByObj(d) {
|
|
11434
|
+
let m;
|
|
11435
|
+
m = this.pools.length ? this.pools.pop() : createMat4();
|
|
11436
|
+
for (let i = 0; i < m.length; i++) m[i] = d[i];
|
|
11437
|
+
return m;
|
|
11461
11438
|
}
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
if (this.camera = camera, camera) {
|
|
11465
|
-
const bounds = graphic.AABBBounds,
|
|
11466
|
-
width = bounds.x2 - bounds.x1,
|
|
11467
|
-
height = bounds.y2 - bounds.y1,
|
|
11468
|
-
p1 = context.project(0, 0, z),
|
|
11469
|
-
p2 = context.project(width, 0, z),
|
|
11470
|
-
p3 = context.project(width, height, z),
|
|
11471
|
-
_p1 = {
|
|
11472
|
-
x: 0,
|
|
11473
|
-
y: 0
|
|
11474
|
-
},
|
|
11475
|
-
_p2 = {
|
|
11476
|
-
x: width,
|
|
11477
|
-
y: 0
|
|
11478
|
-
},
|
|
11479
|
-
_p3 = {
|
|
11480
|
-
x: width,
|
|
11481
|
-
y: height
|
|
11482
|
-
};
|
|
11483
|
-
context.camera = null;
|
|
11484
|
-
const denom = 1 / (_p1.x * (_p3.y - _p2.y) - _p2.x * _p3.y + _p3.x * _p2.y + (_p2.x - _p3.x) * _p1.y),
|
|
11485
|
-
m11 = -(_p1.y * (p3.x - p2.x) - _p2.y * p3.x + _p3.y * p2.x + (_p2.y - _p3.y) * p1.x) * denom,
|
|
11486
|
-
m12 = (_p2.y * p3.y + _p1.y * (p2.y - p3.y) - _p3.y * p2.y + (_p3.y - _p2.y) * p1.y) * denom,
|
|
11487
|
-
m21 = (_p1.x * (p3.x - p2.x) - _p2.x * p3.x + _p3.x * p2.x + (_p2.x - _p3.x) * p1.x) * denom,
|
|
11488
|
-
m22 = -(_p2.x * p3.y + _p1.x * (p2.y - p3.y) - _p3.x * p2.y + (_p3.x - _p2.x) * p1.y) * denom,
|
|
11489
|
-
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,
|
|
11490
|
-
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;
|
|
11491
|
-
context.setTransform(m11, m12, m21, m22, dx, dy, !0);
|
|
11492
|
-
}
|
|
11439
|
+
free(m) {
|
|
11440
|
+
m && this.pools.push(m);
|
|
11493
11441
|
}
|
|
11494
|
-
|
|
11495
|
-
this.
|
|
11442
|
+
get length() {
|
|
11443
|
+
return this.pools.length;
|
|
11496
11444
|
}
|
|
11497
|
-
|
|
11498
|
-
|
|
11499
|
-
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();
|
|
11445
|
+
release() {
|
|
11446
|
+
this.pools = [];
|
|
11500
11447
|
}
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
|
|
11448
|
+
}
|
|
11449
|
+
const matrixAllocate = new DefaultMatrixAllocate();
|
|
11450
|
+
const mat4Allocate = new DefaultMat4Allocate();
|
|
11451
|
+
|
|
11452
|
+
var __decorate$1B = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
11453
|
+
var d,
|
|
11454
|
+
c = arguments.length,
|
|
11455
|
+
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
11456
|
+
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);
|
|
11457
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11458
|
+
},
|
|
11459
|
+
__metadata$1d = undefined && undefined.__metadata || function (k, v) {
|
|
11460
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
11461
|
+
},
|
|
11462
|
+
__param$R = undefined && undefined.__param || function (paramIndex, decorator) {
|
|
11463
|
+
return function (target, key) {
|
|
11464
|
+
decorator(target, key, paramIndex);
|
|
11465
|
+
};
|
|
11466
|
+
};
|
|
11467
|
+
function getExtraModelMatrix(dx, dy, graphic) {
|
|
11468
|
+
const {
|
|
11469
|
+
alpha: alpha,
|
|
11470
|
+
beta: beta
|
|
11471
|
+
} = graphic.attribute;
|
|
11472
|
+
if (!alpha && !beta) return null;
|
|
11473
|
+
const {
|
|
11474
|
+
anchor3d = graphic.attribute.anchor
|
|
11475
|
+
} = graphic.attribute,
|
|
11476
|
+
_anchor = [0, 0];
|
|
11477
|
+
if (anchor3d) {
|
|
11478
|
+
if ("string" == typeof anchor3d[0]) {
|
|
11479
|
+
const ratio = parseFloat(anchor3d[0]) / 100,
|
|
11480
|
+
bounds = graphic.AABBBounds;
|
|
11481
|
+
_anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11482
|
+
} else _anchor[0] = anchor3d[0];
|
|
11483
|
+
if ("string" == typeof anchor3d[1]) {
|
|
11484
|
+
const ratio = parseFloat(anchor3d[1]) / 100,
|
|
11485
|
+
bounds = graphic.AABBBounds;
|
|
11486
|
+
_anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11487
|
+
} else _anchor[1] = anchor3d[1];
|
|
11488
|
+
}
|
|
11489
|
+
if ("text" === graphic.type) {
|
|
11506
11490
|
const {
|
|
11507
|
-
|
|
11491
|
+
textAlign: textAlign
|
|
11508
11492
|
} = graphic.attribute;
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11493
|
+
_anchor[0] += textDrawOffsetX(textAlign, graphic.clipedWidth);
|
|
11494
|
+
}
|
|
11495
|
+
_anchor[0] += dx, _anchor[1] += dy;
|
|
11496
|
+
const modelMatrix = mat4Allocate.allocate();
|
|
11497
|
+
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;
|
|
11498
|
+
}
|
|
11499
|
+
function getModelMatrix(out, graphic, theme) {
|
|
11500
|
+
var _a;
|
|
11501
|
+
const {
|
|
11502
|
+
x = theme.x,
|
|
11503
|
+
y = theme.y,
|
|
11504
|
+
z = theme.z,
|
|
11505
|
+
dx = theme.dx,
|
|
11506
|
+
dy = theme.dy,
|
|
11507
|
+
dz = theme.dz,
|
|
11508
|
+
scaleX = theme.scaleX,
|
|
11509
|
+
scaleY = theme.scaleY,
|
|
11510
|
+
scaleZ = theme.scaleZ,
|
|
11511
|
+
alpha = theme.alpha,
|
|
11512
|
+
beta = theme.beta,
|
|
11513
|
+
angle = theme.angle,
|
|
11514
|
+
anchor3d = graphic.attribute.anchor,
|
|
11515
|
+
anchor: anchor
|
|
11516
|
+
} = graphic.attribute,
|
|
11517
|
+
_anchor = [0, 0, 0];
|
|
11518
|
+
if (anchor3d) {
|
|
11519
|
+
if ("string" == typeof anchor3d[0]) {
|
|
11520
|
+
const ratio = parseFloat(anchor3d[0]) / 100,
|
|
11521
|
+
bounds = graphic.AABBBounds;
|
|
11522
|
+
_anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11523
|
+
} else _anchor[0] = anchor3d[0];
|
|
11524
|
+
if ("string" == typeof anchor3d[1]) {
|
|
11525
|
+
const ratio = parseFloat(anchor3d[1]) / 100,
|
|
11526
|
+
bounds = graphic.AABBBounds;
|
|
11527
|
+
_anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11528
|
+
} else _anchor[1] = anchor3d[1];
|
|
11529
|
+
_anchor[2] = null !== (_a = anchor3d[2]) && void 0 !== _a ? _a : 0;
|
|
11530
|
+
}
|
|
11531
|
+
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) {
|
|
11532
|
+
const m = mat4Allocate.allocate(),
|
|
11533
|
+
_anchor = [0, 0];
|
|
11534
|
+
if (anchor) {
|
|
11535
|
+
if ("string" == typeof anchor3d[0]) {
|
|
11536
|
+
const ratio = parseFloat(anchor3d[0]) / 100,
|
|
11537
|
+
bounds = graphic.AABBBounds;
|
|
11538
|
+
_anchor[0] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11539
|
+
} else _anchor[0] = anchor3d[0];
|
|
11540
|
+
if ("string" == typeof anchor3d[1]) {
|
|
11541
|
+
const ratio = parseFloat(anchor3d[1]) / 100,
|
|
11542
|
+
bounds = graphic.AABBBounds;
|
|
11543
|
+
_anchor[1] = bounds.x1 + (bounds.x2 - bounds.x1) * ratio;
|
|
11544
|
+
} else _anchor[1] = anchor3d[1];
|
|
11545
|
+
}
|
|
11546
|
+
translate(m, m, [_anchor[0], _anchor[1], 0]), rotateZ(m, m, angle), translate(m, m, [-_anchor[0], -_anchor[1], 0]), multiplyMat4Mat4(out, out, m);
|
|
11519
11547
|
}
|
|
11520
11548
|
}
|
|
11521
|
-
|
|
11522
|
-
const
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
rgbColor: /^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,
|
|
11541
|
-
rgbaColor: /^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,
|
|
11542
|
-
number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
|
|
11543
|
-
};
|
|
11544
|
-
let input = "";
|
|
11545
|
-
function error(msg) {
|
|
11546
|
-
const err = new Error(input + ": " + msg);
|
|
11547
|
-
throw err.source = input, err;
|
|
11548
|
-
}
|
|
11549
|
-
function getAST() {
|
|
11550
|
-
const ast = matchListing(matchDefinition);
|
|
11551
|
-
return input.length > 0 && error("Invalid input not EOF"), ast;
|
|
11549
|
+
function shouldUseMat4(graphic) {
|
|
11550
|
+
const {
|
|
11551
|
+
alpha: alpha,
|
|
11552
|
+
beta: beta
|
|
11553
|
+
} = graphic.attribute;
|
|
11554
|
+
return alpha || beta;
|
|
11555
|
+
}
|
|
11556
|
+
let DefaultGraphicService = class {
|
|
11557
|
+
constructor(creator) {
|
|
11558
|
+
this.creator = creator, this.hooks = {
|
|
11559
|
+
onAttributeUpdate: new SyncHook(["graphic"]),
|
|
11560
|
+
onSetStage: new SyncHook(["graphic", "stage"]),
|
|
11561
|
+
onRemove: new SyncHook(["graphic"]),
|
|
11562
|
+
onRelease: new SyncHook(["graphic"]),
|
|
11563
|
+
onAddIncremental: new SyncHook(["graphic", "group", "stage"]),
|
|
11564
|
+
onClearIncremental: new SyncHook(["graphic", "group", "stage"]),
|
|
11565
|
+
beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
|
|
11566
|
+
afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"])
|
|
11567
|
+
}, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds();
|
|
11552
11568
|
}
|
|
11553
|
-
|
|
11554
|
-
|
|
11569
|
+
onAttributeUpdate(graphic) {
|
|
11570
|
+
this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
|
|
11555
11571
|
}
|
|
11556
|
-
|
|
11557
|
-
|
|
11558
|
-
const captures = scan(pattern);
|
|
11559
|
-
if (captures) {
|
|
11560
|
-
scan(tokens.startCall) || error("Missing (");
|
|
11561
|
-
const result = callback(captures);
|
|
11562
|
-
return scan(tokens.endCall) || error("Missing )"), result;
|
|
11563
|
-
}
|
|
11564
|
-
}(pattern, function (captures) {
|
|
11565
|
-
const orientation = orientationMatcher();
|
|
11566
|
-
return orientation && (scan(tokens.comma) || error("Missing comma before color stops")), {
|
|
11567
|
-
type: gradientType,
|
|
11568
|
-
orientation: orientation,
|
|
11569
|
-
colorStops: matchListing(matchColorStop)
|
|
11570
|
-
};
|
|
11571
|
-
});
|
|
11572
|
+
onSetStage(graphic, stage) {
|
|
11573
|
+
this.hooks.onSetStage.taps.length && this.hooks.onSetStage.call(graphic, stage);
|
|
11572
11574
|
}
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
+
onRemove(graphic) {
|
|
11576
|
+
this.hooks.onRemove.taps.length && this.hooks.onRemove.call(graphic);
|
|
11575
11577
|
}
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
+
onRelease(graphic) {
|
|
11579
|
+
this.hooks.onRelease.taps.length && this.hooks.onRelease.call(graphic);
|
|
11578
11580
|
}
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
lookaheadCache,
|
|
11582
|
-
radialOrientation = matchRadialOrientation();
|
|
11583
|
-
return radialOrientation && (radialOrientations = [], radialOrientations.push(radialOrientation), lookaheadCache = input, scan(tokens.comma) && (radialOrientation = matchRadialOrientation(), radialOrientation ? radialOrientations.push(radialOrientation) : input = lookaheadCache)), radialOrientations;
|
|
11581
|
+
onAddIncremental(graphic, group, stage) {
|
|
11582
|
+
this.hooks.onAddIncremental.taps.length && this.hooks.onAddIncremental.call(graphic, group, stage);
|
|
11584
11583
|
}
|
|
11585
|
-
|
|
11586
|
-
|
|
11587
|
-
const circle = match("shape", /^(circle)/i, 0);
|
|
11588
|
-
circle && (circle.style = matchLength() || matchExtentKeyword());
|
|
11589
|
-
return circle;
|
|
11590
|
-
}() || function () {
|
|
11591
|
-
const ellipse = match("shape", /^(ellipse)/i, 0);
|
|
11592
|
-
ellipse && (ellipse.style = matchDistance() || matchExtentKeyword());
|
|
11593
|
-
return ellipse;
|
|
11594
|
-
}();
|
|
11595
|
-
if (radialType) radialType.at = matchAtPosition();else {
|
|
11596
|
-
const extent = matchExtentKeyword();
|
|
11597
|
-
if (extent) {
|
|
11598
|
-
radialType = extent;
|
|
11599
|
-
const positionAt = matchAtPosition();
|
|
11600
|
-
positionAt && (radialType.at = positionAt);
|
|
11601
|
-
} else {
|
|
11602
|
-
const defaultPosition = matchPositioning();
|
|
11603
|
-
defaultPosition && (radialType = {
|
|
11604
|
-
type: "default-radial",
|
|
11605
|
-
at: defaultPosition
|
|
11606
|
-
});
|
|
11607
|
-
}
|
|
11608
|
-
}
|
|
11609
|
-
return radialType;
|
|
11584
|
+
onClearIncremental(group, stage) {
|
|
11585
|
+
this.hooks.onClearIncremental.taps.length && this.hooks.onClearIncremental.call(group, stage);
|
|
11610
11586
|
}
|
|
11611
|
-
|
|
11612
|
-
|
|
11587
|
+
beforeUpdateAABBBounds(graphic, stage, willUpdate, bounds) {
|
|
11588
|
+
this.hooks.beforeUpdateAABBBounds.taps.length && this.hooks.beforeUpdateAABBBounds.call(graphic, stage, willUpdate, bounds);
|
|
11613
11589
|
}
|
|
11614
|
-
|
|
11615
|
-
|
|
11616
|
-
const positioning = matchPositioning();
|
|
11617
|
-
return positioning || error("Missing positioning value"), positioning;
|
|
11618
|
-
}
|
|
11590
|
+
afterUpdateAABBBounds(graphic, stage, bounds, params, selfChange) {
|
|
11591
|
+
this.hooks.afterUpdateAABBBounds.taps.length && this.hooks.afterUpdateAABBBounds.call(graphic, stage, bounds, params, selfChange);
|
|
11619
11592
|
}
|
|
11620
|
-
|
|
11621
|
-
const
|
|
11622
|
-
|
|
11623
|
-
|
|
11624
|
-
|
|
11625
|
-
if (location.x || location.y) return {
|
|
11626
|
-
type: "position",
|
|
11627
|
-
value: location
|
|
11628
|
-
};
|
|
11593
|
+
updatePathProxyAABBBounds(aabbBounds, graphic) {
|
|
11594
|
+
const path = "function" == typeof graphic.pathProxy ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;
|
|
11595
|
+
if (!path) return !1;
|
|
11596
|
+
const boundsContext = new BoundsContext(aabbBounds);
|
|
11597
|
+
return renderCommandList(path.commandList, boundsContext, 0, 0), !0;
|
|
11629
11598
|
}
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11599
|
+
updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
|
|
11600
|
+
const {
|
|
11601
|
+
textAlign: textAlign,
|
|
11602
|
+
textBaseline: textBaseline
|
|
11603
|
+
} = attribute;
|
|
11604
|
+
if (null != attribute.forceBoundsHeight) {
|
|
11605
|
+
const h = isNumber$1(attribute.forceBoundsHeight) ? attribute.forceBoundsHeight : attribute.forceBoundsHeight(),
|
|
11606
|
+
dy = textLayoutOffsetY(textBaseline, h, h);
|
|
11607
|
+
aabbBounds.set(aabbBounds.x1, dy, aabbBounds.x2, dy + h);
|
|
11608
|
+
}
|
|
11609
|
+
if (null != attribute.forceBoundsWidth) {
|
|
11610
|
+
const w = isNumber$1(attribute.forceBoundsWidth) ? attribute.forceBoundsWidth : attribute.forceBoundsWidth(),
|
|
11611
|
+
dx = textDrawOffsetX(textAlign, w);
|
|
11612
|
+
aabbBounds.set(dx, aabbBounds.y1, dx + w, aabbBounds.y2);
|
|
11613
|
+
}
|
|
11635
11614
|
}
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
|
|
11615
|
+
combindShadowAABBBounds(bounds, graphic) {
|
|
11616
|
+
if (graphic && graphic.shadowRoot) {
|
|
11617
|
+
const b = graphic.shadowRoot.AABBBounds;
|
|
11618
|
+
bounds.union(b);
|
|
11619
|
+
}
|
|
11639
11620
|
}
|
|
11640
|
-
|
|
11641
|
-
|
|
11621
|
+
transformAABBBounds(attribute, aabbBounds, theme, miter, graphic) {
|
|
11622
|
+
if (!aabbBounds.empty()) {
|
|
11623
|
+
const {
|
|
11624
|
+
scaleX = theme.scaleX,
|
|
11625
|
+
scaleY = theme.scaleY,
|
|
11626
|
+
stroke = theme.stroke,
|
|
11627
|
+
shadowBlur = theme.shadowBlur,
|
|
11628
|
+
lineWidth = theme.lineWidth,
|
|
11629
|
+
pickStrokeBuffer = theme.pickStrokeBuffer,
|
|
11630
|
+
strokeBoundsBuffer = theme.strokeBoundsBuffer
|
|
11631
|
+
} = attribute,
|
|
11632
|
+
tb1 = this.tempAABBBounds1,
|
|
11633
|
+
tb2 = this.tempAABBBounds2;
|
|
11634
|
+
if (stroke && lineWidth) {
|
|
11635
|
+
const scaledHalfLineWidth = (lineWidth + pickStrokeBuffer) / Math.abs(scaleX + scaleY);
|
|
11636
|
+
boundStroke(tb1, scaledHalfLineWidth, miter, strokeBoundsBuffer), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
11637
|
+
}
|
|
11638
|
+
if (shadowBlur) {
|
|
11639
|
+
const {
|
|
11640
|
+
shadowOffsetX = theme.shadowOffsetX,
|
|
11641
|
+
shadowOffsetY = theme.shadowOffsetY
|
|
11642
|
+
} = attribute,
|
|
11643
|
+
shadowBlurWidth = shadowBlur / Math.abs(scaleX + scaleY) * 2;
|
|
11644
|
+
boundStroke(tb1, shadowBlurWidth, !1, strokeBoundsBuffer + 1), tb1.translate(shadowOffsetX, shadowOffsetY), aabbBounds.union(tb1);
|
|
11645
|
+
}
|
|
11646
|
+
}
|
|
11647
|
+
if (this.combindShadowAABBBounds(aabbBounds, graphic), aabbBounds.empty()) return;
|
|
11648
|
+
let updateMatrix = !0;
|
|
11649
|
+
const m = graphic.transMatrix;
|
|
11650
|
+
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);
|
|
11642
11651
|
}
|
|
11643
|
-
|
|
11644
|
-
|
|
11652
|
+
validCheck(attribute, theme, aabbBounds, graphic) {
|
|
11653
|
+
if (!graphic) return !0;
|
|
11654
|
+
if (null != attribute.forceBoundsHeight || null != attribute.forceBoundsWidth) return !0;
|
|
11655
|
+
if (graphic.shadowRoot) return !0;
|
|
11656
|
+
if (!graphic.valid) return aabbBounds.clear(), !1;
|
|
11657
|
+
const {
|
|
11658
|
+
visible = theme.visible
|
|
11659
|
+
} = attribute;
|
|
11660
|
+
return !!visible || (aabbBounds.clear(), !1);
|
|
11645
11661
|
}
|
|
11646
|
-
|
|
11647
|
-
const
|
|
11648
|
-
|
|
11649
|
-
|
|
11650
|
-
|
|
11662
|
+
updateTempAABBBounds(aabbBounds) {
|
|
11663
|
+
const tb1 = this.tempAABBBounds1,
|
|
11664
|
+
tb2 = this.tempAABBBounds2;
|
|
11665
|
+
return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), {
|
|
11666
|
+
tb1: tb1,
|
|
11667
|
+
tb2: tb2
|
|
11651
11668
|
};
|
|
11652
11669
|
}
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
11665
|
-
}();
|
|
11666
|
-
class GradientParser {
|
|
11667
|
-
static IsGradient(c) {
|
|
11668
|
-
return !("string" == typeof c && !c.includes("gradient"));
|
|
11669
|
-
}
|
|
11670
|
-
static IsGradientStr(c) {
|
|
11671
|
-
return "string" == typeof c && c.includes("gradient");
|
|
11670
|
+
};
|
|
11671
|
+
DefaultGraphicService = __decorate$1B([injectable(), __param$R(0, inject(GraphicCreator$1)), __metadata$1d("design:paramtypes", [Object])], DefaultGraphicService);
|
|
11672
|
+
|
|
11673
|
+
const result = {
|
|
11674
|
+
x: 0,
|
|
11675
|
+
y: 0,
|
|
11676
|
+
z: 0,
|
|
11677
|
+
lastModelMatrix: null
|
|
11678
|
+
};
|
|
11679
|
+
class BaseRender {
|
|
11680
|
+
init(contributions) {
|
|
11681
|
+
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));
|
|
11672
11682
|
}
|
|
11673
|
-
|
|
11674
|
-
|
|
11675
|
-
|
|
11676
|
-
|
|
11677
|
-
if ("linear" === datum.type) return GradientParser.ParseLinear(datum);
|
|
11678
|
-
if ("radial" === datum.type) return GradientParser.ParseRadial(datum);
|
|
11679
|
-
if ("conic" === datum.type) return GradientParser.ParseConic(datum);
|
|
11683
|
+
beforeRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
|
|
11684
|
+
this._beforeRenderContribitions && this._beforeRenderContribitions.forEach(c => {
|
|
11685
|
+
if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
|
|
11686
|
+
if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
|
|
11680
11687
|
}
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
}
|
|
11684
|
-
return c;
|
|
11688
|
+
c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
|
|
11689
|
+
});
|
|
11685
11690
|
}
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
}
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
return {
|
|
11694
|
-
gradient: "conical",
|
|
11695
|
-
x: .5,
|
|
11696
|
-
y: .5,
|
|
11697
|
-
startAngle: sa,
|
|
11698
|
-
endAngle: sa + pi2,
|
|
11699
|
-
stops: colorStops.map(item => ({
|
|
11700
|
-
color: item.value,
|
|
11701
|
-
offset: parseFloat(item.length.value) / 100
|
|
11702
|
-
}))
|
|
11703
|
-
};
|
|
11691
|
+
afterRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
|
|
11692
|
+
this._afterRenderContribitions && this._afterRenderContribitions.forEach(c => {
|
|
11693
|
+
if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
|
|
11694
|
+
if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
|
|
11695
|
+
}
|
|
11696
|
+
c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
|
|
11697
|
+
});
|
|
11704
11698
|
}
|
|
11705
|
-
|
|
11699
|
+
valid(graphic, defaultAttribute, fillCb, strokeCb) {
|
|
11706
11700
|
const {
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
|
|
11715
|
-
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
|
|
11720
|
-
|
|
11701
|
+
fill = defaultAttribute.fill,
|
|
11702
|
+
background: background,
|
|
11703
|
+
stroke = defaultAttribute.stroke,
|
|
11704
|
+
opacity = defaultAttribute.opacity,
|
|
11705
|
+
fillOpacity = defaultAttribute.fillOpacity,
|
|
11706
|
+
lineWidth = defaultAttribute.lineWidth,
|
|
11707
|
+
strokeOpacity = defaultAttribute.strokeOpacity,
|
|
11708
|
+
visible = defaultAttribute.visible
|
|
11709
|
+
} = graphic.attribute,
|
|
11710
|
+
fVisible = fillVisible(opacity, fillOpacity, fill),
|
|
11711
|
+
sVisible = strokeVisible(opacity, strokeOpacity),
|
|
11712
|
+
doFill = runFill(fill, background),
|
|
11713
|
+
doStroke = runStroke(stroke, lineWidth);
|
|
11714
|
+
return !(!graphic.valid || !visible) && !(!doFill && !doStroke) && !!(fVisible || sVisible || fillCb || strokeCb || background) && {
|
|
11715
|
+
fVisible: fVisible,
|
|
11716
|
+
sVisible: sVisible,
|
|
11717
|
+
doFill: doFill,
|
|
11718
|
+
doStroke: doStroke
|
|
11721
11719
|
};
|
|
11722
11720
|
}
|
|
11723
|
-
|
|
11721
|
+
transform(graphic, graphicAttribute, context) {
|
|
11722
|
+
let use3dMatrixIn3dMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
|
11724
11723
|
const {
|
|
11725
|
-
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
|
|
11731
|
-
|
|
11732
|
-
|
|
11733
|
-
|
|
11734
|
-
|
|
11735
|
-
|
|
11736
|
-
|
|
11737
|
-
|
|
11738
|
-
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
};
|
|
11724
|
+
x = graphicAttribute.x,
|
|
11725
|
+
y = graphicAttribute.y,
|
|
11726
|
+
z = graphicAttribute.z,
|
|
11727
|
+
scaleX = graphicAttribute.scaleX,
|
|
11728
|
+
scaleY = graphicAttribute.scaleY,
|
|
11729
|
+
angle = graphicAttribute.angle,
|
|
11730
|
+
postMatrix: postMatrix
|
|
11731
|
+
} = graphic.attribute,
|
|
11732
|
+
lastModelMatrix = context.modelMatrix,
|
|
11733
|
+
camera = context.camera;
|
|
11734
|
+
result.x = x, result.y = y, result.z = z, result.lastModelMatrix = lastModelMatrix;
|
|
11735
|
+
const shouldTransform3d = camera && (use3dMatrixIn3dMode || shouldUseMat4(graphic)),
|
|
11736
|
+
onlyTranslate = shouldTransform3d ? graphic.transMatrix.onlyTranslate() && !postMatrix : 1 === scaleX && 1 === scaleY && 0 === angle && !postMatrix;
|
|
11737
|
+
if (shouldTransform3d) {
|
|
11738
|
+
const nextModelMatrix = mat4Allocate.allocate(),
|
|
11739
|
+
modelMatrix = mat4Allocate.allocate();
|
|
11740
|
+
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);
|
|
11741
|
+
}
|
|
11742
|
+
if (onlyTranslate && !lastModelMatrix) {
|
|
11743
|
+
const point = graphic.getOffsetXY(graphicAttribute);
|
|
11744
|
+
result.x += point.x, result.y += point.y, result.z = z, context.setTransformForCurrent();
|
|
11745
|
+
} 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) {
|
|
11746
|
+
const point = graphic.getOffsetXY(graphicAttribute);
|
|
11747
|
+
result.x += point.x, result.y += point.y, this.transformWithoutTranslate(context, result.x, result.y, result.z, scaleX, scaleY, angle);
|
|
11748
|
+
} else context.transformFromMatrix(graphic.transMatrix, !0), result.x = 0, result.y = 0, result.z = 0;
|
|
11749
|
+
return result;
|
|
11747
11750
|
}
|
|
11748
|
-
|
|
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
|
-
scaleY = 1
|
|
11779
|
-
} = params.attribute;
|
|
11780
|
-
w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY;
|
|
11751
|
+
transformUseContext2d(graphic, graphicAttribute, z, context) {
|
|
11752
|
+
const camera = context.camera;
|
|
11753
|
+
if (this.camera = camera, camera) {
|
|
11754
|
+
const bounds = graphic.AABBBounds,
|
|
11755
|
+
width = bounds.x2 - bounds.x1,
|
|
11756
|
+
height = bounds.y2 - bounds.y1,
|
|
11757
|
+
p1 = context.project(0, 0, z),
|
|
11758
|
+
p2 = context.project(width, 0, z),
|
|
11759
|
+
p3 = context.project(width, height, z),
|
|
11760
|
+
_p1 = {
|
|
11761
|
+
x: 0,
|
|
11762
|
+
y: 0
|
|
11763
|
+
},
|
|
11764
|
+
_p2 = {
|
|
11765
|
+
x: width,
|
|
11766
|
+
y: 0
|
|
11767
|
+
},
|
|
11768
|
+
_p3 = {
|
|
11769
|
+
x: width,
|
|
11770
|
+
y: height
|
|
11771
|
+
};
|
|
11772
|
+
context.camera = null;
|
|
11773
|
+
const denom = 1 / (_p1.x * (_p3.y - _p2.y) - _p2.x * _p3.y + _p3.x * _p2.y + (_p2.x - _p3.x) * _p1.y),
|
|
11774
|
+
m11 = -(_p1.y * (p3.x - p2.x) - _p2.y * p3.x + _p3.y * p2.x + (_p2.y - _p3.y) * p1.x) * denom,
|
|
11775
|
+
m12 = (_p2.y * p3.y + _p1.y * (p2.y - p3.y) - _p3.y * p2.y + (_p3.y - _p2.y) * p1.y) * denom,
|
|
11776
|
+
m21 = (_p1.x * (p3.x - p2.x) - _p2.x * p3.x + _p3.x * p2.x + (_p2.x - _p3.x) * p1.x) * denom,
|
|
11777
|
+
m22 = -(_p2.x * p3.y + _p1.x * (p2.y - p3.y) - _p3.x * p2.y + (_p3.x - _p2.x) * p1.y) * denom,
|
|
11778
|
+
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,
|
|
11779
|
+
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;
|
|
11780
|
+
context.setTransform(m11, m12, m21, m22, dx, dy, !0);
|
|
11781
11781
|
}
|
|
11782
|
-
"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));
|
|
11783
11782
|
}
|
|
11784
|
-
|
|
11785
|
-
|
|
11786
|
-
|
|
11787
|
-
|
|
11788
|
-
|
|
11789
|
-
|
|
11790
|
-
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11783
|
+
restoreTransformUseContext2d(graphic, graphicAttribute, z, context) {
|
|
11784
|
+
this.camera && (context.camera = this.camera);
|
|
11785
|
+
}
|
|
11786
|
+
transformWithoutTranslate(context, x, y, z, scaleX, scaleY, angle) {
|
|
11787
|
+
const p = context.project(x, y, z);
|
|
11788
|
+
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();
|
|
11789
|
+
}
|
|
11790
|
+
_draw(graphic, defaultAttr, computed3dMatrix, drawContext, params) {
|
|
11791
|
+
const {
|
|
11792
|
+
context: context
|
|
11793
|
+
} = drawContext;
|
|
11794
|
+
if (!context) return;
|
|
11795
|
+
const {
|
|
11796
|
+
renderable: renderable
|
|
11797
|
+
} = graphic.attribute;
|
|
11798
|
+
if (!1 === renderable) return;
|
|
11799
|
+
context.highPerformanceSave();
|
|
11800
|
+
const data = this.transform(graphic, defaultAttr, context, computed3dMatrix),
|
|
11801
|
+
{
|
|
11802
|
+
x: x,
|
|
11803
|
+
y: y,
|
|
11804
|
+
z: z,
|
|
11805
|
+
lastModelMatrix: lastModelMatrix
|
|
11806
|
+
} = data;
|
|
11807
|
+
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();
|
|
11808
|
+
}
|
|
11806
11809
|
}
|
|
11807
11810
|
|
|
11808
11811
|
var __decorate$1A = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
@@ -12029,7 +12032,8 @@ class DefaultArcRenderContribution {
|
|
|
12029
12032
|
x: originX = arcAttribute.x,
|
|
12030
12033
|
y: originY = arcAttribute.y,
|
|
12031
12034
|
scaleX = arcAttribute.scaleX,
|
|
12032
|
-
scaleY = arcAttribute.scaleY
|
|
12035
|
+
scaleY = arcAttribute.scaleY,
|
|
12036
|
+
keepStrokeScale = arcAttribute.keepStrokeScale
|
|
12033
12037
|
} = arc.attribute;
|
|
12034
12038
|
let {
|
|
12035
12039
|
innerRadius = arcAttribute.innerRadius,
|
|
@@ -12041,7 +12045,7 @@ class DefaultArcRenderContribution {
|
|
|
12041
12045
|
{
|
|
12042
12046
|
distance = arcAttribute[key].distance
|
|
12043
12047
|
} = borderStyle,
|
|
12044
|
-
d = getScaledStroke(context, distance, context.dpr),
|
|
12048
|
+
d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
|
|
12045
12049
|
deltaAngle = distance / outerRadius,
|
|
12046
12050
|
sign = "outerBorder" === key ? 1 : -1;
|
|
12047
12051
|
if (arc.setAttributes({
|
|
@@ -12086,14 +12090,15 @@ class DefaultCircleRenderContribution {
|
|
|
12086
12090
|
x: originX = circleAttribute.x,
|
|
12087
12091
|
y: originY = circleAttribute.y,
|
|
12088
12092
|
scaleX = circleAttribute.scaleX,
|
|
12089
|
-
scaleY = circleAttribute.scaleY
|
|
12093
|
+
scaleY = circleAttribute.scaleY,
|
|
12094
|
+
keepStrokeScale = circleAttribute.keepStrokeScale
|
|
12090
12095
|
} = circle.attribute,
|
|
12091
12096
|
renderBorder = (borderStyle, key) => {
|
|
12092
12097
|
const doStroke = !(!borderStyle || !borderStyle.stroke),
|
|
12093
12098
|
{
|
|
12094
12099
|
distance = circleAttribute[key].distance
|
|
12095
12100
|
} = borderStyle,
|
|
12096
|
-
d = getScaledStroke(context, distance, context.dpr),
|
|
12101
|
+
d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
|
|
12097
12102
|
sign = "outerBorder" === key ? 1 : -1;
|
|
12098
12103
|
if (context.beginPath(), context.arc(x, y, radius + sign * d, startAngle, endAngle), context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(circle, circle.attribute, circleAttribute), strokeCb) strokeCb(context, borderStyle, circleAttribute[key]);else if (doStroke) {
|
|
12099
12104
|
const lastOpacity = circleAttribute[key].opacity;
|
|
@@ -12212,7 +12217,8 @@ class DefaultRectRenderContribution {
|
|
|
12212
12217
|
scaleX = rectAttribute.scaleX,
|
|
12213
12218
|
scaleY = rectAttribute.scaleY,
|
|
12214
12219
|
x1: x1,
|
|
12215
|
-
y1: y1
|
|
12220
|
+
y1: y1,
|
|
12221
|
+
keepStrokeScale = rectAttribute.keepStrokeScale
|
|
12216
12222
|
} = rect.attribute;
|
|
12217
12223
|
let {
|
|
12218
12224
|
width: width,
|
|
@@ -12225,7 +12231,7 @@ class DefaultRectRenderContribution {
|
|
|
12225
12231
|
{
|
|
12226
12232
|
distance = rectAttribute[key].distance
|
|
12227
12233
|
} = borderStyle,
|
|
12228
|
-
d = getScaledStroke(context, distance, context.dpr),
|
|
12234
|
+
d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
|
|
12229
12235
|
nextX = x + sign * d,
|
|
12230
12236
|
nextY = y + sign * d,
|
|
12231
12237
|
dw = 2 * d;
|
|
@@ -12382,14 +12388,15 @@ class DefaultSymbolRenderContribution {
|
|
|
12382
12388
|
x: originX = symbolAttribute.x,
|
|
12383
12389
|
y: originY = symbolAttribute.y,
|
|
12384
12390
|
scaleX = symbolAttribute.scaleX,
|
|
12385
|
-
scaleY = symbolAttribute.scaleY
|
|
12391
|
+
scaleY = symbolAttribute.scaleY,
|
|
12392
|
+
keepStrokeScale = symbolAttribute.keepStrokeScale
|
|
12386
12393
|
} = symbol.attribute,
|
|
12387
12394
|
renderBorder = (borderStyle, key) => {
|
|
12388
12395
|
const doStroke = !(!borderStyle || !borderStyle.stroke),
|
|
12389
12396
|
{
|
|
12390
12397
|
distance = symbolAttribute[key].distance
|
|
12391
12398
|
} = borderStyle,
|
|
12392
|
-
d = getScaledStroke(context, distance, context.dpr),
|
|
12399
|
+
d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
|
|
12393
12400
|
sign = "outerBorder" === key ? 1 : -1;
|
|
12394
12401
|
if (context.beginPath(), !1 === parsedPath.drawOffset(context, size, x, y, sign * d) && context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), strokeCb) strokeCb(context, borderStyle, symbolAttribute[key]);else if (doStroke) {
|
|
12395
12402
|
const lastOpacity = symbolAttribute[key].opacity;
|
|
@@ -14214,7 +14221,10 @@ class ShadowRootDrawItemInterceptorContribution {
|
|
|
14214
14221
|
const {
|
|
14215
14222
|
context: context
|
|
14216
14223
|
} = drawContext;
|
|
14217
|
-
|
|
14224
|
+
context.highPerformanceSave();
|
|
14225
|
+
const t1 = graphic.parent.globalTransMatrix,
|
|
14226
|
+
t2 = graphic.stage.window.getViewBoxTransform().clone().multiply(t1.a, t1.b, t1.c, t1.d, t1.e, t1.f);
|
|
14227
|
+
if (graphic.parent && context.setTransformFromMatrix(t2, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
|
|
14218
14228
|
tempDirtyBounds.copy(drawContribution.dirtyBounds), tempBackupDirtyBounds.copy(drawContribution.backupDirtyBounds);
|
|
14219
14229
|
const m = graphic.globalTransMatrix.getInverse();
|
|
14220
14230
|
drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m), drawContribution.backupDirtyBounds.copy(drawContribution.dirtyBounds);
|
|
@@ -15237,6 +15247,9 @@ class BaseSymbol {
|
|
|
15237
15247
|
bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
|
|
15238
15248
|
} else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
|
|
15239
15249
|
}
|
|
15250
|
+
parseSize(size) {
|
|
15251
|
+
return isNumber$1(size) ? size : Math.min(size[0], size[1]);
|
|
15252
|
+
}
|
|
15240
15253
|
}
|
|
15241
15254
|
|
|
15242
15255
|
function circle(ctx, r, x, y, z) {
|
|
@@ -15247,13 +15260,13 @@ class CircleSymbol extends BaseSymbol {
|
|
|
15247
15260
|
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";
|
|
15248
15261
|
}
|
|
15249
15262
|
draw(ctx, size, x, y, z) {
|
|
15250
|
-
return circle(ctx, size / 2, x, y, z);
|
|
15263
|
+
return circle(ctx, this.parseSize(size) / 2, x, y, z);
|
|
15251
15264
|
}
|
|
15252
15265
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15253
|
-
return circle(ctx, size / 2 + offset, x, y, z);
|
|
15266
|
+
return circle(ctx, this.parseSize(size) / 2 + offset, x, y, z);
|
|
15254
15267
|
}
|
|
15255
15268
|
drawToSvgPath(size, x, y, z) {
|
|
15256
|
-
const r = size / 2;
|
|
15269
|
+
const r = this.parseSize(size) / 2;
|
|
15257
15270
|
return `M ${x - r}, ${y} a ${r},${r} 0 1,0 ${2 * r},0 a ${r},${r} 0 1,0 -${2 * r},0`;
|
|
15258
15271
|
}
|
|
15259
15272
|
}
|
|
@@ -15270,10 +15283,10 @@ class CrossSymbol extends BaseSymbol {
|
|
|
15270
15283
|
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";
|
|
15271
15284
|
}
|
|
15272
15285
|
draw(ctx, size, x, y, z) {
|
|
15273
|
-
return cross(ctx, size / 6, x, y, z);
|
|
15286
|
+
return cross(ctx, this.parseSize(size) / 6, x, y, z);
|
|
15274
15287
|
}
|
|
15275
15288
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15276
|
-
return crossOffset(ctx, size / 6, x, y, offset, z);
|
|
15289
|
+
return crossOffset(ctx, this.parseSize(size) / 6, x, y, offset, z);
|
|
15277
15290
|
}
|
|
15278
15291
|
}
|
|
15279
15292
|
var cross$1 = new CrossSymbol();
|
|
@@ -15286,13 +15299,13 @@ class DiamondSymbol extends BaseSymbol {
|
|
|
15286
15299
|
super(...arguments), this.type = "diamond", this.pathStr = "M-0.5,0L0,-0.5L0.5,0L0,0.5Z";
|
|
15287
15300
|
}
|
|
15288
15301
|
draw(ctx, size, x, y, z) {
|
|
15289
|
-
return diamond(ctx, size / 2, x, y, z);
|
|
15302
|
+
return diamond(ctx, this.parseSize(size) / 2, x, y, z);
|
|
15290
15303
|
}
|
|
15291
15304
|
drawFitDir(ctx, size, x, y, z) {
|
|
15292
|
-
return diamond(ctx, size / 2, x, y, z);
|
|
15305
|
+
return diamond(ctx, this.parseSize(size) / 2, x, y, z);
|
|
15293
15306
|
}
|
|
15294
15307
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15295
|
-
return diamond(ctx, size / 2 + offset, x, y, z);
|
|
15308
|
+
return diamond(ctx, this.parseSize(size) / 2 + offset, x, y, z);
|
|
15296
15309
|
}
|
|
15297
15310
|
}
|
|
15298
15311
|
var diamond$1 = new DiamondSymbol();
|
|
@@ -15306,10 +15319,10 @@ class SquareSymbol extends BaseSymbol {
|
|
|
15306
15319
|
super(...arguments), this.type = "square", this.pathStr = "M-0.5,-0.5h1v1h-1Z";
|
|
15307
15320
|
}
|
|
15308
15321
|
draw(ctx, size, x, y) {
|
|
15309
|
-
return square(ctx, size / 2, x, y);
|
|
15322
|
+
return square(ctx, this.parseSize(size) / 2, x, y);
|
|
15310
15323
|
}
|
|
15311
15324
|
drawOffset(ctx, size, x, y, offset) {
|
|
15312
|
-
return square(ctx, size / 2 + offset, x, y);
|
|
15325
|
+
return square(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
15313
15326
|
}
|
|
15314
15327
|
}
|
|
15315
15328
|
var square$1 = new SquareSymbol();
|
|
@@ -15323,10 +15336,10 @@ class TriangleUpSymbol extends BaseSymbol {
|
|
|
15323
15336
|
super(...arguments), this.type = "triangleUp", this.pathStr = "M0.5,0.5 L-0.5,0.5 L0,-0.5 Z";
|
|
15324
15337
|
}
|
|
15325
15338
|
draw(ctx, size, x, y) {
|
|
15326
|
-
return trianglUpOffset(ctx, size / 2, x, y);
|
|
15339
|
+
return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
15327
15340
|
}
|
|
15328
15341
|
drawOffset(ctx, size, x, y, offset) {
|
|
15329
|
-
return trianglUpOffset(ctx, size / 2, x, y, offset);
|
|
15342
|
+
return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
15330
15343
|
}
|
|
15331
15344
|
}
|
|
15332
15345
|
var triangleUp = new TriangleUpSymbol();
|
|
@@ -15358,10 +15371,10 @@ class StarSymbol extends BaseSymbol {
|
|
|
15358
15371
|
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";
|
|
15359
15372
|
}
|
|
15360
15373
|
draw(ctx, size, transX, transY) {
|
|
15361
|
-
return star(ctx, size / 2, transX, transY);
|
|
15374
|
+
return star(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15362
15375
|
}
|
|
15363
15376
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15364
|
-
return star(ctx, size / 2 + offset, transX, transY);
|
|
15377
|
+
return star(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15365
15378
|
}
|
|
15366
15379
|
}
|
|
15367
15380
|
var star$1 = new StarSymbol();
|
|
@@ -15379,10 +15392,10 @@ class ArrowSymbol extends BaseSymbol {
|
|
|
15379
15392
|
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";
|
|
15380
15393
|
}
|
|
15381
15394
|
draw(ctx, size, transX, transY) {
|
|
15382
|
-
return arrow(ctx, size / 2, transX, transY);
|
|
15395
|
+
return arrow(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15383
15396
|
}
|
|
15384
15397
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15385
|
-
return arrow(ctx, size / 2 + offset, transX, transY);
|
|
15398
|
+
return arrow(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15386
15399
|
}
|
|
15387
15400
|
}
|
|
15388
15401
|
var arrow$1 = new ArrowSymbol();
|
|
@@ -15396,10 +15409,10 @@ class WedgeSymbol extends BaseSymbol {
|
|
|
15396
15409
|
super(...arguments), this.type = "wedge", this.pathStr = "M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z";
|
|
15397
15410
|
}
|
|
15398
15411
|
draw(ctx, size, transX, transY) {
|
|
15399
|
-
return wedge(ctx, size / 2, transX, transY);
|
|
15412
|
+
return wedge(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15400
15413
|
}
|
|
15401
15414
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15402
|
-
return wedge(ctx, size / 2 + offset, transX, transY);
|
|
15415
|
+
return wedge(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15403
15416
|
}
|
|
15404
15417
|
}
|
|
15405
15418
|
var wedge$1 = new WedgeSymbol();
|
|
@@ -15412,10 +15425,10 @@ class StrokeSymbol extends BaseSymbol {
|
|
|
15412
15425
|
super(...arguments), this.type = "stroke", this.pathStr = "";
|
|
15413
15426
|
}
|
|
15414
15427
|
draw(ctx, size, transX, transY) {
|
|
15415
|
-
return stroke(ctx, size / 2, transX, transY);
|
|
15428
|
+
return stroke(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15416
15429
|
}
|
|
15417
15430
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15418
|
-
return stroke(ctx, size / 2 + offset, transX, transY);
|
|
15431
|
+
return stroke(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15419
15432
|
}
|
|
15420
15433
|
}
|
|
15421
15434
|
var stroke$1 = new StrokeSymbol();
|
|
@@ -15437,10 +15450,10 @@ class WyeSymbol extends BaseSymbol {
|
|
|
15437
15450
|
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";
|
|
15438
15451
|
}
|
|
15439
15452
|
draw(ctx, size, transX, transY) {
|
|
15440
|
-
return wye(ctx, size / 2, transX, transY);
|
|
15453
|
+
return wye(ctx, this.parseSize(size) / 2, transX, transY);
|
|
15441
15454
|
}
|
|
15442
15455
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15443
|
-
return wye(ctx, size / 2 + offset, transX, transY);
|
|
15456
|
+
return wye(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
15444
15457
|
}
|
|
15445
15458
|
}
|
|
15446
15459
|
var wye$1 = new WyeSymbol();
|
|
@@ -15453,10 +15466,10 @@ class TriangleLeftSymbol extends BaseSymbol {
|
|
|
15453
15466
|
super(...arguments), this.type = "triangleLeft", this.pathStr = "M-0.5,0 L0.5,0.5 L0.5,-0.5 Z";
|
|
15454
15467
|
}
|
|
15455
15468
|
draw(ctx, size, x, y) {
|
|
15456
|
-
return trianglLeftOffset(ctx, size / 2, x, y, 0);
|
|
15469
|
+
return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, 0);
|
|
15457
15470
|
}
|
|
15458
15471
|
drawOffset(ctx, size, x, y, offset) {
|
|
15459
|
-
return trianglLeftOffset(ctx, size / 2, x, y, offset);
|
|
15472
|
+
return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
15460
15473
|
}
|
|
15461
15474
|
}
|
|
15462
15475
|
var triangleLeft = new TriangleLeftSymbol();
|
|
@@ -15470,10 +15483,10 @@ class TriangleRightSymbol extends BaseSymbol {
|
|
|
15470
15483
|
super(...arguments), this.type = "triangleRight", this.pathStr = "M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z";
|
|
15471
15484
|
}
|
|
15472
15485
|
draw(ctx, size, x, y) {
|
|
15473
|
-
return trianglRightOffset(ctx, size / 2, x, y);
|
|
15486
|
+
return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
15474
15487
|
}
|
|
15475
15488
|
drawOffset(ctx, size, x, y, offset) {
|
|
15476
|
-
return trianglRightOffset(ctx, size / 2, x, y, offset);
|
|
15489
|
+
return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
15477
15490
|
}
|
|
15478
15491
|
}
|
|
15479
15492
|
var triangleRight = new TriangleRightSymbol();
|
|
@@ -15487,10 +15500,10 @@ class TriangleDownSymbol extends BaseSymbol {
|
|
|
15487
15500
|
super(...arguments), this.type = "triangleDown", this.pathStr = "M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z";
|
|
15488
15501
|
}
|
|
15489
15502
|
draw(ctx, size, x, y) {
|
|
15490
|
-
return trianglDownOffset(ctx, size / 2, x, y);
|
|
15503
|
+
return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
15491
15504
|
}
|
|
15492
15505
|
drawOffset(ctx, size, x, y, offset) {
|
|
15493
|
-
return trianglDownOffset(ctx, size / 2, x, y, offset);
|
|
15506
|
+
return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
15494
15507
|
}
|
|
15495
15508
|
}
|
|
15496
15509
|
var triangleDown = new TriangleDownSymbol();
|
|
@@ -15505,10 +15518,10 @@ class ThinTriangleSymbol extends BaseSymbol {
|
|
|
15505
15518
|
super(...arguments), this.type = "thinTriangle", this.pathStr = "M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z";
|
|
15506
15519
|
}
|
|
15507
15520
|
draw(ctx, size, x, y) {
|
|
15508
|
-
return thinTriangle(ctx, size / 2 / sqrt3, x, y);
|
|
15521
|
+
return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3, x, y);
|
|
15509
15522
|
}
|
|
15510
15523
|
drawOffset(ctx, size, x, y, offset) {
|
|
15511
|
-
return thinTriangle(ctx, size / 2 / sqrt3 + offset, x, y);
|
|
15524
|
+
return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3 + offset, x, y);
|
|
15512
15525
|
}
|
|
15513
15526
|
}
|
|
15514
15527
|
var thinTriangle$1 = new ThinTriangleSymbol();
|
|
@@ -15522,10 +15535,10 @@ class Arrow2LeftSymbol extends BaseSymbol {
|
|
|
15522
15535
|
super(...arguments), this.type = "arrow2Left", this.pathStr = "M 0.25 -0.5 L -0.25 0 l 0.25 0.5";
|
|
15523
15536
|
}
|
|
15524
15537
|
draw(ctx, size, transX, transY) {
|
|
15525
|
-
return arrow2Left(ctx, size / 4, transX, transY);
|
|
15538
|
+
return arrow2Left(ctx, this.parseSize(size) / 4, transX, transY);
|
|
15526
15539
|
}
|
|
15527
15540
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15528
|
-
return arrow2Left(ctx, size / 4 + offset, transX, transY);
|
|
15541
|
+
return arrow2Left(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
15529
15542
|
}
|
|
15530
15543
|
}
|
|
15531
15544
|
var arrow2Left$1 = new Arrow2LeftSymbol();
|
|
@@ -15539,10 +15552,10 @@ class Arrow2RightSymbol extends BaseSymbol {
|
|
|
15539
15552
|
super(...arguments), this.type = "arrow2Right", this.pathStr = "M -0.25 -0.5 l 0.25 0 l -0.25 0.5";
|
|
15540
15553
|
}
|
|
15541
15554
|
draw(ctx, size, transX, transY) {
|
|
15542
|
-
return arrow2Right(ctx, size / 4, transX, transY);
|
|
15555
|
+
return arrow2Right(ctx, this.parseSize(size) / 4, transX, transY);
|
|
15543
15556
|
}
|
|
15544
15557
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15545
|
-
return arrow2Right(ctx, size / 4 + offset, transX, transY);
|
|
15558
|
+
return arrow2Right(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
15546
15559
|
}
|
|
15547
15560
|
}
|
|
15548
15561
|
var arrow2Right$1 = new Arrow2RightSymbol();
|
|
@@ -15556,10 +15569,10 @@ class Arrow2UpSymbol extends BaseSymbol {
|
|
|
15556
15569
|
super(...arguments), this.type = "arrow2Up", this.pathStr = "M -0.5 0.25 L 0 -0.25 l 0.5 0.25";
|
|
15557
15570
|
}
|
|
15558
15571
|
draw(ctx, size, transX, transY) {
|
|
15559
|
-
return arrow2Up(ctx, size / 4, transX, transY);
|
|
15572
|
+
return arrow2Up(ctx, this.parseSize(size) / 4, transX, transY);
|
|
15560
15573
|
}
|
|
15561
15574
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15562
|
-
return arrow2Up(ctx, size / 4 + offset, transX, transY);
|
|
15575
|
+
return arrow2Up(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
15563
15576
|
}
|
|
15564
15577
|
}
|
|
15565
15578
|
var arrow2Up$1 = new Arrow2UpSymbol();
|
|
@@ -15573,10 +15586,10 @@ class Arrow2DownSymbol extends BaseSymbol {
|
|
|
15573
15586
|
super(...arguments), this.type = "arrow2Down", this.pathStr = "M -0.5 -0.25 L 0 0.25 l 0.5 -0.25";
|
|
15574
15587
|
}
|
|
15575
15588
|
draw(ctx, size, transX, transY) {
|
|
15576
|
-
return arrow2Down(ctx, size / 4, transX, transY);
|
|
15589
|
+
return arrow2Down(ctx, this.parseSize(size) / 4, transX, transY);
|
|
15577
15590
|
}
|
|
15578
15591
|
drawOffset(ctx, size, transX, transY, offset) {
|
|
15579
|
-
return arrow2Down(ctx, size / 4 + offset, transX, transY);
|
|
15592
|
+
return arrow2Down(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
15580
15593
|
}
|
|
15581
15594
|
}
|
|
15582
15595
|
var arrow2Down$1 = new Arrow2DownSymbol();
|
|
@@ -15589,13 +15602,13 @@ class LineVSymbol extends BaseSymbol {
|
|
|
15589
15602
|
super(...arguments), this.type = "lineV", this.pathStr = "M0,-0.5L0,0.5";
|
|
15590
15603
|
}
|
|
15591
15604
|
draw(ctx, size, x, y, z) {
|
|
15592
|
-
return lineV(ctx, size / 2, x, y);
|
|
15605
|
+
return lineV(ctx, this.parseSize(size) / 2, x, y);
|
|
15593
15606
|
}
|
|
15594
15607
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15595
|
-
return lineV(ctx, size / 2 + offset, x, y);
|
|
15608
|
+
return lineV(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
15596
15609
|
}
|
|
15597
15610
|
drawToSvgPath(size, x, y, z) {
|
|
15598
|
-
const r = size / 2;
|
|
15611
|
+
const r = this.parseSize(size) / 2;
|
|
15599
15612
|
return `M ${x}, ${y - r} L ${x},${y + r}`;
|
|
15600
15613
|
}
|
|
15601
15614
|
}
|
|
@@ -15609,13 +15622,13 @@ class LineHSymbol extends BaseSymbol {
|
|
|
15609
15622
|
super(...arguments), this.type = "lineH", this.pathStr = "M-0.5,0L0.5,0";
|
|
15610
15623
|
}
|
|
15611
15624
|
draw(ctx, size, x, y, z) {
|
|
15612
|
-
return lineH(ctx, size / 2, x, y);
|
|
15625
|
+
return lineH(ctx, this.parseSize(size) / 2, x, y);
|
|
15613
15626
|
}
|
|
15614
15627
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15615
|
-
return lineH(ctx, size / 2 + offset, x, y);
|
|
15628
|
+
return lineH(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
15616
15629
|
}
|
|
15617
15630
|
drawToSvgPath(size, x, y, z) {
|
|
15618
|
-
const r = size / 2;
|
|
15631
|
+
const r = this.parseSize(size) / 2;
|
|
15619
15632
|
return `M ${x - r}, ${y} L ${x + r},${y}`;
|
|
15620
15633
|
}
|
|
15621
15634
|
}
|
|
@@ -15629,13 +15642,13 @@ class CloseSymbol extends BaseSymbol {
|
|
|
15629
15642
|
super(...arguments), this.type = "close", this.pathStr = "M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5";
|
|
15630
15643
|
}
|
|
15631
15644
|
draw(ctx, size, x, y, z) {
|
|
15632
|
-
return close(ctx, size / 2, x, y);
|
|
15645
|
+
return close(ctx, this.parseSize(size) / 2, x, y);
|
|
15633
15646
|
}
|
|
15634
15647
|
drawOffset(ctx, size, x, y, offset, z) {
|
|
15635
|
-
return close(ctx, size / 2 + offset, x, y);
|
|
15648
|
+
return close(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
15636
15649
|
}
|
|
15637
15650
|
drawToSvgPath(size, x, y, z) {
|
|
15638
|
-
const r = size / 2;
|
|
15651
|
+
const r = this.parseSize(size) / 2;
|
|
15639
15652
|
return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`;
|
|
15640
15653
|
}
|
|
15641
15654
|
}
|
|
@@ -15669,15 +15682,18 @@ class CustomSymbolClass {
|
|
|
15669
15682
|
this.pathStr = "", this.type = type, isArray$1(path) ? this.svgCache = path : this.path = path, this.isSvg = isSvg;
|
|
15670
15683
|
}
|
|
15671
15684
|
drawOffset(ctx, size, x, y, offset, z, cb) {
|
|
15672
|
-
return this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
|
|
15685
|
+
return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
|
|
15673
15686
|
ctx.beginPath(), renderCommandList(item.path.commandList, ctx, x, y, size, size), cb && cb(item.path, item.attribute);
|
|
15674
15687
|
}), !1) : (renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset), !1);
|
|
15675
15688
|
}
|
|
15676
15689
|
draw(ctx, size, x, y, z, cb) {
|
|
15677
|
-
return this.drawOffset(ctx, size, x, y, 0, z, cb);
|
|
15690
|
+
return size = this.parseSize(size), this.drawOffset(ctx, size, x, y, 0, z, cb);
|
|
15691
|
+
}
|
|
15692
|
+
parseSize(size) {
|
|
15693
|
+
return isNumber$1(size) ? size : Math.min(size[0], size[1]);
|
|
15678
15694
|
}
|
|
15679
15695
|
bounds(size, bounds) {
|
|
15680
|
-
if (this.isSvg) {
|
|
15696
|
+
if (size = this.parseSize(size), this.isSvg) {
|
|
15681
15697
|
if (!this.svgCache) return;
|
|
15682
15698
|
return bounds.clear(), void this.svgCache.forEach(_ref => {
|
|
15683
15699
|
let {
|
|
@@ -16360,7 +16376,11 @@ class Paragraph {
|
|
|
16360
16376
|
case "sub":
|
|
16361
16377
|
baseline += this.descent / 2;
|
|
16362
16378
|
}
|
|
16363
|
-
"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)
|
|
16379
|
+
"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);
|
|
16380
|
+
const {
|
|
16381
|
+
lineWidth = 1
|
|
16382
|
+
} = this.character;
|
|
16383
|
+
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();
|
|
16364
16384
|
}
|
|
16365
16385
|
getWidthWithEllips(direction) {
|
|
16366
16386
|
let text = this.text;
|
|
@@ -16583,12 +16603,18 @@ class Line {
|
|
|
16583
16603
|
paragraph.ellipsis = "hide", otherParagraphWidth += paragraph.width;
|
|
16584
16604
|
}
|
|
16585
16605
|
}
|
|
16586
|
-
this.paragraphs.
|
|
16606
|
+
this.paragraphs.forEach((paragraph, index) => {
|
|
16587
16607
|
if (paragraph instanceof RichTextIcon) return paragraph.setAttributes({
|
|
16588
16608
|
x: x + paragraph._x,
|
|
16589
16609
|
y: y + paragraph._y
|
|
16590
16610
|
}), void drawIcon(paragraph, ctx, x + paragraph._x, y + paragraph._y, this.ascent);
|
|
16591
|
-
|
|
16611
|
+
const b = {
|
|
16612
|
+
x1: this.left,
|
|
16613
|
+
y1: this.top,
|
|
16614
|
+
x2: this.left + this.actualWidth,
|
|
16615
|
+
y2: this.top + this.height
|
|
16616
|
+
};
|
|
16617
|
+
applyStrokeStyle(ctx, paragraph.character), applyFillStyle(ctx, paragraph.character, b), paragraph.draw(ctx, y + this.ascent, x, 0 === index, this.textAlign);
|
|
16592
16618
|
});
|
|
16593
16619
|
}
|
|
16594
16620
|
getWidthWithEllips(ellipsis) {
|
|
@@ -16611,7 +16637,7 @@ class Line {
|
|
|
16611
16637
|
paragraph.ellipsis = "hide", otherParagraphWidth += paragraph.width;
|
|
16612
16638
|
}
|
|
16613
16639
|
let width = 0;
|
|
16614
|
-
return this.paragraphs.
|
|
16640
|
+
return this.paragraphs.forEach((paragraph, index) => {
|
|
16615
16641
|
width += paragraph instanceof RichTextIcon ? paragraph.width : paragraph.getWidthWithEllips(this.direction);
|
|
16616
16642
|
}), width;
|
|
16617
16643
|
}
|
|
@@ -23917,7 +23943,7 @@ class Gesture extends EventEmitter {
|
|
|
23917
23943
|
startTime: startTime,
|
|
23918
23944
|
startPoints: startPoints
|
|
23919
23945
|
} = this;
|
|
23920
|
-
if (eventType) return eventType;
|
|
23946
|
+
if ("press" === eventType) return eventType;
|
|
23921
23947
|
let type;
|
|
23922
23948
|
return type = clock.now() - startTime > this.config.press.time && calcDistance(startPoints[0], point) < this.config.press.threshold ? "press" : "pan", this.eventType = type, type;
|
|
23923
23949
|
}
|
|
@@ -24449,9 +24475,10 @@ let BrowserContext2d = class {
|
|
|
24449
24475
|
lineJoin = defaultParams.lineJoin,
|
|
24450
24476
|
lineDash = defaultParams.lineDash,
|
|
24451
24477
|
lineCap = defaultParams.lineCap,
|
|
24452
|
-
miterLimit = defaultParams.miterLimit
|
|
24478
|
+
miterLimit = defaultParams.miterLimit,
|
|
24479
|
+
keepStrokeScale = defaultParams.keepStrokeScale
|
|
24453
24480
|
} = attribute;
|
|
24454
|
-
_context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
|
|
24481
|
+
_context.lineWidth = keepStrokeScale ? lineWidth : getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
|
|
24455
24482
|
}
|
|
24456
24483
|
}
|
|
24457
24484
|
setTextStyleWithoutAlignBaseline(params, defaultParams, z) {
|
|
@@ -25351,8 +25378,9 @@ class PickerBase {
|
|
|
25351
25378
|
return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, (context, arcAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, arcAttribute, themeAttribute) => {
|
|
25352
25379
|
if (picked) return !0;
|
|
25353
25380
|
const lineWidth = arcAttribute.lineWidth || themeAttribute.lineWidth,
|
|
25354
|
-
pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer
|
|
25355
|
-
|
|
25381
|
+
pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
|
|
25382
|
+
keepStrokeScale = arcAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
|
|
25383
|
+
return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
|
|
25356
25384
|
}), pickContext.highPerformanceRestore(), picked;
|
|
25357
25385
|
}
|
|
25358
25386
|
}
|
|
@@ -25625,8 +25653,9 @@ class RectPickerBase {
|
|
|
25625
25653
|
if (!onlyTranslate || rect.shadowRoot || isNumber$1(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(num => 0 !== num)) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, (context, rectAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, rectAttribute, themeAttribute) => {
|
|
25626
25654
|
if (picked) return !0;
|
|
25627
25655
|
const lineWidth = rectAttribute.lineWidth || themeAttribute.lineWidth,
|
|
25628
|
-
pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer
|
|
25629
|
-
|
|
25656
|
+
pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
|
|
25657
|
+
keepStrokeScale = rectAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
|
|
25658
|
+
return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
|
|
25630
25659
|
});else {
|
|
25631
25660
|
const {
|
|
25632
25661
|
fill = rectAttribute.fill,
|
|
@@ -25940,9 +25969,10 @@ let LynxContext2d = class extends BrowserContext2d {
|
|
|
25940
25969
|
lineJoin = defaultParams.lineJoin,
|
|
25941
25970
|
lineDash = defaultParams.lineDash,
|
|
25942
25971
|
lineCap = defaultParams.lineCap,
|
|
25943
|
-
miterLimit = defaultParams.miterLimit
|
|
25972
|
+
miterLimit = defaultParams.miterLimit,
|
|
25973
|
+
keepStrokeScale = defaultParams.keepStrokeScale
|
|
25944
25974
|
} = attribute;
|
|
25945
|
-
_context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
|
|
25975
|
+
_context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth = keepStrokeScale ? lineWidth : getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
|
|
25946
25976
|
}
|
|
25947
25977
|
}
|
|
25948
25978
|
measureText(text) {
|
|
@@ -26570,9 +26600,10 @@ let TaroContext2d = class extends BrowserContext2d {
|
|
|
26570
26600
|
lineJoin = defaultParams.lineJoin,
|
|
26571
26601
|
lineDash = defaultParams.lineDash,
|
|
26572
26602
|
lineCap = defaultParams.lineCap,
|
|
26573
|
-
miterLimit = defaultParams.miterLimit
|
|
26603
|
+
miterLimit = defaultParams.miterLimit,
|
|
26604
|
+
keepStrokeScale = defaultParams.keepStrokeScale
|
|
26574
26605
|
} = attribute;
|
|
26575
|
-
_context.setGlobalAlpha(strokeOpacity * opacity), _context.setLineWidth(getScaledStroke(this, lineWidth, this.dpr)), _context.setStrokeStyle(createColor(this, stroke, params, offsetX, offsetY)), _context.setLineJoin(lineJoin), lineDash && _context.setLineDash(lineDash), _context.setLineCap(lineCap), _context.setMiterLimit(miterLimit);
|
|
26606
|
+
_context.setGlobalAlpha(strokeOpacity * opacity), _context.setLineWidth(keepStrokeScale ? lineWidth : getScaledStroke(this, lineWidth, this.dpr)), _context.setStrokeStyle(createColor(this, stroke, params, offsetX, offsetY)), _context.setLineJoin(lineJoin), lineDash && _context.setLineDash(lineDash), _context.setLineCap(lineCap), _context.setMiterLimit(miterLimit);
|
|
26576
26607
|
}
|
|
26577
26608
|
}
|
|
26578
26609
|
setTextStyleWithoutAlignBaseline(params, defaultParams) {
|
|
@@ -27612,9 +27643,10 @@ let HarmonyContext2d = class extends BrowserContext2d {
|
|
|
27612
27643
|
lineJoin = defaultParams.lineJoin,
|
|
27613
27644
|
lineDash = defaultParams.lineDash,
|
|
27614
27645
|
lineCap = defaultParams.lineCap,
|
|
27615
|
-
miterLimit = defaultParams.miterLimit
|
|
27646
|
+
miterLimit = defaultParams.miterLimit,
|
|
27647
|
+
keepStrokeScale = defaultParams.keepStrokeScale
|
|
27616
27648
|
} = attribute;
|
|
27617
|
-
_context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
|
|
27649
|
+
_context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth = keepStrokeScale ? lineWidth : getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
|
|
27618
27650
|
}
|
|
27619
27651
|
}
|
|
27620
27652
|
measureText(text) {
|
|
@@ -28021,8 +28053,9 @@ class BaseLinePicker extends BaseRender {
|
|
|
28021
28053
|
return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, context => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, lineAttribute, themeAttribute) => {
|
|
28022
28054
|
if (picked) return !0;
|
|
28023
28055
|
const lineWidth = lineAttribute.lineWidth || themeAttribute.lineWidth,
|
|
28024
|
-
pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer
|
|
28025
|
-
|
|
28056
|
+
pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
|
|
28057
|
+
keepStrokeScale = lineAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
|
|
28058
|
+
return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
|
|
28026
28059
|
}), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
|
|
28027
28060
|
}
|
|
28028
28061
|
}
|
|
@@ -28157,8 +28190,9 @@ let DefaultCanvasSymbolPicker = class extends Base3dPicker {
|
|
|
28157
28190
|
return this.canvasRenderer.drawShape(symbol, pickContext, x, y, {}, null, (context, symbolAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, symbolAttribute, themeAttribute) => {
|
|
28158
28191
|
if (picked) return !0;
|
|
28159
28192
|
const lineWidth = symbolAttribute.lineWidth || themeAttribute.lineWidth,
|
|
28160
|
-
pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer
|
|
28161
|
-
|
|
28193
|
+
pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
|
|
28194
|
+
keepStrokeScale = symbolAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
|
|
28195
|
+
return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
|
|
28162
28196
|
}), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
|
|
28163
28197
|
}
|
|
28164
28198
|
};
|
|
@@ -28595,7 +28629,7 @@ const registerWrapText = _registerWrapText;
|
|
|
28595
28629
|
|
|
28596
28630
|
const roughModule = _roughModule;
|
|
28597
28631
|
|
|
28598
|
-
const version = "0.20.
|
|
28632
|
+
const version = "0.20.16";
|
|
28599
28633
|
preLoadAllModule();
|
|
28600
28634
|
if (isBrowserEnv()) {
|
|
28601
28635
|
loadBrowserEnv(container);
|