@visactor/vrender 1.0.44 → 1.0.46-alpha.0

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import '@visactor/vrender-core';
2
- export declare const version = "1.0.44";
2
+ export declare const version = "1.0.46-alpha.0";
3
3
  export * from '@visactor/vrender-core';
4
4
  export * from '@visactor/vrender-kits';
5
5
  export * from '@visactor/vrender-animate';
package/cjs/index.js CHANGED
@@ -21,16 +21,17 @@ 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"), vrender_animate_1 = require("@visactor/vrender-animate");
23
23
 
24
- exports.version = "1.0.44", (0, vrender_core_1.preLoadAllModule)(), (0, vrender_core_1.isBrowserEnv)() ? (0,
25
- vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0, vrender_core_1.isNodeEnv)() && (0,
26
- vrender_kits_1.loadNodeEnv)(vrender_core_1.container), (0, vrender_kits_2.registerArc)(),
27
- (0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(), (0, vrender_kits_2.registerCircle)(),
28
- (0, vrender_kits_2.registerGlyph)(), (0, vrender_kits_2.registerGroup)(), (0, vrender_kits_2.registerImage)(),
29
- (0, vrender_kits_2.registerLine)(), (0, vrender_kits_2.registerPath)(), (0, vrender_kits_2.registerPolygon)(),
30
- (0, vrender_kits_2.registerPyramid3d)(), (0, vrender_kits_2.registerRect)(), (0,
31
- vrender_kits_2.registerRect3d)(), (0, vrender_kits_2.registerRichtext)(), (0, vrender_kits_2.registerShadowRoot)(),
32
- (0, vrender_kits_2.registerSymbol)(), (0, vrender_kits_2.registerText)(), (0, vrender_kits_2.registerWrapText)(),
33
- (0, vrender_kits_1.registerStar)(), (0, vrender_core_1.registerFlexLayoutPlugin)(),
24
+ exports.version = "1.0.46-alpha.0", (0, vrender_core_1.preLoadAllModule)(), (0,
25
+ vrender_core_1.isBrowserEnv)() ? (0, vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0,
26
+ vrender_core_1.isNodeEnv)() && (0, vrender_kits_1.loadNodeEnv)(vrender_core_1.container),
27
+ (0, vrender_kits_2.registerArc)(), (0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(),
28
+ (0, vrender_kits_2.registerCircle)(), (0, vrender_kits_2.registerGlyph)(), (0, vrender_kits_2.registerGroup)(),
29
+ (0, vrender_kits_2.registerImage)(), (0, vrender_kits_2.registerLine)(), (0, vrender_kits_2.registerPath)(),
30
+ (0, vrender_kits_2.registerPolygon)(), (0, vrender_kits_2.registerPyramid3d)(),
31
+ (0, vrender_kits_2.registerRect)(), (0, vrender_kits_2.registerRect3d)(), (0, vrender_kits_2.registerRichtext)(),
32
+ (0, vrender_kits_2.registerShadowRoot)(), (0, vrender_kits_2.registerSymbol)(),
33
+ (0, vrender_kits_2.registerText)(), (0, vrender_kits_2.registerWrapText)(), (0,
34
+ vrender_kits_1.registerStar)(), (0, vrender_core_1.registerFlexLayoutPlugin)(),
34
35
  (0, vrender_core_1.registerViewTransform3dPlugin)(), (0, vrender_core_1.registerHtmlAttributePlugin)(),
35
36
  (0, vrender_core_1.registerReactAttributePlugin)(), (0, vrender_core_1.registerDirectionalLight)(),
36
37
  (0, vrender_core_1.registerOrthoCamera)(), (0, vrender_animate_1.registerCustomAnimate)(),
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAmF;AACnF,yDAmBgC;AAChC,+DAAmF;AAEtE,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,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;AACnB,IAAA,2BAAY,GAAE,CAAC;AAEf,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;AAEtB,IAAA,uCAAqB,GAAE,CAAC;AACxB,IAAA,iCAAe,GAAE,CAAC;AAElB,yDAAuC;AACvC,yDAAuC;AACvC,4DAA0C;AAC1C,+DAA6C;AAG7C,6DAAkD;AAAzC,wGAAA,KAAK,OAAA;AACd,uDAAmD;AAA1C,yGAAA,SAAS,OAAA","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, registerStar } 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';\nimport { registerCustomAnimate, registerAnimate } from '@visactor/vrender-animate';\n// 导出版本号\nexport const version = \"1.0.44\";\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();\nregisterStar();\n\nregisterFlexLayoutPlugin();\nregisterViewTransform3dPlugin();\nregisterHtmlAttributePlugin();\nregisterReactAttributePlugin();\nregisterDirectionalLight();\nregisterOrthoCamera();\n\nregisterCustomAnimate();\nregisterAnimate();\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\nexport * from '@visactor/vrender-animate';\nexport * from '@visactor/vrender-components';\n\n// avoid naming conflicts with 'State' & 'Direction' in '@visactor/vrender-components'\nexport { State } from '@visactor/vrender-animate';\nexport { Direction } from '@visactor/vrender-core';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAmF;AACnF,yDAmBgC;AAChC,+DAAmF;AAEtE,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;AACnB,IAAA,2BAAY,GAAE,CAAC;AAEf,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;AAEtB,IAAA,uCAAqB,GAAE,CAAC;AACxB,IAAA,iCAAe,GAAE,CAAC;AAElB,yDAAuC;AACvC,yDAAuC;AACvC,4DAA0C;AAC1C,+DAA6C;AAG7C,6DAAkD;AAAzC,wGAAA,KAAK,OAAA;AACd,uDAAmD;AAA1C,yGAAA,SAAS,OAAA","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, registerStar } 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';\nimport { registerCustomAnimate, registerAnimate } from '@visactor/vrender-animate';\n// 导出版本号\nexport const version = \"1.0.46-alpha.0\";\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();\nregisterStar();\n\nregisterFlexLayoutPlugin();\nregisterViewTransform3dPlugin();\nregisterHtmlAttributePlugin();\nregisterReactAttributePlugin();\nregisterDirectionalLight();\nregisterOrthoCamera();\n\nregisterCustomAnimate();\nregisterAnimate();\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\nexport * from '@visactor/vrender-animate';\nexport * from '@visactor/vrender-components';\n\n// avoid naming conflicts with 'State' & 'Direction' in '@visactor/vrender-components'\nexport { State } from '@visactor/vrender-animate';\nexport { Direction } from '@visactor/vrender-core';\n"]}
package/dist/index.es.js CHANGED
@@ -9634,6 +9634,7 @@ const GRAPHIC_UPDATE_TAG_KEY = ["lineWidth", "scaleX", "scaleY", "angle", "ancho
9634
9634
  const tempConstantXYKey = ["x", "y"],
9635
9635
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
9636
9636
  tempConstantAngleKey = ["angle"],
9637
+ builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
9637
9638
  point = new Point();
9638
9639
  const NOWORK_ANIMATE_ATTR = {
9639
9640
  strokeSeg: 1,
@@ -9691,7 +9692,7 @@ class Graphic extends Node {
9691
9692
  constructor() {
9692
9693
  let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9693
9694
  var _a;
9694
- super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
9695
+ super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
9695
9696
  }
9696
9697
  getGraphicService() {
9697
9698
  var _a, _b;
@@ -9887,7 +9888,7 @@ class Graphic extends Node {
9887
9888
  setAttributes(params) {
9888
9889
  let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
9889
9890
  let context = arguments.length > 2 ? arguments[2] : undefined;
9890
- params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
9891
+ params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
9891
9892
  }
9892
9893
  _setAttributes(params) {
9893
9894
  let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
@@ -9904,7 +9905,7 @@ class Graphic extends Node {
9904
9905
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
9905
9906
  [key]: value
9906
9907
  }, this.attribute, key, context);
9907
- params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "shadowGraphic" === key && this.setShadowGraphic(value);
9908
+ params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
9908
9909
  }
9909
9910
  needUpdateTags(keys) {
9910
9911
  let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : GRAPHIC_UPDATE_TAG_KEY;
@@ -9925,7 +9926,7 @@ class Graphic extends Node {
9925
9926
  const context = {
9926
9927
  type: AttributeUpdateType.INIT
9927
9928
  };
9928
- params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
9929
+ params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background && this.loadImage(params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
9929
9930
  }
9930
9931
  translate(x, y) {
9931
9932
  var _a, _b;
@@ -10319,6 +10320,9 @@ class Graphic extends Node {
10319
10320
  function backgroundNotImage(image) {
10320
10321
  return !(!image.fill && !image.stroke);
10321
10322
  }
10323
+ function isExternalTexture(texture) {
10324
+ return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$1(texture));
10325
+ }
10322
10326
  Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
10323
10327
 
10324
10328
  var GroupUpdateAABBBoundsMode;
@@ -14280,33 +14284,37 @@ class DefaultBaseTextureRenderContribution {
14280
14284
  textureRatio = graphicAttribute.textureRatio,
14281
14285
  textureOptions = null
14282
14286
  } = graphic.attribute;
14283
- let pattern = this.textureMap.get(texture);
14284
- if (!pattern) switch (texture) {
14285
- case "circle":
14286
- pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
14287
- break;
14288
- case "diamond":
14289
- pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
14290
- break;
14291
- case "rect":
14292
- pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
14293
- break;
14294
- case "vertical-line":
14295
- pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
14296
- break;
14297
- case "horizontal-line":
14298
- pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
14299
- break;
14300
- case "bias-lr":
14301
- pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
14302
- break;
14303
- case "bias-rl":
14304
- pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
14305
- break;
14306
- case "grid":
14307
- pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
14287
+ let pattern = null;
14288
+ const patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr);
14289
+ if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
14290
+ if ("string" == typeof texture) switch (texture) {
14291
+ case "circle":
14292
+ pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
14293
+ break;
14294
+ case "diamond":
14295
+ pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
14296
+ break;
14297
+ case "rect":
14298
+ pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
14299
+ break;
14300
+ case "vertical-line":
14301
+ pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
14302
+ break;
14303
+ case "horizontal-line":
14304
+ pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
14305
+ break;
14306
+ case "bias-lr":
14307
+ pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
14308
+ break;
14309
+ case "bias-rl":
14310
+ pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
14311
+ break;
14312
+ case "grid":
14313
+ pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
14314
+ }
14315
+ pattern || (pattern = this.createResourcePattern(texture, graphic, context)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
14308
14316
  }
14309
- if (textureOptions && textureOptions.dynamicTexture) {
14317
+ if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
14310
14318
  const {
14311
14319
  gridConfig = {},
14312
14320
  useNewCanvas: useNewCanvas
@@ -14362,6 +14370,17 @@ class DefaultBaseTextureRenderContribution {
14362
14370
  }), x + b.x1 - x, y + b.y1 - y), context.restore();
14363
14371
  }
14364
14372
  }
14373
+ getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr) {
14374
+ return "string" != typeof texture ? texture : "wave" === texture ? null : `${texture}-${textureSize}-${texturePadding}-${textureColor}-${dpr}`;
14375
+ }
14376
+ createResourcePattern(texture, graphic, context) {
14377
+ var _a;
14378
+ const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
14379
+ data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
14380
+ if (!data) return null;
14381
+ const pattern = context.createPattern(data, "repeat");
14382
+ return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
14383
+ }
14365
14384
  }
14366
14385
  const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
14367
14386
 
@@ -53155,7 +53174,7 @@ TableSeriesNumber.defaultAttributes = {
53155
53174
  select: !0
53156
53175
  };
53157
53176
 
53158
- const version = "1.0.44";
53177
+ const version = "1.0.46-alpha.0";
53159
53178
  preLoadAllModule();
53160
53179
  if (isBrowserEnv()) {
53161
53180
  loadBrowserEnv(container);
package/dist/index.js CHANGED
@@ -9640,6 +9640,7 @@
9640
9640
  const tempConstantXYKey = ["x", "y"],
9641
9641
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
9642
9642
  tempConstantAngleKey = ["angle"],
9643
+ builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
9643
9644
  point = new Point();
9644
9645
  const NOWORK_ANIMATE_ATTR = {
9645
9646
  strokeSeg: 1,
@@ -9697,7 +9698,7 @@
9697
9698
  constructor() {
9698
9699
  let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9699
9700
  var _a;
9700
- super(), this._AABBBounds = new AABBBounds(), this._updateTag = exports.UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
9701
+ super(), this._AABBBounds = new AABBBounds(), this._updateTag = exports.UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
9701
9702
  }
9702
9703
  getGraphicService() {
9703
9704
  var _a, _b;
@@ -9893,7 +9894,7 @@
9893
9894
  setAttributes(params) {
9894
9895
  let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
9895
9896
  let context = arguments.length > 2 ? arguments[2] : undefined;
9896
- params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
9897
+ params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
9897
9898
  }
9898
9899
  _setAttributes(params) {
9899
9900
  let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
@@ -9910,7 +9911,7 @@
9910
9911
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
9911
9912
  [key]: value
9912
9913
  }, this.attribute, key, context);
9913
- params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "shadowGraphic" === key && this.setShadowGraphic(value);
9914
+ params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
9914
9915
  }
9915
9916
  needUpdateTags(keys) {
9916
9917
  let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : GRAPHIC_UPDATE_TAG_KEY;
@@ -9931,7 +9932,7 @@
9931
9932
  const context = {
9932
9933
  type: exports.AttributeUpdateType.INIT
9933
9934
  };
9934
- params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = exports.UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
9935
+ params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background && this.loadImage(params.background, !0), isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = exports.UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
9935
9936
  }
9936
9937
  translate(x, y) {
9937
9938
  var _a, _b;
@@ -10325,6 +10326,9 @@
10325
10326
  function backgroundNotImage(image) {
10326
10327
  return !(!image.fill && !image.stroke);
10327
10328
  }
10329
+ function isExternalTexture(texture) {
10330
+ return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$1(texture));
10331
+ }
10328
10332
  Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
10329
10333
 
10330
10334
  exports.GroupUpdateAABBBoundsMode = void 0;
@@ -14286,33 +14290,37 @@
14286
14290
  textureRatio = graphicAttribute.textureRatio,
14287
14291
  textureOptions = null
14288
14292
  } = graphic.attribute;
14289
- let pattern = this.textureMap.get(texture);
14290
- if (!pattern) switch (texture) {
14291
- case "circle":
14292
- pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
14293
- break;
14294
- case "diamond":
14295
- pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
14296
- break;
14297
- case "rect":
14298
- pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
14299
- break;
14300
- case "vertical-line":
14301
- pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
14302
- break;
14303
- case "horizontal-line":
14304
- pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
14305
- break;
14306
- case "bias-lr":
14307
- pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
14308
- break;
14309
- case "bias-rl":
14310
- pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
14311
- break;
14312
- case "grid":
14313
- pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
14293
+ let pattern = null;
14294
+ const patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr);
14295
+ if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
14296
+ if ("string" == typeof texture) switch (texture) {
14297
+ case "circle":
14298
+ pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
14299
+ break;
14300
+ case "diamond":
14301
+ pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
14302
+ break;
14303
+ case "rect":
14304
+ pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
14305
+ break;
14306
+ case "vertical-line":
14307
+ pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
14308
+ break;
14309
+ case "horizontal-line":
14310
+ pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
14311
+ break;
14312
+ case "bias-lr":
14313
+ pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
14314
+ break;
14315
+ case "bias-rl":
14316
+ pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
14317
+ break;
14318
+ case "grid":
14319
+ pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
14320
+ }
14321
+ pattern || (pattern = this.createResourcePattern(texture, graphic, context)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
14314
14322
  }
14315
- if (textureOptions && textureOptions.dynamicTexture) {
14323
+ if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
14316
14324
  const {
14317
14325
  gridConfig = {},
14318
14326
  useNewCanvas: useNewCanvas
@@ -14368,6 +14376,17 @@
14368
14376
  }), x + b.x1 - x, y + b.y1 - y), context.restore();
14369
14377
  }
14370
14378
  }
14379
+ getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr) {
14380
+ return "string" != typeof texture ? texture : "wave" === texture ? null : `${texture}-${textureSize}-${texturePadding}-${textureColor}-${dpr}`;
14381
+ }
14382
+ createResourcePattern(texture, graphic, context) {
14383
+ var _a;
14384
+ const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
14385
+ data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
14386
+ if (!data) return null;
14387
+ const pattern = context.createPattern(data, "repeat");
14388
+ return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
14389
+ }
14371
14390
  }
14372
14391
  const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
14373
14392
 
@@ -53161,7 +53180,7 @@
53161
53180
  select: !0
53162
53181
  };
53163
53182
 
53164
- const version = "1.0.44";
53183
+ const version = "1.0.46-alpha.0";
53165
53184
  preLoadAllModule();
53166
53185
  if (isBrowserEnv()) {
53167
53186
  loadBrowserEnv(container);