@visactor/vrender-core 1.1.0-alpha.12 → 1.1.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/common/diff.js +1 -2
- package/cjs/common/event-transformer.js +2 -1
- package/cjs/common/rect-utils.js +1 -1
- package/cjs/common/render-area.js +1 -1
- package/cjs/common/render-command-list.js +1 -1
- package/cjs/common/render-curve.js +1 -1
- package/cjs/common/render-utils.js +1 -1
- package/cjs/common/seg-context.js +1 -2
- package/cjs/common/simplify.js +1 -1
- package/cjs/common/sort.js +1 -1
- package/cjs/common/split-path.js +1 -1
- package/cjs/common/store.js +1 -1
- package/cjs/common/text.js +1 -1
- package/cjs/common/utils.js +1 -1
- package/cjs/core/camera.js +1 -1
- package/cjs/core/constants.js +1 -1
- package/cjs/core/core-modules.js +1 -1
- package/cjs/core/global-module.js +2 -0
- package/cjs/core/global.js +1 -1
- package/cjs/core/graphic-utils.js +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/layer-service.js +2 -1
- package/cjs/core/layer.js +1 -1
- package/cjs/core/light.js +1 -1
- package/cjs/core/stage.js +1 -1
- package/cjs/core/window.js +1 -1
- package/cjs/graphic/graphic.d.ts +4 -0
- package/cjs/graphic/graphic.js +31 -4
- package/cjs/graphic/graphic.js.map +1 -1
- package/dist/index.es.js +77 -3
- package/es/common/diff.js +1 -2
- package/es/common/event-transformer.js +2 -1
- package/es/common/rect-utils.js +1 -1
- package/es/common/render-area.js +1 -1
- package/es/common/render-command-list.js +1 -1
- package/es/common/render-curve.js +1 -1
- package/es/common/render-utils.js +1 -1
- package/es/common/seg-context.js +1 -2
- package/es/common/simplify.js +1 -1
- package/es/common/sort.js +1 -1
- package/es/common/split-path.js +1 -1
- package/es/common/store.js +1 -1
- package/es/common/text.js +1 -1
- package/es/common/utils.js +1 -1
- package/es/core/camera.js +1 -1
- package/es/core/constants.js +1 -1
- package/es/core/core-modules.js +1 -1
- package/es/core/global-module.js +2 -0
- package/es/core/global.js +1 -1
- package/es/core/graphic-utils.js +1 -1
- package/es/core/index.js +1 -1
- package/es/core/layer-service.js +2 -1
- package/es/core/layer.js +1 -1
- package/es/core/light.js +1 -1
- package/es/core/stage.js +1 -1
- package/es/core/window.js +1 -1
- package/es/graphic/graphic.d.ts +4 -0
- package/es/graphic/graphic.js +31 -4
- package/es/graphic/graphic.js.map +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -11309,16 +11309,90 @@ class Graphic extends Node {
|
|
|
11309
11309
|
this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
|
|
11310
11310
|
}
|
|
11311
11311
|
setAttributesAndPreventAnimate(params, forceUpdateTag = false, context, ignorePriority) {
|
|
11312
|
+
if (!params) {
|
|
11313
|
+
return;
|
|
11314
|
+
}
|
|
11315
|
+
const keys = Object.keys(params);
|
|
11316
|
+
this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context);
|
|
11312
11317
|
this.visitTrackedAnimates(animate => {
|
|
11313
11318
|
if (animate.priority === Infinity && !ignorePriority) {
|
|
11314
11319
|
return;
|
|
11315
11320
|
}
|
|
11316
|
-
|
|
11317
|
-
animate.preventAttr(key);
|
|
11318
|
-
});
|
|
11321
|
+
animate.preventAttrs(keys);
|
|
11319
11322
|
});
|
|
11320
11323
|
this.applyTransientAttributes(params, forceUpdateTag, context);
|
|
11321
11324
|
}
|
|
11325
|
+
captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
|
|
11326
|
+
var _a;
|
|
11327
|
+
const graphicContext = this.context;
|
|
11328
|
+
const diffAttrs = graphicContext === null || graphicContext === void 0 ? void 0 : graphicContext.diffAttrs;
|
|
11329
|
+
const updateType = context === null || context === void 0 ? void 0 : context.type;
|
|
11330
|
+
if (!keys.length ||
|
|
11331
|
+
!graphicContext ||
|
|
11332
|
+
!diffAttrs ||
|
|
11333
|
+
updateType === AttributeUpdateType.STATE ||
|
|
11334
|
+
(updateType != null &&
|
|
11335
|
+
updateType >= AttributeUpdateType.ANIMATE_BIND &&
|
|
11336
|
+
updateType <= AttributeUpdateType.ANIMATE_END)) {
|
|
11337
|
+
return;
|
|
11338
|
+
}
|
|
11339
|
+
let fromAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs
|
|
11340
|
+
? (_a = this.transientFromAttrsBeforePreventAnimate) !== null && _a !== void 0 ? _a : null
|
|
11341
|
+
: null;
|
|
11342
|
+
let captured = false;
|
|
11343
|
+
for (let i = 0; i < keys.length; i++) {
|
|
11344
|
+
const key = keys[i];
|
|
11345
|
+
if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) {
|
|
11346
|
+
continue;
|
|
11347
|
+
}
|
|
11348
|
+
const previousValue = this.attribute[key];
|
|
11349
|
+
const nextValue = params[key];
|
|
11350
|
+
if (isEqual(previousValue, nextValue)) {
|
|
11351
|
+
continue;
|
|
11352
|
+
}
|
|
11353
|
+
fromAttrs !== null && fromAttrs !== void 0 ? fromAttrs : (fromAttrs = {});
|
|
11354
|
+
fromAttrs[key] = cloneAttributeValue(previousValue);
|
|
11355
|
+
captured = true;
|
|
11356
|
+
}
|
|
11357
|
+
if (captured) {
|
|
11358
|
+
this.transientFromAttrsBeforePreventAnimate = fromAttrs;
|
|
11359
|
+
this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs;
|
|
11360
|
+
}
|
|
11361
|
+
}
|
|
11362
|
+
consumeTransientFromAttrsBeforePreventAnimate(rawDiffAttrs, diffAttrs) {
|
|
11363
|
+
const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate;
|
|
11364
|
+
if (!transientFromAttrs || this.transientFromAttrsBeforePreventAnimateDiffAttrs !== rawDiffAttrs) {
|
|
11365
|
+
return null;
|
|
11366
|
+
}
|
|
11367
|
+
let fromAttrs = null;
|
|
11368
|
+
let remaining = false;
|
|
11369
|
+
for (const key in transientFromAttrs) {
|
|
11370
|
+
if (!Object.prototype.hasOwnProperty.call(transientFromAttrs, key)) {
|
|
11371
|
+
continue;
|
|
11372
|
+
}
|
|
11373
|
+
if (Object.prototype.hasOwnProperty.call(diffAttrs, key)) {
|
|
11374
|
+
fromAttrs !== null && fromAttrs !== void 0 ? fromAttrs : (fromAttrs = {});
|
|
11375
|
+
fromAttrs[key] = transientFromAttrs[key];
|
|
11376
|
+
continue;
|
|
11377
|
+
}
|
|
11378
|
+
remaining = true;
|
|
11379
|
+
}
|
|
11380
|
+
if (remaining) {
|
|
11381
|
+
const nextTransientFromAttrs = {};
|
|
11382
|
+
for (const key in transientFromAttrs) {
|
|
11383
|
+
if (Object.prototype.hasOwnProperty.call(transientFromAttrs, key) &&
|
|
11384
|
+
!Object.prototype.hasOwnProperty.call(diffAttrs, key)) {
|
|
11385
|
+
nextTransientFromAttrs[key] = transientFromAttrs[key];
|
|
11386
|
+
}
|
|
11387
|
+
}
|
|
11388
|
+
this.transientFromAttrsBeforePreventAnimate = nextTransientFromAttrs;
|
|
11389
|
+
}
|
|
11390
|
+
else {
|
|
11391
|
+
this.transientFromAttrsBeforePreventAnimate = null;
|
|
11392
|
+
this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
|
|
11393
|
+
}
|
|
11394
|
+
return fromAttrs;
|
|
11395
|
+
}
|
|
11322
11396
|
setAttributes(params, forceUpdateTag = false, context) {
|
|
11323
11397
|
if (!params) {
|
|
11324
11398
|
return;
|
package/es/common/diff.js
CHANGED
package/es/common/rect-utils.js
CHANGED
package/es/common/render-area.js
CHANGED
package/es/common/seg-context.js
CHANGED
package/es/common/simplify.js
CHANGED
|
@@ -30,4 +30,4 @@ export function flatten_simplify(points, tolerance, highestQuality) {
|
|
|
30
30
|
if (points.length <= 10) return points;
|
|
31
31
|
return points = highestQuality ? points : simplifyRadialDist(points, void 0 !== tolerance ? tolerance * tolerance : 1);
|
|
32
32
|
}
|
|
33
|
-
//# sourceMappingURL=simplify.js.map
|
|
33
|
+
//# sourceMappingURL=simplify.js.map
|
package/es/common/sort.js
CHANGED
package/es/common/split-path.js
CHANGED
package/es/common/store.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
class StageStore {}
|
|
2
|
-
//# sourceMappingURL=store.js.map
|
|
2
|
+
//# sourceMappingURL=store.js.map
|
package/es/common/text.js
CHANGED
|
@@ -24,4 +24,4 @@ export function textAttributesToStyle(attrs) {
|
|
|
24
24
|
attrs.underline ? style["text-decoration"] = "underline" : attrs.lineThrough && (style["text-decoration"] = "line-through"),
|
|
25
25
|
attrs.fill && isString(attrs.fill) && (style.color = attrs.fill), style;
|
|
26
26
|
}
|
|
27
|
-
//# sourceMappingURL=text.js.map
|
|
27
|
+
//# sourceMappingURL=text.js.map
|
package/es/common/utils.js
CHANGED
package/es/core/camera.js
CHANGED
package/es/core/constants.js
CHANGED
|
@@ -9,4 +9,4 @@ export const StaticLayerHandlerContribution = Symbol.for("StaticLayerHandlerCont
|
|
|
9
9
|
export const DynamicLayerHandlerContribution = Symbol.for("DynamicLayerHandlerContribution");
|
|
10
10
|
|
|
11
11
|
export const VirtualLayerHandlerContribution = Symbol.for("VirtualLayerHandlerContribution");
|
|
12
|
-
//# sourceMappingURL=constants.js.map
|
|
12
|
+
//# sourceMappingURL=constants.js.map
|
package/es/core/core-modules.js
CHANGED
package/es/core/global-module.js
CHANGED
package/es/core/global.js
CHANGED
package/es/core/graphic-utils.js
CHANGED
package/es/core/index.js
CHANGED
package/es/core/layer-service.js
CHANGED
|
@@ -75,4 +75,5 @@ export class DefaultLayerService {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
DefaultLayerService.idprefix = "visactor_layer", DefaultLayerService.prefix_count = 0;
|
|
78
|
+
DefaultLayerService.idprefix = "visactor_layer", DefaultLayerService.prefix_count = 0;
|
|
79
|
+
//# sourceMappingURL=layer-service.js.map
|
package/es/core/layer.js
CHANGED
package/es/core/light.js
CHANGED
package/es/core/stage.js
CHANGED
package/es/core/window.js
CHANGED
package/es/graphic/graphic.d.ts
CHANGED
|
@@ -52,6 +52,8 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
52
52
|
static mixin(source: Dict<any>): void;
|
|
53
53
|
_events?: any;
|
|
54
54
|
context?: Record<string, any>;
|
|
55
|
+
private transientFromAttrsBeforePreventAnimate?;
|
|
56
|
+
private transientFromAttrsBeforePreventAnimateDiffAttrs?;
|
|
55
57
|
static userSymbolMap: Record<string, ISymbolClass>;
|
|
56
58
|
onBeforeAttributeUpdate?: (val: any, attributes: Partial<T>, key: null | string | string[], context?: ISetAttributeContext) => T | undefined;
|
|
57
59
|
parent: any;
|
|
@@ -189,6 +191,8 @@ export declare abstract class Graphic<T extends Partial<IGraphicAttribute> = Par
|
|
|
189
191
|
containsPoint(x: number, y: number, mode: IContainPointMode, picker?: IPickerService): boolean;
|
|
190
192
|
protected setWidthHeightWithoutTransform(aabbBounds: IAABBBounds): void;
|
|
191
193
|
setAttributesAndPreventAnimate(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext, ignorePriority?: boolean): void;
|
|
194
|
+
protected captureTransientFromAttrsBeforePreventAnimate(params: Partial<T>, keys: string[], context?: ISetAttributeContext): void;
|
|
195
|
+
protected consumeTransientFromAttrsBeforePreventAnimate(rawDiffAttrs: Record<string, any>, diffAttrs: Record<string, any>): Record<string, any> | null;
|
|
192
196
|
setAttributes(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
|
193
197
|
_setAttributes(params: Partial<T>, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
|
194
198
|
setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext): void;
|
package/es/graphic/graphic.js
CHANGED
|
@@ -555,12 +555,39 @@ export class Graphic extends Node {
|
|
|
555
555
|
this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
|
|
556
556
|
}
|
|
557
557
|
setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context, ignorePriority) {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
558
|
+
if (!params) return;
|
|
559
|
+
const keys = Object.keys(params);
|
|
560
|
+
this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context), this.visitTrackedAnimates((animate => {
|
|
561
|
+
(animate.priority !== 1 / 0 || ignorePriority) && animate.preventAttrs(keys);
|
|
562
562
|
})), this.applyTransientAttributes(params, forceUpdateTag, context);
|
|
563
563
|
}
|
|
564
|
+
captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
|
|
565
|
+
var _a;
|
|
566
|
+
const graphicContext = this.context, diffAttrs = null == graphicContext ? void 0 : graphicContext.diffAttrs, updateType = null == context ? void 0 : context.type;
|
|
567
|
+
if (!keys.length || !graphicContext || !diffAttrs || updateType === AttributeUpdateType.STATE || null != updateType && updateType >= AttributeUpdateType.ANIMATE_BIND && updateType <= AttributeUpdateType.ANIMATE_END) return;
|
|
568
|
+
let fromAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs && null !== (_a = this.transientFromAttrsBeforePreventAnimate) && void 0 !== _a ? _a : null, captured = !1;
|
|
569
|
+
for (let i = 0; i < keys.length; i++) {
|
|
570
|
+
const key = keys[i];
|
|
571
|
+
if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) continue;
|
|
572
|
+
const previousValue = this.attribute[key], nextValue = params[key];
|
|
573
|
+
isEqual(previousValue, nextValue) || (null != fromAttrs || (fromAttrs = {}), fromAttrs[key] = cloneAttributeValue(previousValue),
|
|
574
|
+
captured = !0);
|
|
575
|
+
}
|
|
576
|
+
captured && (this.transientFromAttrsBeforePreventAnimate = fromAttrs, this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs);
|
|
577
|
+
}
|
|
578
|
+
consumeTransientFromAttrsBeforePreventAnimate(rawDiffAttrs, diffAttrs) {
|
|
579
|
+
const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate;
|
|
580
|
+
if (!transientFromAttrs || this.transientFromAttrsBeforePreventAnimateDiffAttrs !== rawDiffAttrs) return null;
|
|
581
|
+
let fromAttrs = null, remaining = !1;
|
|
582
|
+
for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && (Object.prototype.hasOwnProperty.call(diffAttrs, key) ? (null != fromAttrs || (fromAttrs = {}),
|
|
583
|
+
fromAttrs[key] = transientFromAttrs[key]) : remaining = !0);
|
|
584
|
+
if (remaining) {
|
|
585
|
+
const nextTransientFromAttrs = {};
|
|
586
|
+
for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && !Object.prototype.hasOwnProperty.call(diffAttrs, key) && (nextTransientFromAttrs[key] = transientFromAttrs[key]);
|
|
587
|
+
this.transientFromAttrsBeforePreventAnimate = nextTransientFromAttrs;
|
|
588
|
+
} else this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
|
|
589
|
+
return fromAttrs;
|
|
590
|
+
}
|
|
564
591
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
565
592
|
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0),
|
|
566
593
|
isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic),
|