@visactor/vrender 1.1.5 → 1.1.6
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 +359 -109
- package/dist/index.js +359 -108
- 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.js
CHANGED
|
@@ -7112,18 +7112,21 @@
|
|
|
7112
7112
|
}
|
|
7113
7113
|
}
|
|
7114
7114
|
|
|
7115
|
-
function
|
|
7115
|
+
function getScaledStrokeWithMatrix(matrix, width, dpr) {
|
|
7116
7116
|
let strokeWidth = width;
|
|
7117
7117
|
const {
|
|
7118
7118
|
a: a,
|
|
7119
7119
|
b: b,
|
|
7120
7120
|
c: c,
|
|
7121
7121
|
d: d
|
|
7122
|
-
} =
|
|
7122
|
+
} = matrix,
|
|
7123
7123
|
scaleX = Math.sign(a) * Math.sqrt(a * a + b * b),
|
|
7124
7124
|
scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);
|
|
7125
7125
|
return scaleX + scaleY === 0 ? 0 : (strokeWidth = strokeWidth / Math.abs(scaleX + scaleY) * 2 * dpr, strokeWidth);
|
|
7126
7126
|
}
|
|
7127
|
+
function getScaledStroke(context, width, dpr) {
|
|
7128
|
+
return getScaledStrokeWithMatrix(context.currentMatrix, width, dpr);
|
|
7129
|
+
}
|
|
7127
7130
|
function createColor(context, c, params, offsetX = 0, offsetY = 0) {
|
|
7128
7131
|
var _a, _b, _c, _d;
|
|
7129
7132
|
if (!c || !0 === c) return "black";
|
|
@@ -8213,7 +8216,7 @@
|
|
|
8213
8216
|
}
|
|
8214
8217
|
class StateTransitionOrchestrator {
|
|
8215
8218
|
analyzeTransition(targetAttrs, hasAnimation, options = {}) {
|
|
8216
|
-
var _a, _b;
|
|
8219
|
+
var _a, _b, _c, _d;
|
|
8217
8220
|
const plan = {
|
|
8218
8221
|
targetAttrs: Object.assign({}, targetAttrs),
|
|
8219
8222
|
animateAttrs: {},
|
|
@@ -8222,10 +8225,17 @@
|
|
|
8222
8225
|
if (!hasAnimation) return plan;
|
|
8223
8226
|
const noWorkAnimateAttr = Object.assign(Object.assign({}, null !== (_a = options.noWorkAnimateAttr) && void 0 !== _a ? _a : {}), normalizeNoAnimateAttrConfig(null === (_b = options.animateConfig) || void 0 === _b ? void 0 : _b.noAnimateAttrs)),
|
|
8224
8227
|
isClear = !0 === options.isClear,
|
|
8225
|
-
|
|
8228
|
+
getDefaultAttribute = options.getDefaultAttribute,
|
|
8229
|
+
readDefaultAttribute = getDefaultAttribute,
|
|
8230
|
+
readStateTransitionDefaultAttribute = null !== (_c = options.getStateTransitionDefaultAttribute) && void 0 !== _c ? _c : getDefaultAttribute,
|
|
8226
8231
|
shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute,
|
|
8227
|
-
|
|
8228
|
-
|
|
8232
|
+
stateTransitionTargetAttrs = null !== (_d = options.stateTransitionTargetAttrs) && void 0 !== _d ? _d : targetAttrs,
|
|
8233
|
+
assignTransitionAttr = (key, value, isRemovedStateAttr = !1) => {
|
|
8234
|
+
if (noWorkAnimateAttr[key]) plan.noAnimateAttrs[key] = value;else if (isRemovedStateAttr && void 0 === value) {
|
|
8235
|
+
const defaultValue = null == readStateTransitionDefaultAttribute ? void 0 : readStateTransitionDefaultAttribute(key, stateTransitionTargetAttrs);
|
|
8236
|
+
if (void 0 === defaultValue && (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, stateTransitionTargetAttrs))) return;
|
|
8237
|
+
plan.animateAttrs[key] = defaultValue;
|
|
8238
|
+
} else if (isClear && void 0 === value) {
|
|
8229
8239
|
if (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) return;
|
|
8230
8240
|
plan.animateAttrs[key] = readDefaultAttribute(key);
|
|
8231
8241
|
} else plan.animateAttrs[key] = value;
|
|
@@ -8237,7 +8247,7 @@
|
|
|
8237
8247
|
const extraAnimateAttrs = options.extraAnimateAttrs;
|
|
8238
8248
|
if (extraAnimateAttrs) for (const key in extraAnimateAttrs) {
|
|
8239
8249
|
const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetAttrs, key);
|
|
8240
|
-
!Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key]);
|
|
8250
|
+
!Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key], !0);
|
|
8241
8251
|
}
|
|
8242
8252
|
return plan;
|
|
8243
8253
|
}
|
|
@@ -8269,9 +8279,11 @@
|
|
|
8269
8279
|
noWorkAnimateAttr: graphic.getNoWorkAnimateAttr(),
|
|
8270
8280
|
isClear: !0,
|
|
8271
8281
|
getDefaultAttribute: graphic.getDefaultAttribute.bind(graphic),
|
|
8282
|
+
getStateTransitionDefaultAttribute: options.getStateTransitionDefaultAttribute,
|
|
8272
8283
|
shouldSkipDefaultAttribute: null !== (_a = options.shouldSkipDefaultAttribute) && void 0 !== _a ? _a : graphic.shouldSkipStateTransitionDefaultAttribute.bind(graphic),
|
|
8273
8284
|
animateConfig: options.animateConfig,
|
|
8274
|
-
extraAnimateAttrs: options.extraAnimateAttrs
|
|
8285
|
+
extraAnimateAttrs: options.extraAnimateAttrs,
|
|
8286
|
+
stateTransitionTargetAttrs: options.stateTransitionTargetAttrs
|
|
8275
8287
|
});
|
|
8276
8288
|
return this.applyTransition(graphic, plan, hasAnimation, options);
|
|
8277
8289
|
}
|
|
@@ -8569,21 +8581,20 @@
|
|
|
8569
8581
|
}), snapshot) : snapshot;
|
|
8570
8582
|
}
|
|
8571
8583
|
buildRemovedStateAnimationAttrs(targetStateAttrs, previousResolvedStatePatch) {
|
|
8572
|
-
|
|
8573
|
-
if (!previousResolvedStatePatch) return extraAttrs;
|
|
8584
|
+
if (!previousResolvedStatePatch) return;
|
|
8574
8585
|
const snapshot = this.buildStaticAttributeSnapshot(),
|
|
8575
|
-
|
|
8586
|
+
extraAttrs = {};
|
|
8576
8587
|
return Object.keys(previousResolvedStatePatch).forEach(key => {
|
|
8577
8588
|
const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetStateAttrs, key);
|
|
8578
8589
|
if (hasTargetAttr && void 0 !== targetStateAttrs[key]) return;
|
|
8579
8590
|
const assignFallbackAttr = value => {
|
|
8580
|
-
|
|
8591
|
+
extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value);
|
|
8581
8592
|
};
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
}
|
|
8593
|
+
hasTargetAttr ? assignFallbackAttr(targetStateAttrs[key]) : Object.prototype.hasOwnProperty.call(snapshot, key) ? assignFallbackAttr(snapshot[key]) : assignFallbackAttr(void 0);
|
|
8594
|
+
}), {
|
|
8595
|
+
extraAttrs: extraAttrs,
|
|
8596
|
+
stateTransitionTargetAttrs: snapshot
|
|
8597
|
+
};
|
|
8587
8598
|
}
|
|
8588
8599
|
syncObjectToSnapshot(target, snapshot, excludedKeys) {
|
|
8589
8600
|
const delta = new Map();
|
|
@@ -9299,29 +9310,37 @@
|
|
|
9299
9310
|
resolvedStateAttrs: resolvedStateAttrs
|
|
9300
9311
|
} = this.resolveGraphicStateTransition(states, !0),
|
|
9301
9312
|
patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
|
|
9302
|
-
patchChanged
|
|
9313
|
+
if ((!patchChanged || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) && (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), patchChanged)) if (hasAnimation && animateSameStatePatchChange) {
|
|
9314
|
+
this._syncFinalAttributeFromStaticTruth();
|
|
9315
|
+
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
9316
|
+
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
9317
|
+
} else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
9303
9318
|
type: exports.AttributeUpdateType.STATE
|
|
9304
9319
|
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
9305
9320
|
type: exports.AttributeUpdateType.STATE
|
|
9306
|
-
}), this.emitStateUpdateEvent()
|
|
9321
|
+
}), this.emitStateUpdateEvent();
|
|
9307
9322
|
}
|
|
9308
9323
|
resolveStateAnimateConfig(animateConfig) {
|
|
9309
9324
|
var _a, _b, _c;
|
|
9310
9325
|
return null !== (_c = null !== (_a = null != animateConfig ? animateConfig : this.stateAnimateConfig) && void 0 !== _a ? _a : null === (_b = this.context) || void 0 === _b ? void 0 : _b.stateAnimateConfig) && void 0 !== _c ? _c : DefaultStateAnimateConfig;
|
|
9311
9326
|
}
|
|
9312
|
-
applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs) {
|
|
9327
|
+
applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs, stateTransitionTargetAttrs) {
|
|
9313
9328
|
const resolvedAnimateConfig = hasAnimation ? this.resolveStateAnimateConfig(animateConfig) : void 0,
|
|
9314
9329
|
transitionOptions = resolvedAnimateConfig ? {
|
|
9315
9330
|
animateConfig: resolvedAnimateConfig,
|
|
9316
9331
|
extraAnimateAttrs: extraAnimateAttrs,
|
|
9317
|
-
|
|
9332
|
+
getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
|
|
9333
|
+
shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
|
|
9334
|
+
stateTransitionTargetAttrs: stateTransitionTargetAttrs
|
|
9318
9335
|
} : void 0;
|
|
9319
9336
|
if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
|
|
9320
9337
|
const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
|
|
9321
9338
|
noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
|
|
9322
9339
|
animateConfig: resolvedAnimateConfig,
|
|
9323
9340
|
extraAnimateAttrs: extraAnimateAttrs,
|
|
9324
|
-
|
|
9341
|
+
getStateTransitionDefaultAttribute: this.getStateTransitionDefaultAttribute.bind(this),
|
|
9342
|
+
shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this),
|
|
9343
|
+
stateTransitionTargetAttrs: stateTransitionTargetAttrs
|
|
9325
9344
|
});
|
|
9326
9345
|
this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
|
|
9327
9346
|
}
|
|
@@ -9348,11 +9367,15 @@
|
|
|
9348
9367
|
transition = this.resolveClearStatesTransition();
|
|
9349
9368
|
if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
|
|
9350
9369
|
const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
|
|
9351
|
-
transition.changed
|
|
9370
|
+
if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) if (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), hasAnimation) {
|
|
9371
|
+
this._syncFinalAttributeFromStaticTruth();
|
|
9372
|
+
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
9373
|
+
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
9374
|
+
} else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
9352
9375
|
type: exports.AttributeUpdateType.STATE
|
|
9353
9376
|
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
|
|
9354
9377
|
type: exports.AttributeUpdateType.STATE
|
|
9355
|
-
}), this.emitStateUpdateEvent()
|
|
9378
|
+
}), this.emitStateUpdateEvent();
|
|
9356
9379
|
}
|
|
9357
9380
|
removeState(stateName, hasAnimation) {
|
|
9358
9381
|
const transition = this.resolveRemoveStateTransition(stateName);
|
|
@@ -9393,11 +9416,15 @@
|
|
|
9393
9416
|
effectiveStates: effectiveStates,
|
|
9394
9417
|
resolvedStateAttrs: resolvedStateAttrs
|
|
9395
9418
|
} = this.resolveGraphicStateTransition(states);
|
|
9396
|
-
|
|
9419
|
+
if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) if (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), hasAnimation) {
|
|
9420
|
+
this._syncFinalAttributeFromStaticTruth();
|
|
9421
|
+
const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
|
|
9422
|
+
this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
|
|
9423
|
+
} else this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
|
|
9397
9424
|
type: exports.AttributeUpdateType.STATE
|
|
9398
9425
|
}) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
|
|
9399
9426
|
type: exports.AttributeUpdateType.STATE
|
|
9400
|
-
}), this.emitStateUpdateEvent()
|
|
9427
|
+
}), this.emitStateUpdateEvent();
|
|
9401
9428
|
}
|
|
9402
9429
|
invalidateResolver() {
|
|
9403
9430
|
var _a, _b;
|
|
@@ -10089,8 +10116,15 @@
|
|
|
10089
10116
|
const b = this.AABBBounds;
|
|
10090
10117
|
return this._OBBBounds.setValue(b.x1, b.y1, b.x2, b.y2), this._OBBBounds;
|
|
10091
10118
|
}
|
|
10092
|
-
this.obbText || (this.obbText = new Text({}))
|
|
10093
|
-
|
|
10119
|
+
this.obbText || (this.obbText = new Text({}));
|
|
10120
|
+
const {
|
|
10121
|
+
dx = 0,
|
|
10122
|
+
dy = 0
|
|
10123
|
+
} = attribute;
|
|
10124
|
+
this.obbText.setAttributes(Object.assign(Object.assign({}, attribute), {
|
|
10125
|
+
angle: 0,
|
|
10126
|
+
dx: 0,
|
|
10127
|
+
dy: 0
|
|
10094
10128
|
}));
|
|
10095
10129
|
const bounds1 = this.obbText.AABBBounds,
|
|
10096
10130
|
{
|
|
@@ -10105,7 +10139,7 @@
|
|
|
10105
10139
|
x: x,
|
|
10106
10140
|
y: y
|
|
10107
10141
|
});
|
|
10108
|
-
return this._OBBBounds.copy(bounds1), this._OBBBounds.translate(center.x - boundsCenter.x, center.y - boundsCenter.y), this._OBBBounds.angle = angle, this._OBBBounds;
|
|
10142
|
+
return this._OBBBounds.copy(bounds1), this._OBBBounds.translate(center.x - boundsCenter.x + dx, center.y - boundsCenter.y + dy), this._OBBBounds.angle = angle, this._OBBBounds;
|
|
10109
10143
|
}
|
|
10110
10144
|
updateAABBBounds(attribute, textTheme, aabbBounds) {
|
|
10111
10145
|
const {
|
|
@@ -12901,7 +12935,204 @@
|
|
|
12901
12935
|
return new Group(attributes);
|
|
12902
12936
|
}
|
|
12903
12937
|
|
|
12904
|
-
|
|
12938
|
+
function drawPolygon(path, points, x, y) {
|
|
12939
|
+
if (points && points.length) {
|
|
12940
|
+
path.moveTo(points[0].x + x, points[0].y + y);
|
|
12941
|
+
for (let i = 1; i < points.length; i++) path.lineTo(points[i].x + x, points[i].y + y);
|
|
12942
|
+
}
|
|
12943
|
+
}
|
|
12944
|
+
function drawRoundedPolygon(path, points, x, y, cornerRadius, closePath = !0) {
|
|
12945
|
+
var _a;
|
|
12946
|
+
const normalized = normalizePolygonPoints(points, cornerRadius, closePath);
|
|
12947
|
+
if (normalized) return void drawRoundedPolygon(path, normalized.points, x, y, normalized.cornerRadius, closePath);
|
|
12948
|
+
if (points.length < 3) return void drawPolygon(path, points, x, y);
|
|
12949
|
+
let startI = 0,
|
|
12950
|
+
endI = points.length - 1;
|
|
12951
|
+
closePath || (startI += 1, endI -= 1, path.moveTo(points[0].x + x, points[0].y + y));
|
|
12952
|
+
for (let i = startI; i <= endI; i++) {
|
|
12953
|
+
const p1 = points[0 === i ? endI : (i - 1) % points.length],
|
|
12954
|
+
angularPoint = points[i % points.length],
|
|
12955
|
+
p2 = points[(i + 1) % points.length],
|
|
12956
|
+
dx1 = angularPoint.x - p1.x,
|
|
12957
|
+
dy1 = angularPoint.y - p1.y,
|
|
12958
|
+
dx2 = angularPoint.x - p2.x,
|
|
12959
|
+
dy2 = angularPoint.y - p2.y,
|
|
12960
|
+
angle = (Math.atan2(dy1, dx1) - Math.atan2(dy2, dx2)) / 2,
|
|
12961
|
+
tan = Math.abs(Math.tan(angle));
|
|
12962
|
+
let radius = Array.isArray(cornerRadius) ? null !== (_a = cornerRadius[i % points.length]) && void 0 !== _a ? _a : 0 : cornerRadius,
|
|
12963
|
+
segment = radius / tan;
|
|
12964
|
+
const length1 = getLength(dx1, dy1),
|
|
12965
|
+
length2 = getLength(dx2, dy2),
|
|
12966
|
+
length = Math.min(length1, length2);
|
|
12967
|
+
segment > length && (segment = length, radius = length * tan);
|
|
12968
|
+
const p1Cross = getProportionPoint(angularPoint, segment, length1, dx1, dy1),
|
|
12969
|
+
p2Cross = getProportionPoint(angularPoint, segment, length2, dx2, dy2),
|
|
12970
|
+
dx = 2 * angularPoint.x - p1Cross.x - p2Cross.x,
|
|
12971
|
+
dy = 2 * angularPoint.y - p1Cross.y - p2Cross.y,
|
|
12972
|
+
L = getLength(dx, dy),
|
|
12973
|
+
circlePoint = getProportionPoint(angularPoint, getLength(segment, radius), L, dx, dy);
|
|
12974
|
+
let startAngle = Math.atan2(p1Cross.y - circlePoint.y, p1Cross.x - circlePoint.x);
|
|
12975
|
+
const endAngle = Math.atan2(p2Cross.y - circlePoint.y, p2Cross.x - circlePoint.x);
|
|
12976
|
+
let sweepAngle = endAngle - startAngle;
|
|
12977
|
+
sweepAngle < 0 && (startAngle = endAngle, sweepAngle = -sweepAngle), sweepAngle > Math.PI && (sweepAngle -= Math.PI), 0 === i ? path.moveTo(p1Cross.x + x, p1Cross.y + y) : path.lineTo(p1Cross.x + x, p1Cross.y + y), sweepAngle && path.arcTo(angularPoint.x + x, angularPoint.y + y, p2Cross.x + x, p2Cross.y + y, radius), path.lineTo(p2Cross.x + x, p2Cross.y + y);
|
|
12978
|
+
}
|
|
12979
|
+
closePath || path.lineTo(points[endI + 1].x + x, points[endI + 1].y + y);
|
|
12980
|
+
}
|
|
12981
|
+
function getLength(dx, dy) {
|
|
12982
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
12983
|
+
}
|
|
12984
|
+
function getProportionPoint(point, segment, length, dx, dy) {
|
|
12985
|
+
const factor = segment / length;
|
|
12986
|
+
return {
|
|
12987
|
+
x: point.x - dx * factor,
|
|
12988
|
+
y: point.y - dy * factor
|
|
12989
|
+
};
|
|
12990
|
+
}
|
|
12991
|
+
function normalizePolygonPoints(points, cornerRadius, closePath = !0) {
|
|
12992
|
+
var _a;
|
|
12993
|
+
let hasDuplicate = !1;
|
|
12994
|
+
for (let i = 1; i < points.length; i++) if (isSamePoint(points[i - 1], points[i])) {
|
|
12995
|
+
hasDuplicate = !0;
|
|
12996
|
+
break;
|
|
12997
|
+
}
|
|
12998
|
+
if (!hasDuplicate && closePath && points.length > 1 && isSamePoint(points[0], points[points.length - 1]) && (hasDuplicate = !0), !hasDuplicate) return null;
|
|
12999
|
+
const normalizedPoints = [],
|
|
13000
|
+
normalizedCornerRadius = Array.isArray(cornerRadius) ? [] : null;
|
|
13001
|
+
for (let i = 0; i < points.length; i++) normalizedPoints.length && isSamePoint(normalizedPoints[normalizedPoints.length - 1], points[i]) || (normalizedPoints.push(points[i]), null == normalizedCornerRadius || normalizedCornerRadius.push(null !== (_a = cornerRadius[i]) && void 0 !== _a ? _a : 0));
|
|
13002
|
+
return closePath && normalizedPoints.length > 1 && isSamePoint(normalizedPoints[0], normalizedPoints[normalizedPoints.length - 1]) && (normalizedPoints.pop(), null == normalizedCornerRadius || normalizedCornerRadius.pop()), {
|
|
13003
|
+
points: normalizedPoints,
|
|
13004
|
+
cornerRadius: null != normalizedCornerRadius ? normalizedCornerRadius : cornerRadius
|
|
13005
|
+
};
|
|
13006
|
+
}
|
|
13007
|
+
function isSamePoint(a, b) {
|
|
13008
|
+
return a.x === b.x && a.y === b.y;
|
|
13009
|
+
}
|
|
13010
|
+
function getPolygonWinding(points) {
|
|
13011
|
+
let signedArea = 0;
|
|
13012
|
+
for (let i = 0; i < points.length; i++) {
|
|
13013
|
+
const current = points[i],
|
|
13014
|
+
next = points[(i + 1) % points.length];
|
|
13015
|
+
signedArea += current.x * next.y - next.x * current.y;
|
|
13016
|
+
}
|
|
13017
|
+
return signedArea > 0 ? 1 : -1;
|
|
13018
|
+
}
|
|
13019
|
+
function offsetPolygonPoints(points, distance, closePath = !0) {
|
|
13020
|
+
var _a;
|
|
13021
|
+
const n = null !== (_a = null == points ? void 0 : points.length) && void 0 !== _a ? _a : 0;
|
|
13022
|
+
if (n < 2 || closePath && n < 3 || !distance) return points;
|
|
13023
|
+
const sign = getPolygonWinding(points),
|
|
13024
|
+
edgeCount = closePath ? n : n - 1,
|
|
13025
|
+
lines = [];
|
|
13026
|
+
for (let i = 0; i < edgeCount; i++) {
|
|
13027
|
+
const cur = points[i],
|
|
13028
|
+
next = points[(i + 1) % n],
|
|
13029
|
+
dx = next.x - cur.x,
|
|
13030
|
+
dy = next.y - cur.y,
|
|
13031
|
+
len = Math.sqrt(dx * dx + dy * dy);
|
|
13032
|
+
if (!len) {
|
|
13033
|
+
lines.push(null);
|
|
13034
|
+
continue;
|
|
13035
|
+
}
|
|
13036
|
+
const offsetX = sign * dy * distance / len,
|
|
13037
|
+
offsetY = -sign * dx * distance / len;
|
|
13038
|
+
lines.push({
|
|
13039
|
+
x: cur.x + offsetX,
|
|
13040
|
+
y: cur.y + offsetY,
|
|
13041
|
+
dx: dx,
|
|
13042
|
+
dy: dy,
|
|
13043
|
+
len: len,
|
|
13044
|
+
offsetX: offsetX,
|
|
13045
|
+
offsetY: offsetY
|
|
13046
|
+
});
|
|
13047
|
+
}
|
|
13048
|
+
const prevLines = new Array(n);
|
|
13049
|
+
let prevLine = null;
|
|
13050
|
+
if (closePath) for (let i = edgeCount - 1; i >= 0; i--) if (lines[i]) {
|
|
13051
|
+
prevLine = lines[i];
|
|
13052
|
+
break;
|
|
13053
|
+
}
|
|
13054
|
+
for (let i = 0; i < n; i++) prevLines[i] = prevLine, i < edgeCount && lines[i] && (prevLine = lines[i]);
|
|
13055
|
+
const nextLines = new Array(n);
|
|
13056
|
+
let nextLine = null;
|
|
13057
|
+
if (closePath) for (let count = 0; count < edgeCount; count++) {
|
|
13058
|
+
const line = lines[(n - 1 + count) % edgeCount];
|
|
13059
|
+
if (line) {
|
|
13060
|
+
nextLine = line;
|
|
13061
|
+
break;
|
|
13062
|
+
}
|
|
13063
|
+
}
|
|
13064
|
+
for (let i = n - 1; i >= 0; i--) i < edgeCount && lines[i] && (nextLine = lines[i]), nextLines[i] = nextLine;
|
|
13065
|
+
const offsetPointByLine = (point, line) => ({
|
|
13066
|
+
x: point.x + line.offsetX,
|
|
13067
|
+
y: point.y + line.offsetY
|
|
13068
|
+
}),
|
|
13069
|
+
result = [];
|
|
13070
|
+
for (let i = 0; i < n; i++) {
|
|
13071
|
+
const prev = prevLines[i],
|
|
13072
|
+
cur = nextLines[i],
|
|
13073
|
+
line = prev || cur;
|
|
13074
|
+
if (!line) {
|
|
13075
|
+
result.push(points[i]);
|
|
13076
|
+
continue;
|
|
13077
|
+
}
|
|
13078
|
+
if (!prev || !cur) {
|
|
13079
|
+
result.push(offsetPointByLine(points[i], line));
|
|
13080
|
+
continue;
|
|
13081
|
+
}
|
|
13082
|
+
const denominator = prev.dx * cur.dy - prev.dy * cur.dx;
|
|
13083
|
+
if (Math.abs(denominator) <= 1e-12 * prev.len * cur.len) {
|
|
13084
|
+
result.push(offsetPointByLine(points[i], cur));
|
|
13085
|
+
continue;
|
|
13086
|
+
}
|
|
13087
|
+
const t = ((cur.x - prev.x) * cur.dy - (cur.y - prev.y) * cur.dx) / denominator,
|
|
13088
|
+
point = {
|
|
13089
|
+
x: prev.x + prev.dx * t,
|
|
13090
|
+
y: prev.y + prev.dy * t
|
|
13091
|
+
};
|
|
13092
|
+
result.push(Number.isFinite(point.x) && Number.isFinite(point.y) ? point : offsetPointByLine(points[i], cur));
|
|
13093
|
+
}
|
|
13094
|
+
return result;
|
|
13095
|
+
}
|
|
13096
|
+
|
|
13097
|
+
const getBoundsScaleMatrix = polygon => {
|
|
13098
|
+
var _a;
|
|
13099
|
+
const globalMatrix = polygon.globalTransMatrix,
|
|
13100
|
+
viewBoxMatrix = null === (_a = polygon.stage) || void 0 === _a ? void 0 : _a.window.getViewBoxTransform();
|
|
13101
|
+
return viewBoxMatrix ? {
|
|
13102
|
+
a: viewBoxMatrix.a * globalMatrix.a + viewBoxMatrix.c * globalMatrix.b,
|
|
13103
|
+
b: viewBoxMatrix.b * globalMatrix.a + viewBoxMatrix.d * globalMatrix.b,
|
|
13104
|
+
c: viewBoxMatrix.a * globalMatrix.c + viewBoxMatrix.c * globalMatrix.d,
|
|
13105
|
+
d: viewBoxMatrix.b * globalMatrix.c + viewBoxMatrix.d * globalMatrix.d
|
|
13106
|
+
} : globalMatrix;
|
|
13107
|
+
};
|
|
13108
|
+
const getPolygonBoundsScale = polygon => getScaledStrokeWithMatrix(getBoundsScaleMatrix(polygon), 1, 1);
|
|
13109
|
+
const updateBoundsOfPolygonOuterBorder = (attribute, polygonTheme, aabbBounds, polygon) => {
|
|
13110
|
+
const {
|
|
13111
|
+
outerBorder: outerBorder,
|
|
13112
|
+
points = polygonTheme.points,
|
|
13113
|
+
closePath = polygonTheme.closePath,
|
|
13114
|
+
shadowBlur = polygonTheme.shadowBlur,
|
|
13115
|
+
keepStrokeScale = polygonTheme.keepStrokeScale
|
|
13116
|
+
} = attribute;
|
|
13117
|
+
if (outerBorder && !1 !== outerBorder.visible) {
|
|
13118
|
+
const defaultOuterBorder = polygonTheme.outerBorder,
|
|
13119
|
+
{
|
|
13120
|
+
distance = defaultOuterBorder.distance,
|
|
13121
|
+
lineWidth = defaultOuterBorder.lineWidth,
|
|
13122
|
+
lineJoin = defaultOuterBorder.lineJoin,
|
|
13123
|
+
strokeBoundsBuffer = defaultOuterBorder.strokeBoundsBuffer
|
|
13124
|
+
} = outerBorder,
|
|
13125
|
+
boundsScale = getPolygonBoundsScale(polygon);
|
|
13126
|
+
let scaledDistance = distance;
|
|
13127
|
+
keepStrokeScale || (scaledDistance *= boundsScale), offsetPolygonPoints(points, scaledDistance, closePath).forEach(point => {
|
|
13128
|
+
aabbBounds.add(point.x, point.y);
|
|
13129
|
+
});
|
|
13130
|
+
boundStroke(aabbBounds, (shadowBlur * boundsScale + lineWidth * (keepStrokeScale ? 1 : boundsScale)) / 2, "miter" === lineJoin, strokeBoundsBuffer);
|
|
13131
|
+
}
|
|
13132
|
+
return aabbBounds;
|
|
13133
|
+
};
|
|
13134
|
+
|
|
13135
|
+
const POLYGON_UPDATE_TAG_KEY = ["points", "cornerRadius", "outerBorder", "keepStrokeScale", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
12905
13136
|
class Polygon extends Graphic {
|
|
12906
13137
|
constructor(params) {
|
|
12907
13138
|
super(params), this.type = "polygon", this.numberType = POLYGON_NUMBER_TYPE;
|
|
@@ -12918,6 +13149,16 @@
|
|
|
12918
13149
|
getGraphicTheme() {
|
|
12919
13150
|
return getTheme(this).polygon;
|
|
12920
13151
|
}
|
|
13152
|
+
tryUpdateAABBBounds() {
|
|
13153
|
+
const {
|
|
13154
|
+
outerBorder: outerBorder
|
|
13155
|
+
} = this.attribute;
|
|
13156
|
+
if (outerBorder && !1 !== outerBorder.visible) {
|
|
13157
|
+
const boundsScale = getPolygonBoundsScale(this);
|
|
13158
|
+
boundsScale !== this._outerBorderBoundsScale && (this._outerBorderBoundsScale = boundsScale, this.addUpdateBoundTag());
|
|
13159
|
+
} else this._outerBorderBoundsScale = void 0;
|
|
13160
|
+
return super.tryUpdateAABBBounds();
|
|
13161
|
+
}
|
|
12921
13162
|
updateAABBBounds(attribute, polygonTheme, aabbBounds) {
|
|
12922
13163
|
this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
|
|
12923
13164
|
const {
|
|
@@ -12931,7 +13172,7 @@
|
|
|
12931
13172
|
} = attribute;
|
|
12932
13173
|
return points.forEach(p => {
|
|
12933
13174
|
aabbBounds.add(p.x, p.y);
|
|
12934
|
-
}), aabbBounds;
|
|
13175
|
+
}), updateBoundsOfPolygonOuterBorder(attribute, polygonTheme, aabbBounds, this), aabbBounds;
|
|
12935
13176
|
}
|
|
12936
13177
|
_interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {
|
|
12937
13178
|
"points" === key && (nextAttributes.points = pointsInterpolation(lastStepVal, nextStepVal, ratio));
|
|
@@ -16913,22 +17154,26 @@
|
|
|
16913
17154
|
width: width,
|
|
16914
17155
|
height: height
|
|
16915
17156
|
} = rect.attribute;
|
|
16916
|
-
width = (null != width ? width : x1 -
|
|
16917
|
-
const
|
|
16918
|
-
|
|
16919
|
-
|
|
16920
|
-
|
|
16921
|
-
|
|
16922
|
-
|
|
16923
|
-
|
|
16924
|
-
|
|
16925
|
-
|
|
16926
|
-
|
|
16927
|
-
|
|
16928
|
-
|
|
16929
|
-
|
|
16930
|
-
|
|
16931
|
-
|
|
17157
|
+
width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
|
|
17158
|
+
const borderX = width < 0 ? x + width : x,
|
|
17159
|
+
borderY = height < 0 ? y + height : y,
|
|
17160
|
+
borderWidth = width < 0 ? -width : width,
|
|
17161
|
+
borderHeight = height < 0 ? -height : height,
|
|
17162
|
+
renderBorder = (borderStyle, key) => {
|
|
17163
|
+
const doStroke = !(!borderStyle || !borderStyle.stroke),
|
|
17164
|
+
sign = "outerBorder" === key ? -1 : 1,
|
|
17165
|
+
{
|
|
17166
|
+
distance = rectAttribute[key].distance
|
|
17167
|
+
} = borderStyle,
|
|
17168
|
+
d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
|
|
17169
|
+
nextX = borderX + sign * d,
|
|
17170
|
+
nextY = borderY + sign * d,
|
|
17171
|
+
dw = 2 * d;
|
|
17172
|
+
if (0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? (context.beginPath(), context.rect(nextX, nextY, borderWidth - sign * dw, borderHeight - sign * dw)) : (context.beginPath(), createRectPath(context, nextX, nextY, borderWidth - sign * dw, borderHeight - sign * dw, cornerRadius, "bevel" !== cornerType)), context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), strokeCb) strokeCb(context, borderStyle, rectAttribute[key]);else if (doStroke) {
|
|
17173
|
+
const lastOpacity = rectAttribute[key].opacity;
|
|
17174
|
+
rectAttribute[key].opacity = opacity, context.setStrokeStyle(rect, borderStyle, (originX - x) / scaleX, (originY - y) / scaleY, rectAttribute[key]), rectAttribute[key].opacity = lastOpacity, context.stroke();
|
|
17175
|
+
}
|
|
17176
|
+
};
|
|
16932
17177
|
doOuterBorder && renderBorder(outerBorder, "outerBorder"), doInnerBorder && renderBorder(innerBorder, "innerBorder");
|
|
16933
17178
|
}
|
|
16934
17179
|
}
|
|
@@ -19210,64 +19455,69 @@
|
|
|
19210
19455
|
|
|
19211
19456
|
class AbstractGraphicRender {}
|
|
19212
19457
|
|
|
19213
|
-
|
|
19214
|
-
|
|
19215
|
-
|
|
19216
|
-
|
|
19458
|
+
const defaultPolygonTextureRenderContribution = defaultBaseTextureRenderContribution;
|
|
19459
|
+
const defaultPolygonBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
|
|
19460
|
+
class DefaultPolygonRenderContribution {
|
|
19461
|
+
constructor() {
|
|
19462
|
+
this.time = exports.BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
19217
19463
|
}
|
|
19218
|
-
|
|
19219
|
-
|
|
19220
|
-
|
|
19221
|
-
|
|
19222
|
-
|
|
19223
|
-
|
|
19224
|
-
|
|
19225
|
-
|
|
19226
|
-
const
|
|
19227
|
-
|
|
19228
|
-
|
|
19229
|
-
|
|
19230
|
-
|
|
19231
|
-
|
|
19232
|
-
|
|
19233
|
-
|
|
19234
|
-
|
|
19235
|
-
|
|
19236
|
-
|
|
19237
|
-
|
|
19238
|
-
|
|
19239
|
-
|
|
19240
|
-
|
|
19241
|
-
|
|
19242
|
-
|
|
19243
|
-
|
|
19244
|
-
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
|
|
19248
|
-
|
|
19249
|
-
|
|
19250
|
-
|
|
19464
|
+
drawShape(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb) {
|
|
19465
|
+
const {
|
|
19466
|
+
outerBorder: outerBorder,
|
|
19467
|
+
innerBorder: innerBorder
|
|
19468
|
+
} = polygon.attribute,
|
|
19469
|
+
doOuterBorder = outerBorder && !1 !== outerBorder.visible,
|
|
19470
|
+
doInnerBorder = innerBorder && !1 !== innerBorder.visible;
|
|
19471
|
+
if (!doOuterBorder && !doInnerBorder) return;
|
|
19472
|
+
const {
|
|
19473
|
+
points = polygonAttribute.points,
|
|
19474
|
+
cornerRadius = polygonAttribute.cornerRadius,
|
|
19475
|
+
opacity = polygonAttribute.opacity,
|
|
19476
|
+
x: originX = polygonAttribute.x,
|
|
19477
|
+
y: originY = polygonAttribute.y,
|
|
19478
|
+
scaleX = polygonAttribute.scaleX,
|
|
19479
|
+
scaleY = polygonAttribute.scaleY,
|
|
19480
|
+
keepStrokeScale = polygonAttribute.keepStrokeScale,
|
|
19481
|
+
closePath = polygonAttribute.closePath
|
|
19482
|
+
} = polygon.attribute,
|
|
19483
|
+
renderBorder = (borderStyle, key) => {
|
|
19484
|
+
var _a, _b;
|
|
19485
|
+
const doBorderStroke = !!borderStyle.stroke,
|
|
19486
|
+
distanceDirection = "outerBorder" === key ? 1 : -1,
|
|
19487
|
+
{
|
|
19488
|
+
distance = polygonAttribute[key].distance
|
|
19489
|
+
} = borderStyle,
|
|
19490
|
+
borderDistance = distanceDirection * (keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr)),
|
|
19491
|
+
normalized = normalizePolygonPoints(points, cornerRadius, closePath),
|
|
19492
|
+
normalizedPoints = null !== (_a = null == normalized ? void 0 : normalized.points) && void 0 !== _a ? _a : points,
|
|
19493
|
+
normalizedCornerRadius = null !== (_b = null == normalized ? void 0 : normalized.cornerRadius) && void 0 !== _b ? _b : cornerRadius,
|
|
19494
|
+
borderPoints = offsetPolygonPoints(normalizedPoints, borderDistance, closePath),
|
|
19495
|
+
winding = getPolygonWinding(normalizedPoints),
|
|
19496
|
+
borderCornerRadius = normalizedPoints.map((point, i) => {
|
|
19497
|
+
var _a;
|
|
19498
|
+
const radius = isArray$1(normalizedCornerRadius) ? null !== (_a = normalizedCornerRadius[i]) && void 0 !== _a ? _a : 0 : normalizedCornerRadius || 0;
|
|
19499
|
+
if (!closePath && (0 === i || i === normalizedPoints.length - 1) || normalizedPoints.length < 3) return radius;
|
|
19500
|
+
const prev = normalizedPoints[(i - 1 + normalizedPoints.length) % normalizedPoints.length],
|
|
19501
|
+
next = normalizedPoints[(i + 1) % normalizedPoints.length],
|
|
19502
|
+
cornerDirection = ((point.x - prev.x) * (next.y - point.y) - (point.y - prev.y) * (next.x - point.x)) * winding < 0 ? -1 : 1;
|
|
19503
|
+
return Math.max(0, radius + borderDistance * cornerDirection);
|
|
19504
|
+
}),
|
|
19505
|
+
noCorner = 0 === borderCornerRadius.length || borderCornerRadius.every(r => 0 === r);
|
|
19506
|
+
if (context.beginPath(), noCorner ? drawPolygon(context.camera ? context : context.nativeContext, borderPoints, x, y) : drawRoundedPolygon(context.camera ? context : context.nativeContext, borderPoints, x, y, borderCornerRadius, closePath), closePath && context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute), strokeCb) strokeCb(context, borderStyle, polygonAttribute[key]);else if (doBorderStroke) {
|
|
19507
|
+
const lastOpacity = polygonAttribute[key].opacity,
|
|
19508
|
+
borderStyleWithStrokeScale = borderStyle,
|
|
19509
|
+
lastKeepStrokeScale = borderStyleWithStrokeScale.keepStrokeScale;
|
|
19510
|
+
polygonAttribute[key].opacity = opacity, borderStyleWithStrokeScale.keepStrokeScale = keepStrokeScale, context.setStrokeStyle(polygon, borderStyleWithStrokeScale, (originX - x) / scaleX, (originY - y) / scaleY, polygonAttribute[key]), polygonAttribute[key].opacity = lastOpacity, void 0 === lastKeepStrokeScale ? delete borderStyleWithStrokeScale.keepStrokeScale : borderStyleWithStrokeScale.keepStrokeScale = lastKeepStrokeScale, context.stroke();
|
|
19511
|
+
}
|
|
19512
|
+
};
|
|
19513
|
+
doOuterBorder && renderBorder(outerBorder, "outerBorder"), doInnerBorder && renderBorder(innerBorder, "innerBorder");
|
|
19251
19514
|
}
|
|
19252
|
-
closePath || path.lineTo(points[endI + 1].x + x, points[endI + 1].y + y);
|
|
19253
|
-
}
|
|
19254
|
-
function getLength(dx, dy) {
|
|
19255
|
-
return Math.sqrt(dx * dx + dy * dy);
|
|
19256
|
-
}
|
|
19257
|
-
function getProportionPoint(point, segment, length, dx, dy) {
|
|
19258
|
-
const factor = segment / length;
|
|
19259
|
-
return {
|
|
19260
|
-
x: point.x - dx * factor,
|
|
19261
|
-
y: point.y - dy * factor
|
|
19262
|
-
};
|
|
19263
19515
|
}
|
|
19264
|
-
|
|
19265
|
-
const defaultPolygonTextureRenderContribution = defaultBaseTextureRenderContribution;
|
|
19266
|
-
const defaultPolygonBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
|
|
19516
|
+
const defaultPolygonRenderContribution = new DefaultPolygonRenderContribution();
|
|
19267
19517
|
|
|
19268
19518
|
class DefaultCanvasPolygonRender extends BaseRender {
|
|
19269
19519
|
constructor(graphicRenderContributions) {
|
|
19270
|
-
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
|
|
19520
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonRenderContribution, defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
|
|
19271
19521
|
}
|
|
19272
19522
|
drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
19273
19523
|
const polygonAttribute = getTheme(polygon, null == params ? void 0 : params.theme).polygon,
|
|
@@ -23308,6 +23558,7 @@
|
|
|
23308
23558
|
getRuntimeInstallerGlobal: getRuntimeInstallerGlobal,
|
|
23309
23559
|
getRuntimeInstallerState: getRuntimeInstallerState,
|
|
23310
23560
|
getScaledStroke: getScaledStroke,
|
|
23561
|
+
getScaledStrokeWithMatrix: getScaledStrokeWithMatrix,
|
|
23311
23562
|
getTextBounds: getTextBounds,
|
|
23312
23563
|
getTheme: getTheme,
|
|
23313
23564
|
getThemeFromGroup: getThemeFromGroup,
|
|
@@ -28817,6 +29068,8 @@
|
|
|
28817
29068
|
var _a, _b;
|
|
28818
29069
|
return null !== (_b = null !== (_a = null == params ? void 0 : params.lynx) && void 0 !== _a ? _a : null == params ? void 0 : params.runtime) && void 0 !== _b ? _b : getGlobalLynxRuntime();
|
|
28819
29070
|
}
|
|
29071
|
+
const requestAnimationFrameBasedSTO = callback => rafBasedSto.call(callback),
|
|
29072
|
+
cancelAnimationFrameBasedSTO = handle => rafBasedSto.clear(handle);
|
|
28820
29073
|
function getLynxPixelRatio(params, runtime) {
|
|
28821
29074
|
var _a, _b, _c, _d, _e;
|
|
28822
29075
|
return null !== (_e = null !== (_d = null !== (_a = null == params ? void 0 : params.pixelRatio) && void 0 !== _a ? _a : null === (_c = null === (_b = null == runtime ? void 0 : runtime.getSystemInfoSync) || void 0 === _b ? void 0 : _b.call(runtime)) || void 0 === _c ? void 0 : _c.pixelRatio) && void 0 !== _d ? _d : getGlobalSystemPixelRatio()) && void 0 !== _e ? _e : 1;
|
|
@@ -28888,7 +29141,7 @@
|
|
|
28888
29141
|
}
|
|
28889
29142
|
class LynxEnvContribution extends BaseEnvContribution {
|
|
28890
29143
|
constructor() {
|
|
28891
|
-
super(), this.type = "lynx", this.supportEvent = !0, this.canvasMap = new Map(), this.freeCanvasList = [], this.canvasIdx = 0, this.supportsTouchEvents = !0;
|
|
29144
|
+
super(), this.type = "lynx", this.supportEvent = !0, this.canvasMap = new Map(), this.freeCanvasList = [], this.canvasIdx = 0, this.requestAnimationFrame = requestAnimationFrameBasedSTO, this.cancelAnimationFrame = cancelAnimationFrameBasedSTO, this.supportsTouchEvents = !0;
|
|
28892
29145
|
try {
|
|
28893
29146
|
this.supportsPointerEvents = !!globalThis.PointerEvent, this.supportsMouseEvents = !!globalThis.MouseEvent;
|
|
28894
29147
|
} catch (err) {
|
|
@@ -28897,7 +29150,8 @@
|
|
|
28897
29150
|
this.applyStyles = !0;
|
|
28898
29151
|
}
|
|
28899
29152
|
configure(service, params = {}) {
|
|
28900
|
-
|
|
29153
|
+
var _a, _b;
|
|
29154
|
+
service.env === this.type && (service.setActiveEnvContribution(this), this.lynxEnvParams = params, this.lynxRuntime = getLynxRuntime(params), "function" == typeof (null === (_a = this.lynxRuntime) || void 0 === _a ? void 0 : _a.requestAnimationFrame) && "function" == typeof (null === (_b = this.lynxRuntime) || void 0 === _b ? void 0 : _b.cancelAnimationFrame) ? (this.requestAnimationFrame = this.lynxRuntime.requestAnimationFrame.bind(this.lynxRuntime), this.cancelAnimationFrame = this.lynxRuntime.cancelAnimationFrame.bind(this.lynxRuntime)) : (this.requestAnimationFrame = requestAnimationFrameBasedSTO, this.cancelAnimationFrame = cancelAnimationFrameBasedSTO));
|
|
28901
29155
|
}
|
|
28902
29156
|
getDynamicCanvasCount() {
|
|
28903
29157
|
return this.freeCanvasList.length;
|
|
@@ -28949,14 +29203,10 @@
|
|
|
28949
29203
|
return getLynxPixelRatio(void 0, this.lynxRuntime);
|
|
28950
29204
|
}
|
|
28951
29205
|
getRequestAnimationFrame() {
|
|
28952
|
-
return
|
|
28953
|
-
return rafBasedSto.call(callback);
|
|
28954
|
-
};
|
|
29206
|
+
return this.requestAnimationFrame;
|
|
28955
29207
|
}
|
|
28956
29208
|
getCancelAnimationFrame() {
|
|
28957
|
-
return
|
|
28958
|
-
rafBasedSto.clear(h);
|
|
28959
|
-
};
|
|
29209
|
+
return this.cancelAnimationFrame;
|
|
28960
29210
|
}
|
|
28961
29211
|
mapToCanvasPoint(event) {
|
|
28962
29212
|
var _a;
|
|
@@ -55574,7 +55824,7 @@
|
|
|
55574
55824
|
return resolveLegacyApp().createStage(params);
|
|
55575
55825
|
}
|
|
55576
55826
|
|
|
55577
|
-
const version = "1.1.
|
|
55827
|
+
const version = "1.1.6";
|
|
55578
55828
|
|
|
55579
55829
|
exports.AComponentAnimate = AComponentAnimate;
|
|
55580
55830
|
exports.ACustomAnimate = ACustomAnimate;
|
|
@@ -56314,6 +56564,7 @@
|
|
|
56314
56564
|
exports.getRuntimeInstallerGlobal = getRuntimeInstallerGlobal;
|
|
56315
56565
|
exports.getRuntimeInstallerState = getRuntimeInstallerState;
|
|
56316
56566
|
exports.getScaledStroke = getScaledStroke;
|
|
56567
|
+
exports.getScaledStrokeWithMatrix = getScaledStrokeWithMatrix;
|
|
56317
56568
|
exports.getSharedVRenderApp = getSharedVRenderApp;
|
|
56318
56569
|
exports.getSizeHandlerPath = getSizeHandlerPath;
|
|
56319
56570
|
exports.getTextAlignAttrOfVerticalDir = getTextAlignAttrOfVerticalDir;
|