@visactor/vrender 0.23.0-alpha.2 → 0.23.0-alpha.3
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 +163 -128
- package/dist/index.js +163 -128
- 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 +4 -4
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
21
21
|
|
|
22
22
|
const vrender_core_1 = require("@visactor/vrender-core"), vrender_kits_1 = require("@visactor/vrender-kits"), vrender_kits_2 = require("@visactor/vrender-kits");
|
|
23
23
|
|
|
24
|
-
exports.version = "0.23.0-alpha.
|
|
24
|
+
exports.version = "0.23.0-alpha.3", (0, vrender_core_1.preLoadAllModule)(), (0,
|
|
25
25
|
vrender_core_1.isBrowserEnv)() ? (0, vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0,
|
|
26
26
|
vrender_core_1.isNodeEnv)() && (0, vrender_kits_1.loadNodeEnv)(vrender_core_1.container),
|
|
27
27
|
(0, vrender_kits_2.registerArc)(), (0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,4CAA6B,GAAE,CAAC;AAChC,IAAA,0CAA2B,GAAE,CAAC;AAC9B,IAAA,2CAA4B,GAAE,CAAC;AAC/B,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,kCAAmB,GAAE,CAAC;AACtB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport {\n container,\n isBrowserEnv,\n isNodeEnv,\n preLoadAllModule,\n registerFlexLayoutPlugin,\n registerViewTransform3dPlugin,\n registerHtmlAttributePlugin,\n registerReactAttributePlugin,\n registerDirectionalLight,\n registerOrthoCamera\n} from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\nexport const version = \"0.23.0-alpha.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,4CAA6B,GAAE,CAAC;AAChC,IAAA,0CAA2B,GAAE,CAAC;AAC9B,IAAA,2CAA4B,GAAE,CAAC;AAC/B,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,kCAAmB,GAAE,CAAC;AACtB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport {\n container,\n isBrowserEnv,\n isNodeEnv,\n preLoadAllModule,\n registerFlexLayoutPlugin,\n registerViewTransform3dPlugin,\n registerHtmlAttributePlugin,\n registerReactAttributePlugin,\n registerDirectionalLight,\n registerOrthoCamera\n} from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\nexport const version = \"0.23.0-alpha.3\";\n\npreLoadAllModule();\n\nif (isBrowserEnv()) {\n loadBrowserEnv(container);\n} else if (isNodeEnv()) {\n loadNodeEnv(container);\n}\nregisterArc();\nregisterArc3d();\nregisterArea();\nregisterCircle();\nregisterGlyph();\nregisterGroup();\nregisterImage();\nregisterLine();\nregisterPath();\nregisterPolygon();\nregisterPyramid3d();\nregisterRect();\nregisterRect3d();\nregisterRichtext();\nregisterShadowRoot();\nregisterSymbol();\nregisterText();\nregisterWrapText();\n\nregisterFlexLayoutPlugin();\nregisterViewTransform3dPlugin();\nregisterHtmlAttributePlugin();\nregisterReactAttributePlugin();\nregisterDirectionalLight();\nregisterOrthoCamera();\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -574,6 +574,25 @@ const EnvContribution = Symbol.for("EnvContribution");
|
|
|
574
574
|
const VGlobal = Symbol.for("VGlobal");
|
|
575
575
|
const DEFAULT_TEXT_FONT_FAMILY = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
|
|
576
576
|
|
|
577
|
+
class PerformanceRAF {
|
|
578
|
+
constructor() {
|
|
579
|
+
this.nextAnimationFrameCbs = [], this._rafHandle = null, this.runAnimationFrame = time => {
|
|
580
|
+
this._rafHandle = null;
|
|
581
|
+
const cbs = this.nextAnimationFrameCbs;
|
|
582
|
+
this.nextAnimationFrameCbs = [];
|
|
583
|
+
for (let i = 0; i < cbs.length; i++) cbs[i] && cbs[i](time);
|
|
584
|
+
}, this.tryRunAnimationFrameNextFrame = () => {
|
|
585
|
+
null === this._rafHandle && 0 !== this.nextAnimationFrameCbs.length && (this._rafHandle = vglobal.getRequestAnimationFrame()(this.runAnimationFrame));
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
addAnimationFrameCb(callback) {
|
|
589
|
+
return this.nextAnimationFrameCbs.push(callback), this.tryRunAnimationFrameNextFrame(), this.nextAnimationFrameCbs.length - 1;
|
|
590
|
+
}
|
|
591
|
+
removeAnimationFrameCb(index) {
|
|
592
|
+
return index >= 0 && index < this.nextAnimationFrameCbs.length && (this.nextAnimationFrameCbs[index] = null, !0);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
577
596
|
var __decorate$1L = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
578
597
|
var d,
|
|
579
598
|
c = arguments.length,
|
|
@@ -658,7 +677,7 @@ let DefaultGlobal = class {
|
|
|
658
677
|
this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
|
|
659
678
|
}
|
|
660
679
|
constructor(contributions) {
|
|
661
|
-
this.contributions = contributions, this._isImageAnonymous = !0, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
680
|
+
this.contributions = contributions, this._isImageAnonymous = !0, this._performanceRAFList = [], this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
662
681
|
onSetEnv: new SyncHook(["lastEnv", "env", "global"])
|
|
663
682
|
}, this.measureTextMethod = "native", this.optimizeVisible = !1;
|
|
664
683
|
}
|
|
@@ -714,6 +733,16 @@ let DefaultGlobal = class {
|
|
|
714
733
|
getRequestAnimationFrame() {
|
|
715
734
|
return this._env || this.setEnv("browser"), this.envContribution.getRequestAnimationFrame();
|
|
716
735
|
}
|
|
736
|
+
getSpecifiedRequestAnimationFrame(id) {
|
|
737
|
+
this._env || this.setEnv("browser"), this._performanceRAFList[id] || (this._performanceRAFList[id] = new PerformanceRAF());
|
|
738
|
+
const performanceRAF = this._performanceRAFList[id];
|
|
739
|
+
return callback => performanceRAF.addAnimationFrameCb(callback);
|
|
740
|
+
}
|
|
741
|
+
getSpecifiedCancelAnimationFrame(id) {
|
|
742
|
+
if (this._env || this.setEnv("browser"), !this._performanceRAFList[id]) return () => !1;
|
|
743
|
+
const performanceRAF = this._performanceRAFList[id];
|
|
744
|
+
return handle => performanceRAF.removeAnimationFrameCb(handle);
|
|
745
|
+
}
|
|
717
746
|
getCancelAnimationFrame() {
|
|
718
747
|
return this._env || this.setEnv("browser"), this.envContribution.getCancelAnimationFrame();
|
|
719
748
|
}
|
|
@@ -13816,7 +13845,7 @@ class BaseRender {
|
|
|
13816
13845
|
const p = context.project(x, y, z);
|
|
13817
13846
|
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();
|
|
13818
13847
|
}
|
|
13819
|
-
_draw(graphic, defaultAttr, computed3dMatrix, drawContext, params) {
|
|
13848
|
+
_draw(graphic, defaultAttr, computed3dMatrix, drawContext, params, themeAttribute) {
|
|
13820
13849
|
const {
|
|
13821
13850
|
context: context
|
|
13822
13851
|
} = drawContext;
|
|
@@ -13833,7 +13862,7 @@ class BaseRender {
|
|
|
13833
13862
|
z: z,
|
|
13834
13863
|
lastModelMatrix: lastModelMatrix
|
|
13835
13864
|
} = data;
|
|
13836
|
-
this.z = z, this.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();
|
|
13865
|
+
this.z = z, this.drawPathProxy(graphic, context, x, y, drawContext, params) || (this.drawShape(graphic, context, x, y, drawContext, params, null, null, themeAttribute), this.z = 0, context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix), context.highPerformanceRestore();
|
|
13837
13866
|
}
|
|
13838
13867
|
}
|
|
13839
13868
|
|
|
@@ -13917,9 +13946,9 @@ let DefaultCanvasArcRender = class extends BaseRender {
|
|
|
13917
13946
|
} else context.lineTo(cx + innerRadius * cos(innerStartAngle), cy + innerRadius * sin(innerStartAngle));
|
|
13918
13947
|
return collapsedToLine;
|
|
13919
13948
|
}
|
|
13920
|
-
drawShape(arc, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
13921
|
-
|
|
13922
|
-
|
|
13949
|
+
drawShape(arc, context, x, y, drawContext, params, fillCb, strokeCb, arcAttribute) {
|
|
13950
|
+
arcAttribute = null != arcAttribute ? arcAttribute : getTheme(arc, null == params ? void 0 : params.theme).arc;
|
|
13951
|
+
const {
|
|
13923
13952
|
fill = arcAttribute.fill,
|
|
13924
13953
|
stroke = arcAttribute.stroke,
|
|
13925
13954
|
x: originX = arcAttribute.x,
|
|
@@ -13960,17 +13989,7 @@ let DefaultCanvasArcRender = class extends BaseRender {
|
|
|
13960
13989
|
isFullStroke: isFullStroke,
|
|
13961
13990
|
stroke: arrayStroke
|
|
13962
13991
|
} = parseStroke(stroke);
|
|
13963
|
-
if (doFill || isFullStroke) {
|
|
13964
|
-
context.beginPath(), drawArcPath$1(arc, context, x, y, outerRadius, innerRadius), beforeRenderContribitionsRuned = !0, context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
|
|
13965
|
-
const _runFill = () => {
|
|
13966
|
-
doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
|
|
13967
|
-
},
|
|
13968
|
-
_runStroke = () => {
|
|
13969
|
-
doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.stroke()));
|
|
13970
|
-
};
|
|
13971
|
-
fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
|
|
13972
|
-
}
|
|
13973
|
-
if (!isFullStroke && doStroke) {
|
|
13992
|
+
if ((doFill || isFullStroke) && (context.beginPath(), drawArcPath$1(arc, context, x, y, outerRadius, innerRadius), beforeRenderContribitionsRuned = !0, context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), fillStrokeOrder ? (this._runStroke(arc, context, x, y, arcAttribute, doStroke, sVisible, strokeCb), this._runFill(arc, context, x, y, arcAttribute, doFill, fVisible, originX, originY, fillCb)) : (this._runFill(arc, context, x, y, arcAttribute, doFill, fVisible, originX, originY, fillCb), this._runStroke(arc, context, x, y, arcAttribute, doStroke, sVisible, strokeCb))), !isFullStroke && doStroke) {
|
|
13974
13993
|
context.beginPath();
|
|
13975
13994
|
drawArcPath$1(arc, context, x, y, outerRadius, innerRadius, arrayStroke);
|
|
13976
13995
|
beforeRenderContribitionsRuned || this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke());
|
|
@@ -14006,9 +14025,15 @@ let DefaultCanvasArcRender = class extends BaseRender {
|
|
|
14006
14025
|
}
|
|
14007
14026
|
this.afterRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), tempChangeConicalColor && (fill.startAngle += conicalOffset, fill.endAngle += conicalOffset);
|
|
14008
14027
|
}
|
|
14028
|
+
_runFill(arc, context, x, y, arcAttribute, doFill, fVisible, originX, originY, fillCb) {
|
|
14029
|
+
doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
|
|
14030
|
+
}
|
|
14031
|
+
_runStroke(arc, context, x, y, arcAttribute, doStroke, sVisible, strokeCb) {
|
|
14032
|
+
doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
|
|
14033
|
+
}
|
|
14009
14034
|
draw(arc, renderService, drawContext, params) {
|
|
14010
14035
|
const arcAttribute = getTheme(arc, null == params ? void 0 : params.theme).arc;
|
|
14011
|
-
this._draw(arc, arcAttribute, !1, drawContext, params);
|
|
14036
|
+
this._draw(arc, arcAttribute, !1, drawContext, params, arcAttribute);
|
|
14012
14037
|
}
|
|
14013
14038
|
};
|
|
14014
14039
|
DefaultCanvasArcRender = __decorate$1C([injectable(), __param$S(0, inject(ContributionProvider)), __param$S(0, named(ArcRenderContribution)), __metadata$1e("design:paramtypes", [Object])], DefaultCanvasArcRender);
|
|
@@ -14719,26 +14744,25 @@ let DefaultCanvasRectRender = class extends BaseRender {
|
|
|
14719
14744
|
constructor(rectRenderContribitions) {
|
|
14720
14745
|
super(), this.rectRenderContribitions = rectRenderContribitions, this.type = "rect", this.numberType = RECT_NUMBER_TYPE, this.builtinContributions = [defaultRectRenderContribution, defaultRectBackgroundRenderContribution, defaultRectTextureRenderContribution], this.init(rectRenderContribitions);
|
|
14721
14746
|
}
|
|
14722
|
-
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
14723
|
-
|
|
14724
|
-
const
|
|
14725
|
-
|
|
14726
|
-
|
|
14727
|
-
|
|
14728
|
-
|
|
14729
|
-
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
|
-
|
|
14733
|
-
|
|
14734
|
-
|
|
14735
|
-
|
|
14736
|
-
|
|
14737
|
-
|
|
14738
|
-
|
|
14739
|
-
|
|
14740
|
-
|
|
14741
|
-
} = rect.attribute;
|
|
14747
|
+
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb, rectAttribute) {
|
|
14748
|
+
rectAttribute = null != rectAttribute ? rectAttribute : getTheme(rect, null == params ? void 0 : params.theme).rect;
|
|
14749
|
+
const {
|
|
14750
|
+
fill = rectAttribute.fill,
|
|
14751
|
+
background: background,
|
|
14752
|
+
stroke = rectAttribute.stroke,
|
|
14753
|
+
cornerRadius = rectAttribute.cornerRadius,
|
|
14754
|
+
cornerType = rectAttribute.cornerType,
|
|
14755
|
+
opacity = rectAttribute.opacity,
|
|
14756
|
+
fillOpacity = rectAttribute.fillOpacity,
|
|
14757
|
+
lineWidth = rectAttribute.lineWidth,
|
|
14758
|
+
strokeOpacity = rectAttribute.strokeOpacity,
|
|
14759
|
+
visible = rectAttribute.visible,
|
|
14760
|
+
x1: x1,
|
|
14761
|
+
y1: y1,
|
|
14762
|
+
x: originX = rectAttribute.x,
|
|
14763
|
+
y: originY = rectAttribute.y,
|
|
14764
|
+
fillStrokeOrder = rectAttribute.fillStrokeOrder
|
|
14765
|
+
} = rect.attribute;
|
|
14742
14766
|
let {
|
|
14743
14767
|
width: width,
|
|
14744
14768
|
height: height
|
|
@@ -14756,18 +14780,17 @@ let DefaultCanvasRectRender = class extends BaseRender {
|
|
|
14756
14780
|
doFill: doFill,
|
|
14757
14781
|
doStroke: doStroke
|
|
14758
14782
|
};
|
|
14759
|
-
context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
|
|
14760
|
-
|
|
14761
|
-
|
|
14762
|
-
|
|
14763
|
-
|
|
14764
|
-
|
|
14765
|
-
|
|
14766
|
-
fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
|
|
14783
|
+
context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke), fillStrokeOrder ? (this._runStroke(rect, context, x, y, rectAttribute, doFillOrStroke, sVisible, originX, originY, strokeCb), this._runFill(rect, context, x, y, rectAttribute, doFillOrStroke, fVisible, originX, originY, fillCb)) : (this._runFill(rect, context, x, y, rectAttribute, doFillOrStroke, fVisible, originX, originY, fillCb), this._runStroke(rect, context, x, y, rectAttribute, doFillOrStroke, sVisible, originX, originY, strokeCb)), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
|
|
14784
|
+
}
|
|
14785
|
+
_runFill(rect, context, x, y, rectAttribute, doFillOrStroke, fVisible, originX, originY, fillCb) {
|
|
14786
|
+
doFillOrStroke.doFill && (fillCb ? fillCb(context, rect.attribute, rectAttribute) : fVisible && (context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.fill()));
|
|
14787
|
+
}
|
|
14788
|
+
_runStroke(rect, context, x, y, rectAttribute, doFillOrStroke, sVisible, originX, originY, strokeCb) {
|
|
14789
|
+
doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, rect.attribute, rectAttribute) : sVisible && (context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.stroke()));
|
|
14767
14790
|
}
|
|
14768
14791
|
draw(rect, renderService, drawContext, params) {
|
|
14769
14792
|
const rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect;
|
|
14770
|
-
this.
|
|
14793
|
+
this._draw(rect, rectAttribute, !1, drawContext, params, rectAttribute);
|
|
14771
14794
|
}
|
|
14772
14795
|
};
|
|
14773
14796
|
DefaultCanvasRectRender = __decorate$1x([injectable(), __param$O(0, inject(ContributionProvider)), __param$O(0, named(RectRenderContribution)), __metadata$1a("design:paramtypes", [Object])], DefaultCanvasRectRender);
|
|
@@ -14791,10 +14814,10 @@ let DefaultCanvasSymbolRender = class extends BaseRender {
|
|
|
14791
14814
|
constructor(symbolRenderContribitions) {
|
|
14792
14815
|
super(), this.symbolRenderContribitions = symbolRenderContribitions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(symbolRenderContribitions);
|
|
14793
14816
|
}
|
|
14794
|
-
drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
14817
|
+
drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb, symbolAttribute) {
|
|
14795
14818
|
var _a;
|
|
14796
|
-
|
|
14797
|
-
|
|
14819
|
+
symbolAttribute = null != symbolAttribute ? symbolAttribute : getTheme(symbol, null == params ? void 0 : params.theme).symbol;
|
|
14820
|
+
const {
|
|
14798
14821
|
size = symbolAttribute.size,
|
|
14799
14822
|
x: originX = symbolAttribute.x,
|
|
14800
14823
|
y: originY = symbolAttribute.y,
|
|
@@ -14839,14 +14862,13 @@ let DefaultCanvasSymbolRender = class extends BaseRender {
|
|
|
14839
14862
|
a.stroke && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && clipRange >= 1 && (context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
|
|
14840
14863
|
};
|
|
14841
14864
|
fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
|
|
14842
|
-
}) && context.closePath(), context.camera = camera, context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
|
|
14846
|
-
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
|
|
14865
|
+
}) && context.closePath(), context.camera = camera, context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb), fillStrokeOrder ? (this._runStroke(symbol, context, x, y, symbolAttribute, doStroke, sVisible, originX, originY, parsedPath, clipRange, scaleX, scaleY, strokeCb), this._runFill(symbol, context, x, y, symbolAttribute, doFill, fVisible, originX, originY, parsedPath, fillCb)) : (this._runFill(symbol, context, x, y, symbolAttribute, doFill, fVisible, originX, originY, parsedPath, fillCb), this._runStroke(symbol, context, x, y, symbolAttribute, doStroke, sVisible, originX, originY, parsedPath, clipRange, scaleX, scaleY, strokeCb)), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
|
|
14866
|
+
}
|
|
14867
|
+
_runFill(symbol, context, x, y, symbolAttribute, doFill, fVisible, originX, originY, parsedPath, fillCb) {
|
|
14868
|
+
doFill && !parsedPath.isSvg && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : fVisible && (context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute), context.fill()));
|
|
14869
|
+
}
|
|
14870
|
+
_runStroke(symbol, context, x, y, symbolAttribute, doStroke, sVisible, originX, originY, parsedPath, clipRange, scaleX, scaleY, strokeCb) {
|
|
14871
|
+
doStroke && !parsedPath.isSvg && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && clipRange >= 1 && (context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
|
|
14850
14872
|
}
|
|
14851
14873
|
draw(symbol, renderService, drawContext, params) {
|
|
14852
14874
|
const symbolAttribute = getTheme(symbol, null == params ? void 0 : params.theme).symbol;
|
|
@@ -15231,16 +15253,19 @@ let DefaultCanvasGroupRender = class {
|
|
|
15231
15253
|
constructor(groupRenderContribitions) {
|
|
15232
15254
|
this.groupRenderContribitions = groupRenderContribitions, this.numberType = GROUP_NUMBER_TYPE;
|
|
15233
15255
|
}
|
|
15234
|
-
drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
15235
|
-
const
|
|
15236
|
-
|
|
15237
|
-
|
|
15238
|
-
|
|
15239
|
-
|
|
15256
|
+
drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb, groupAttribute) {
|
|
15257
|
+
const {
|
|
15258
|
+
clip: clip,
|
|
15259
|
+
fill: fill,
|
|
15260
|
+
stroke: stroke,
|
|
15261
|
+
background: background
|
|
15262
|
+
} = group.attribute;
|
|
15263
|
+
if (!(clip || fill || stroke || background)) return;
|
|
15264
|
+
groupAttribute = null != groupAttribute ? groupAttribute : getTheme(group, null == params ? void 0 : params.theme).group;
|
|
15265
|
+
const {
|
|
15240
15266
|
opacity = groupAttribute.opacity,
|
|
15241
15267
|
width = groupAttribute.width,
|
|
15242
15268
|
height = groupAttribute.height,
|
|
15243
|
-
clip = groupAttribute.clip,
|
|
15244
15269
|
fillOpacity = groupAttribute.fillOpacity,
|
|
15245
15270
|
strokeOpacity = groupAttribute.strokeOpacity,
|
|
15246
15271
|
cornerRadius = groupAttribute.cornerRadius,
|
|
@@ -15288,6 +15313,7 @@ let DefaultCanvasGroupRender = class {
|
|
|
15288
15313
|
});
|
|
15289
15314
|
}
|
|
15290
15315
|
draw(group, renderService, drawContext, params) {
|
|
15316
|
+
var _a;
|
|
15291
15317
|
const {
|
|
15292
15318
|
context: context
|
|
15293
15319
|
} = drawContext;
|
|
@@ -15295,16 +15321,18 @@ let DefaultCanvasGroupRender = class {
|
|
|
15295
15321
|
const {
|
|
15296
15322
|
clip: clip,
|
|
15297
15323
|
baseOpacity = 1,
|
|
15298
|
-
drawMode: drawMode
|
|
15299
|
-
x: x,
|
|
15300
|
-
y: y,
|
|
15301
|
-
width: width,
|
|
15302
|
-
height: height
|
|
15324
|
+
drawMode: drawMode
|
|
15303
15325
|
} = group.attribute,
|
|
15304
15326
|
lastNativeContext = context.nativeContext,
|
|
15305
15327
|
lastNativeCanvas = context.canvas.nativeCanvas;
|
|
15306
15328
|
if (drawMode > 0) {
|
|
15307
|
-
const
|
|
15329
|
+
const {
|
|
15330
|
+
x: x,
|
|
15331
|
+
y: y,
|
|
15332
|
+
width: width,
|
|
15333
|
+
height: height
|
|
15334
|
+
} = group.attribute,
|
|
15335
|
+
canvas = context.canvas,
|
|
15308
15336
|
newCanvas = vglobal.createCanvas({
|
|
15309
15337
|
width: canvas.width,
|
|
15310
15338
|
height: canvas.height,
|
|
@@ -15317,21 +15345,27 @@ let DefaultCanvasGroupRender = class {
|
|
|
15317
15345
|
clip ? context.save() : context.highPerformanceSave();
|
|
15318
15346
|
const baseGlobalAlpha = context.baseGlobalAlpha;
|
|
15319
15347
|
context.baseGlobalAlpha *= baseOpacity;
|
|
15320
|
-
const
|
|
15321
|
-
lastModelMatrix = context.modelMatrix;
|
|
15348
|
+
const lastModelMatrix = context.modelMatrix;
|
|
15322
15349
|
if (context.camera) {
|
|
15323
|
-
const
|
|
15350
|
+
const groupAttribute = getTheme(group, null == params ? void 0 : params.theme).group,
|
|
15351
|
+
nextModelMatrix = mat4Allocate.allocate(),
|
|
15324
15352
|
modelMatrix = mat4Allocate.allocate();
|
|
15325
15353
|
getModelMatrix(modelMatrix, group, groupAttribute), multiplyMat4Mat4(nextModelMatrix, lastModelMatrix || nextModelMatrix, modelMatrix), context.modelMatrix = nextModelMatrix, mat4Allocate.free(modelMatrix), context.setTransform(1, 0, 0, 1, 0, 0, !0);
|
|
15326
15354
|
} else context.transformFromMatrix(group.transMatrix, !0);
|
|
15327
|
-
context.beginPath(), params.skipDraw ? this.drawShape(group, context, 0, 0, drawContext, params, () => !1, () => !1) : this.drawShape(group, context, 0, 0, drawContext);
|
|
15355
|
+
context.beginPath(), params.skipDraw ? this.drawShape(group, context, 0, 0, drawContext, params, () => !1, () => !1) : this.drawShape(group, context, 0, 0, drawContext, null, null, null);
|
|
15328
15356
|
const {
|
|
15329
|
-
scrollX
|
|
15330
|
-
scrollY
|
|
15357
|
+
scrollX: scrollX,
|
|
15358
|
+
scrollY: scrollY
|
|
15331
15359
|
} = group.attribute;
|
|
15332
15360
|
let p;
|
|
15333
|
-
if ((scrollX || scrollY) && context.translate(scrollX, scrollY), params && params.
|
|
15334
|
-
const
|
|
15361
|
+
if ((scrollX || scrollY) && context.translate(scrollX, scrollY), params && params.renderInGroup && (p = params.renderInGroup(params.skipDraw, group, drawContext, null === (_a = params.renderInGroupParams) || void 0 === _a ? void 0 : _a.nextM)), context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix, context.baseGlobalAlpha = baseGlobalAlpha, drawMode > 0) {
|
|
15362
|
+
const {
|
|
15363
|
+
x: x,
|
|
15364
|
+
y: y,
|
|
15365
|
+
width: width,
|
|
15366
|
+
height: height
|
|
15367
|
+
} = group.attribute,
|
|
15368
|
+
newContext = context.nativeContext,
|
|
15335
15369
|
newCanvas = context.canvas.nativeCanvas;
|
|
15336
15370
|
lastNativeContext.save(), lastNativeContext.setTransform(context.dpr, 0, 0, context.dpr, 0, 0, !0), 1 === drawMode && newContext.rect(x, y, width, height), lastNativeContext.drawImage(newCanvas, 0, 0, newCanvas.width, newCanvas.height, 0, 0, context.canvas.displayWidth, context.canvas.displayHeight);
|
|
15337
15371
|
const transform = newContext.getTransform();
|
|
@@ -15549,6 +15583,7 @@ let CommonDrawItemInterceptorContribution = class {
|
|
|
15549
15583
|
this.order = 1, this.interceptors = [new ShadowRootDrawItemInterceptorContribution(), new Canvas3DDrawItemInterceptor(), new InteractiveDrawItemInterceptorContribution(), new DebugDrawItemInterceptorContribution()];
|
|
15550
15584
|
}
|
|
15551
15585
|
afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
15586
|
+
if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
|
|
15552
15587
|
for (let i = 0; i < this.interceptors.length; i++) if (this.interceptors[i].afterDrawItem && this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)) return !0;
|
|
15553
15588
|
return !1;
|
|
15554
15589
|
}
|
|
@@ -16092,7 +16127,14 @@ var __decorate$1l = undefined && undefined.__decorate || function (decorators, t
|
|
|
16092
16127
|
};
|
|
16093
16128
|
let DefaultDrawContribution = class {
|
|
16094
16129
|
constructor(contributions, drawItemInterceptorContributions) {
|
|
16095
|
-
this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this.
|
|
16130
|
+
this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this._renderInGroup = (skipSort, group, drawContext, nextM) => {
|
|
16131
|
+
var _a;
|
|
16132
|
+
skipSort ? group.forEachChildren(item => {
|
|
16133
|
+
drawContext.break || (item.isContainer ? this.renderGroup(item, drawContext, nextM) : this.renderItem(item, drawContext));
|
|
16134
|
+
}) : foreach(group, DefaultAttribute.zIndex, item => {
|
|
16135
|
+
drawContext.break || (item.isContainer ? this.renderGroup(item, drawContext, nextM) : this.renderItem(item, drawContext));
|
|
16136
|
+
}, !1, !!(null === (_a = drawContext.context) || void 0 === _a ? void 0 : _a.camera));
|
|
16137
|
+
}, this.currentRenderMap = new Map(), this.defaultRenderMap = new Map(), this.styleRenderMap = new Map(), this.dirtyBounds = new Bounds(), this.backupDirtyBounds = new Bounds(), this.global = application.global, this.layerService = application.layerService, isArray$1(this.contributions) || (this.contributions = [this.contributions]), this.init();
|
|
16096
16138
|
}
|
|
16097
16139
|
init() {
|
|
16098
16140
|
this.contributions.forEach(item => {
|
|
@@ -16120,12 +16162,12 @@ let DefaultDrawContribution = class {
|
|
|
16120
16162
|
dirtyBounds.x1 = Math.floor(b.x1), dirtyBounds.y1 = Math.floor(b.y1), dirtyBounds.x2 = Math.ceil(b.x2), dirtyBounds.y2 = Math.ceil(b.y2);
|
|
16121
16163
|
}
|
|
16122
16164
|
const d = context.dpr % 1;
|
|
16123
|
-
(d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds), context.
|
|
16165
|
+
(d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds), context.save(), context.reset(!1), context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f), context.clearMatrix(!1), context.translate(viewBox.x1, viewBox.y1, !0), context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip(), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), renderService.renderTreeRoots.sort((a, b) => {
|
|
16124
16166
|
var _a, _b;
|
|
16125
16167
|
return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
|
|
16126
16168
|
}).forEach(group => {
|
|
16127
16169
|
group.isContainer ? this.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : this.renderItem(group, drawContext);
|
|
16128
|
-
}), context.restore(), context.
|
|
16170
|
+
}), context.restore(), context.draw();
|
|
16129
16171
|
}
|
|
16130
16172
|
doRegister() {
|
|
16131
16173
|
throw new Error("暂不支持");
|
|
@@ -16151,15 +16193,12 @@ let DefaultDrawContribution = class {
|
|
|
16151
16193
|
const gm = group.transMatrix;
|
|
16152
16194
|
nextM = matrixAllocate.allocateByObj(parentMatrix).multiply(gm.a, gm.b, gm.c, gm.d, gm.e, gm.f), this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(nextM.getInverse());
|
|
16153
16195
|
}
|
|
16154
|
-
this.renderItem(group, drawContext, {
|
|
16155
|
-
|
|
16156
|
-
|
|
16157
|
-
|
|
16158
|
-
|
|
16159
|
-
|
|
16160
|
-
drawContext.break || (item.isContainer ? this.renderGroup(item, drawContext, nextM) : this.renderItem(item, drawContext));
|
|
16161
|
-
}, !1, !!(null === (_a = drawContext.context) || void 0 === _a ? void 0 : _a.camera));
|
|
16162
|
-
}
|
|
16196
|
+
drawContext.isGroupScroll = !(!group.attribute.scrollX && !group.attribute.scrollY), this.renderItem(group, drawContext, {
|
|
16197
|
+
renderInGroupParams: {
|
|
16198
|
+
skipSort: skipSort,
|
|
16199
|
+
nextM: nextM
|
|
16200
|
+
},
|
|
16201
|
+
renderInGroup: this._renderInGroup
|
|
16163
16202
|
}), this.useDirtyBounds && (this.dirtyBounds.copy(tempBounds), boundsAllocate.free(tempBounds), matrixAllocate.free(nextM));
|
|
16164
16203
|
}
|
|
16165
16204
|
_increaseRender(group, drawContext) {
|
|
@@ -16216,13 +16255,13 @@ let DefaultDrawContribution = class {
|
|
|
16216
16255
|
const renderer = this.getRenderContribution(graphic);
|
|
16217
16256
|
if (!renderer) return;
|
|
16218
16257
|
let tempBounds,
|
|
16219
|
-
retrans =
|
|
16220
|
-
if (
|
|
16258
|
+
retrans = !1;
|
|
16259
|
+
if (drawContext.isGroupScroll) {
|
|
16221
16260
|
const {
|
|
16222
16261
|
scrollX = 0,
|
|
16223
16262
|
scrollY = 0
|
|
16224
16263
|
} = graphic.parent.attribute;
|
|
16225
|
-
|
|
16264
|
+
retrans = !0, this.scrollMatrix || (this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0)), this.scrollMatrix.translate(-scrollX, -scrollY);
|
|
16226
16265
|
}
|
|
16227
16266
|
if (retrans && (tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)), this.useDirtyBounds && !graphic.isContainer && "empty" !== graphic.attribute.boundsMode && !isRectIntersect(graphic.AABBBounds, null != tempBounds ? tempBounds : this.dirtyBounds, !1)) {
|
|
16228
16267
|
if (retrans && graphic.parent) {
|
|
@@ -16778,7 +16817,7 @@ class Stage extends Group {
|
|
|
16778
16817
|
}
|
|
16779
16818
|
constructor() {
|
|
16780
16819
|
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16781
|
-
var _a;
|
|
16820
|
+
var _a, _b;
|
|
16782
16821
|
super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
|
|
16783
16822
|
if (!(this._skipRender < 0)) if (visible) {
|
|
16784
16823
|
if (this.dirtyBounds) {
|
|
@@ -16792,8 +16831,7 @@ class Stage extends Group {
|
|
|
16792
16831
|
}, this.afterRender = stage => {
|
|
16793
16832
|
this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
|
|
16794
16833
|
}, this.afterTickCb = () => {
|
|
16795
|
-
|
|
16796
|
-
this.tickedBeforeRender = !0, "performance" === (null === (_a = this.params.optimize) || void 0 === _a ? void 0 : _a.tickRenderMode) || "rendering" !== this.state && this.render();
|
|
16834
|
+
this.tickedBeforeRender = !0, "rendering" !== this.state && this.render();
|
|
16797
16835
|
}, this.params = params, this.theme = new Theme(), this.hooks = {
|
|
16798
16836
|
beforeRender: new SyncHook(["stage"]),
|
|
16799
16837
|
afterRender: new SyncHook(["stage"])
|
|
@@ -16809,13 +16847,14 @@ class Stage extends Group {
|
|
|
16809
16847
|
}), this.state = "normal", this.renderCount = 0, this.tryInitEventSystem(), this._background = null !== (_a = params.background) && void 0 !== _a ? _a : DefaultConfig$1.BACKGROUND, this.appendChild(this.layerService.createLayer(this, {
|
|
16810
16848
|
main: !0
|
|
16811
16849
|
})), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), params.autoRefresh && this.enableAutoRefresh(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this.supportInteractiveLayer = !1 !== params.interactiveLayer, params.optimize || (params.optimize = {
|
|
16812
|
-
|
|
16850
|
+
tickRenderMode: "performance"
|
|
16813
16851
|
}), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
|
|
16814
16852
|
background: this._background
|
|
16815
|
-
}), this.initAnimate(params);
|
|
16853
|
+
}), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
|
|
16816
16854
|
}
|
|
16817
16855
|
initAnimate(params) {
|
|
16818
|
-
|
|
16856
|
+
var _a;
|
|
16857
|
+
this.createTicker && this.createTimeline && (this.ticker = params.ticker || this.createTicker(this), "effect" !== (null === (_a = this.params.optimize) || void 0 === _a ? void 0 : _a.tickRenderMode) && this.ticker.setFPS(30), this.timeline = this.createTimeline(), this.ticker.addTimeline(this.timeline), this.ticker.on("tick", this.afterTickCb));
|
|
16819
16858
|
}
|
|
16820
16859
|
startAnimate() {
|
|
16821
16860
|
this.ticker && this.timeline && (this.ticker.start(), this.timeline.resume());
|
|
@@ -17063,7 +17102,7 @@ class Stage extends Group {
|
|
|
17063
17102
|
renderNextFrame(layers, force) {
|
|
17064
17103
|
this.nextFrameRenderLayerSet.size !== this.childrenCount && (layers || this).forEach(layer => {
|
|
17065
17104
|
this.nextFrameRenderLayerSet.add(layer);
|
|
17066
|
-
}), this.willNextFrameRender || (this.willNextFrameRender = !0, this.global.
|
|
17105
|
+
}), this.willNextFrameRender || (this.willNextFrameRender = !0, this.global.getSpecifiedRequestAnimationFrame(this.rafId)(() => {
|
|
17067
17106
|
this._doRenderInThisFrame(), this.willNextFrameRender = !1;
|
|
17068
17107
|
}));
|
|
17069
17108
|
}
|
|
@@ -17270,6 +17309,9 @@ let EmptyContext2d = class {
|
|
|
17270
17309
|
clear() {
|
|
17271
17310
|
this.save(), this.resetTransform(), this.restore();
|
|
17272
17311
|
}
|
|
17312
|
+
reset() {
|
|
17313
|
+
this.matrix.setValue(1, 0, 0, 1, 0, 0), this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack.length = 0;
|
|
17314
|
+
}
|
|
17273
17315
|
restore() {
|
|
17274
17316
|
this.stack.length > 0 && (matrixAllocate.free(this.matrix), this.matrix = this.stack.pop(), this.setTransformForCurrent());
|
|
17275
17317
|
}
|
|
@@ -18608,21 +18650,6 @@ const splitPath = (path, count) => {
|
|
|
18608
18650
|
return res;
|
|
18609
18651
|
};
|
|
18610
18652
|
|
|
18611
|
-
class PerformanceRAF {
|
|
18612
|
-
constructor() {
|
|
18613
|
-
this.nextAnimationFrameCbs = [], this.runAnimationFrame = time => {
|
|
18614
|
-
const cbs = this.nextAnimationFrameCbs;
|
|
18615
|
-
this.nextAnimationFrameCbs = [];
|
|
18616
|
-
for (let i = 0; i < cbs.length; i++) cbs[i](time);
|
|
18617
|
-
}, this.tryRunAnimationFrameNextFrame = () => {
|
|
18618
|
-
this.nextAnimationFrameCbs && 1 === this.nextAnimationFrameCbs.length && vglobal.getRequestAnimationFrame()(this.runAnimationFrame);
|
|
18619
|
-
};
|
|
18620
|
-
}
|
|
18621
|
-
addAnimationFrameCb(callback) {
|
|
18622
|
-
return this.nextAnimationFrameCbs.push(callback), this.tryRunAnimationFrameNextFrame(), this.nextAnimationFrameCbs.length - 1;
|
|
18623
|
-
}
|
|
18624
|
-
}
|
|
18625
|
-
|
|
18626
18653
|
var __rest$1 = undefined && undefined.__rest || function (s, e) {
|
|
18627
18654
|
var t = {};
|
|
18628
18655
|
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
@@ -23453,10 +23480,11 @@ let BrowserContext2d = class {
|
|
|
23453
23480
|
return this.nativeContext.fillStyle;
|
|
23454
23481
|
}
|
|
23455
23482
|
set font(d) {
|
|
23456
|
-
this.nativeContext.font = d;
|
|
23483
|
+
d !== this._font && (this._font = d, this.nativeContext.font = d);
|
|
23457
23484
|
}
|
|
23458
23485
|
get font() {
|
|
23459
|
-
|
|
23486
|
+
var _a;
|
|
23487
|
+
return null !== (_a = this._font) && void 0 !== _a ? _a : this.nativeContext.font;
|
|
23460
23488
|
}
|
|
23461
23489
|
set globalAlpha(d) {
|
|
23462
23490
|
this.nativeContext.globalAlpha = d * this.baseGlobalAlpha;
|
|
@@ -23555,7 +23583,8 @@ let BrowserContext2d = class {
|
|
|
23555
23583
|
this.nativeContext = context, this.canvas = canvas, this.matrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack = [], this.dpr = dpr, this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this._clearMatrix = new Matrix(1, 0, 0, 1, 0, 0), this.baseGlobalAlpha = 1;
|
|
23556
23584
|
}
|
|
23557
23585
|
reset() {
|
|
23558
|
-
|
|
23586
|
+
let setTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
23587
|
+
this.stack.length && Logger.getInstance().warn("可能存在bug,matrix没有清空"), this.matrix.setValue(1, 0, 0, 1, 0, 0), this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack.length = 0, setTransform && this.nativeContext.setTransform(1, 0, 0, 1, 0, 0);
|
|
23559
23588
|
}
|
|
23560
23589
|
getCanvas() {
|
|
23561
23590
|
return this.canvas;
|
|
@@ -23577,7 +23606,7 @@ let BrowserContext2d = class {
|
|
|
23577
23606
|
this.save(), this.resetTransform(), this.nativeContext.clearRect(0, 0, this.canvas.width, this.canvas.height), this.restore();
|
|
23578
23607
|
}
|
|
23579
23608
|
restore() {
|
|
23580
|
-
this.nativeContext.restore(), this.stack.length > 0 && (matrixAllocate.free(this.matrix), this.matrix = this.stack.pop(), this.setTransformForCurrent(!0));
|
|
23609
|
+
this.nativeContext.restore(), this.stack.length > 0 && (matrixAllocate.free(this.matrix), this.matrix = this.stack.pop(), this.setTransformForCurrent(!0)), this.font = "", this._clearFilterStyle = !1, this._clearShadowStyle = !1;
|
|
23581
23610
|
}
|
|
23582
23611
|
highPerformanceRestore() {
|
|
23583
23612
|
this.stack.length > 0 && (matrixAllocate.free(this.matrix), this.matrix = this.stack.pop());
|
|
@@ -23850,14 +23879,20 @@ let BrowserContext2d = class {
|
|
|
23850
23879
|
const {
|
|
23851
23880
|
opacity = defaultParams.opacity,
|
|
23852
23881
|
shadowBlur = defaultParams.shadowBlur,
|
|
23853
|
-
shadowColor = defaultParams.shadowColor,
|
|
23854
|
-
shadowOffsetX = defaultParams.shadowOffsetX,
|
|
23855
|
-
shadowOffsetY = defaultParams.shadowOffsetY,
|
|
23856
23882
|
blur = defaultParams.blur,
|
|
23857
|
-
filter = defaultParams.filter,
|
|
23858
23883
|
globalCompositeOperation = defaultParams.globalCompositeOperation
|
|
23859
23884
|
} = attribute;
|
|
23860
|
-
opacity <= 1e-12
|
|
23885
|
+
if (!(opacity <= 1e-12)) {
|
|
23886
|
+
if (shadowBlur) {
|
|
23887
|
+
const {
|
|
23888
|
+
shadowColor = defaultParams.shadowColor,
|
|
23889
|
+
shadowOffsetX = defaultParams.shadowOffsetX,
|
|
23890
|
+
shadowOffsetY = defaultParams.shadowOffsetY
|
|
23891
|
+
} = attribute;
|
|
23892
|
+
_context.shadowBlur = shadowBlur * this.dpr, _context.shadowColor = shadowColor, _context.shadowOffsetX = shadowOffsetX * this.dpr, _context.shadowOffsetY = shadowOffsetY * this.dpr, this._clearShadowStyle = !0;
|
|
23893
|
+
} else this._clearShadowStyle && (_context.shadowBlur = 0, _context.shadowOffsetX = 0, _context.shadowOffsetY = 0);
|
|
23894
|
+
blur ? (_context.filter = `blur(${blur}px)`, this._clearFilterStyle = !0) : this._clearFilterStyle && (_context.filter = "blur(0px)", this._clearFilterStyle = !1), globalCompositeOperation ? (_context.globalCompositeOperation = globalCompositeOperation, this._clearGlobalCompositeOperationStyle = !0) : this._clearGlobalCompositeOperationStyle && (_context.globalCompositeOperation = "source-over", this._clearGlobalCompositeOperationStyle = !1);
|
|
23895
|
+
}
|
|
23861
23896
|
}
|
|
23862
23897
|
setStrokeStyle(params, attribute, offsetX, offsetY, defaultParams) {
|
|
23863
23898
|
if (Array.isArray(defaultParams)) {
|
|
@@ -23896,7 +23931,7 @@ let BrowserContext2d = class {
|
|
|
23896
23931
|
const {
|
|
23897
23932
|
scaleIn3d = defaultParams.scaleIn3d
|
|
23898
23933
|
} = params;
|
|
23899
|
-
params.font ?
|
|
23934
|
+
params.font ? this.font = params.font : this.font = getContextFont(params, defaultParams, scaleIn3d && this.camera && this.camera.getProjectionScale(z));
|
|
23900
23935
|
const {
|
|
23901
23936
|
fontFamily = defaultParams.fontFamily,
|
|
23902
23937
|
fontSize = defaultParams.fontSize
|
|
@@ -23906,7 +23941,7 @@ let BrowserContext2d = class {
|
|
|
23906
23941
|
setTextStyle(params, defaultParams, z) {
|
|
23907
23942
|
var _a, _b;
|
|
23908
23943
|
const _context = this.nativeContext;
|
|
23909
|
-
defaultParams || (defaultParams = this.textAttributes), params.font ?
|
|
23944
|
+
defaultParams || (defaultParams = this.textAttributes), params.font ? this.font = params.font : this.font = getContextFont(params, defaultParams, this.camera && this.camera.getProjectionScale(z));
|
|
23910
23945
|
const {
|
|
23911
23946
|
fontFamily = defaultParams.fontFamily,
|
|
23912
23947
|
fontSize = defaultParams.fontSize
|
|
@@ -29810,7 +29845,7 @@ function particleEffect(ctx, row, column, rowCount, columnCount, ratio, graphic)
|
|
|
29810
29845
|
|
|
29811
29846
|
const roughModule = _roughModule;
|
|
29812
29847
|
|
|
29813
|
-
const version = "0.23.0-alpha.
|
|
29848
|
+
const version = "0.23.0-alpha.3";
|
|
29814
29849
|
preLoadAllModule();
|
|
29815
29850
|
if (isBrowserEnv()) {
|
|
29816
29851
|
loadBrowserEnv(container);
|