@visactor/vrender 1.0.46-alpha.1 → 1.0.46

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.46-alpha.1";
2
+ export declare const version = "1.0.46";
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,17 +21,16 @@ 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.46-alpha.1", (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)(),
24
+ exports.version = "1.0.46", (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)(),
35
34
  (0, vrender_core_1.registerViewTransform3dPlugin)(), (0, vrender_core_1.registerHtmlAttributePlugin)(),
36
35
  (0, vrender_core_1.registerReactAttributePlugin)(), (0, vrender_core_1.registerDirectionalLight)(),
37
36
  (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,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.1\";\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,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.46\";\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
@@ -4685,9 +4685,7 @@ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
4685
4685
  background: null,
4686
4686
  autoAnimateTexture: !1,
4687
4687
  textureRatio: 1,
4688
- textureOptions: {
4689
- alignToGraphic: !0
4690
- },
4688
+ textureOptions: null,
4691
4689
  backgroundOpacity: 1,
4692
4690
  backgroundCornerRadius: 0,
4693
4691
  texture: null,
@@ -9514,7 +9512,7 @@ class Graphic extends Node {
9514
9512
  }
9515
9513
  constructor(params = {}) {
9516
9514
  var _a;
9517
- 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);
9515
+ 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);
9518
9516
  }
9519
9517
  getGraphicService() {
9520
9518
  var _a, _b;
@@ -9703,7 +9701,7 @@ class Graphic extends Node {
9703
9701
  });
9704
9702
  }
9705
9703
  setAttributes(params, forceUpdateTag = !1, context) {
9706
- 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));
9704
+ 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));
9707
9705
  }
9708
9706
  _setAttributes(params, forceUpdateTag = !1, context) {
9709
9707
  const keys = Object.keys(params);
@@ -9737,7 +9735,7 @@ class Graphic extends Node {
9737
9735
  const context = {
9738
9736
  type: AttributeUpdateType.INIT
9739
9737
  };
9740
- 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);
9738
+ 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);
9741
9739
  }
9742
9740
  translate(x, y) {
9743
9741
  var _a, _b;
@@ -14058,6 +14056,7 @@ class DefaultBaseClipRenderAfterContribution {
14058
14056
  }
14059
14057
  const defaultBaseClipRenderAfterContribution = new DefaultBaseClipRenderAfterContribution();
14060
14058
 
14059
+ const builtinProceduralTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid"]);
14061
14060
  function formatRatio(ratio) {
14062
14061
  return ratio <= .5 ? 4 * ratio - 1 : -4 * ratio + 3;
14063
14062
  }
@@ -14171,13 +14170,14 @@ class DefaultBaseTextureRenderContribution {
14171
14170
  texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
14172
14171
  }
14173
14172
  drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
14174
- var _a, _b, _c, _d, _e;
14173
+ var _a, _b, _c, _d, _e, _f;
14175
14174
  const {
14176
14175
  textureRatio = graphicAttribute.textureRatio,
14177
14176
  textureOptions = null
14178
14177
  } = graphic.attribute;
14179
14178
  let pattern = null;
14180
- const patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr);
14179
+ const textureRadius = null !== (_a = null == textureOptions ? void 0 : textureOptions.radius) && void 0 !== _a ? _a : 0,
14180
+ patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr, textureRadius);
14181
14181
  if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
14182
14182
  if ("string" == typeof texture) switch (texture) {
14183
14183
  case "circle":
@@ -14204,7 +14204,7 @@ class DefaultBaseTextureRenderContribution {
14204
14204
  case "grid":
14205
14205
  pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
14206
14206
  }
14207
- pattern || (pattern = this.createResourcePattern(texture, graphic, context)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
14207
+ pattern || (pattern = this.createResourcePattern(texture, graphic, context, texturePadding, textureRadius)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
14208
14208
  }
14209
14209
  if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
14210
14210
  const {
@@ -14251,19 +14251,19 @@ class DefaultBaseTextureRenderContribution {
14251
14251
  for (let i = 0; i < gridRows; i++) for (let j = 0; j < gridColumns; j++) {
14252
14252
  const _x = x + cellSize / 2 + j * cellSize,
14253
14253
  _y = y + cellSize / 2 + i * cellSize;
14254
- null === (_a = textureOptions.beforeDynamicTexture) || void 0 === _a || _a.call(textureOptions, context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height()), context.beginPath(), !1 === parsedPath.draw(context, Math.min(sizeW - gutterColumn, sizeH - gutterRow), _x, _y, 0) && context.closePath(), context.fillStyle = textureColor, textureOptions.dynamicTexture(context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height());
14254
+ null === (_b = textureOptions.beforeDynamicTexture) || void 0 === _b || _b.call(textureOptions, context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height()), context.beginPath(), !1 === parsedPath.draw(context, Math.min(sizeW - gutterColumn, sizeH - gutterRow), _x, _y, 0) && context.closePath(), context.fillStyle = textureColor, textureOptions.dynamicTexture(context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height());
14255
14255
  }
14256
14256
  useNewCanvas && (originalContext.globalAlpha = 1, originalContext.drawImage(newCanvas.nativeCanvas, 0, 0, newCanvas.nativeCanvas.width, newCanvas.nativeCanvas.height, b.x1, b.y1, b.width() * originalContext.dpr, b.height() * originalContext.dpr)), originalContext.restore();
14257
14257
  } else if (pattern) {
14258
14258
  if (pattern.setTransform) {
14259
14259
  const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
14260
- alignOffsetX = null !== (_b = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _b ? _b : 0,
14261
- alignOffsetY = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _c ? _c : 0;
14260
+ alignOffsetX = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _c ? _c : 0,
14261
+ alignOffsetY = null !== (_d = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _d ? _d : 0;
14262
14262
  let translateX = 0,
14263
14263
  translateY = 0;
14264
14264
  if (alignToGraphic) {
14265
14265
  const m = context.currentMatrix;
14266
- translateX = (null !== (_d = null == m ? void 0 : m.e) && void 0 !== _d ? _d : 0) + x + alignOffsetX, translateY = (null !== (_e = null == m ? void 0 : m.f) && void 0 !== _e ? _e : 0) + y + alignOffsetY;
14266
+ translateX = (null !== (_e = null == m ? void 0 : m.e) && void 0 !== _e ? _e : 0) + x + alignOffsetX, translateY = (null !== (_f = null == m ? void 0 : m.f) && void 0 !== _f ? _f : 0) + y + alignOffsetY;
14267
14267
  } else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
14268
14268
  pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
14269
14269
  }
@@ -14276,14 +14276,42 @@ class DefaultBaseTextureRenderContribution {
14276
14276
  }), x + b.x1 - x, y + b.y1 - y), context.restore();
14277
14277
  }
14278
14278
  }
14279
- getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr) {
14280
- return "string" != typeof texture ? texture : "wave" === texture ? null : `${texture}-${textureSize}-${texturePadding}-${textureColor}-${dpr}`;
14279
+ getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr, textureRadius) {
14280
+ return "string" != typeof texture ? texturePadding > 0 || textureRadius > 0 ? null : texture : "wave" === texture ? null : builtinProceduralTextureTypes.has(texture) ? `builtin:${texture}|size:${textureSize}|padding:${texturePadding}|color:${textureColor}|dpr:${dpr}` : `resource:${texture}|padding:${texturePadding}|radius:${textureRadius}|dpr:${dpr}`;
14281
14281
  }
14282
- createResourcePattern(texture, graphic, context) {
14282
+ createResourcePattern(texture, graphic, context, texturePadding, textureRadius) {
14283
14283
  var _a;
14284
14284
  const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
14285
14285
  data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
14286
14286
  if (!data) return null;
14287
+ if (texturePadding > 0 || textureRadius > 0) {
14288
+ const w = data.naturalWidth || data.width,
14289
+ h = data.naturalHeight || data.height;
14290
+ if (w > 0 && h > 0) {
14291
+ const tileW = w + 2 * texturePadding,
14292
+ tileH = h + 2 * texturePadding,
14293
+ canvas = canvasAllocate.allocate({
14294
+ width: tileW,
14295
+ height: tileH,
14296
+ dpr: context.dpr
14297
+ }),
14298
+ ctx = canvas.getContext("2d");
14299
+ if (ctx) {
14300
+ if (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, tileW, tileH), textureRadius > 0) {
14301
+ const r = Math.max(0, Math.min(textureRadius, Math.min(w, h) / 2)),
14302
+ x0 = texturePadding,
14303
+ y0 = texturePadding,
14304
+ x1 = x0 + w,
14305
+ y1 = y0 + h;
14306
+ ctx.beginPath(), ctx.moveTo(x0 + r, y0), ctx.lineTo(x1 - r, y0), ctx.quadraticCurveTo(x1, y0, x1, y0 + r), ctx.lineTo(x1, y1 - r), ctx.quadraticCurveTo(x1, y1, x1 - r, y1), ctx.lineTo(x0 + r, y1), ctx.quadraticCurveTo(x0, y1, x0, y1 - r), ctx.lineTo(x0, y0 + r), ctx.quadraticCurveTo(x0, y0, x0 + r, y0), ctx.closePath(), ctx.clip();
14307
+ }
14308
+ ctx.drawImage(data, texturePadding, texturePadding, w, h);
14309
+ const pattern = context.createPattern(canvas.nativeCanvas, "repeat");
14310
+ return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), canvasAllocate.free(canvas), pattern;
14311
+ }
14312
+ canvasAllocate.free(canvas);
14313
+ }
14314
+ }
14287
14315
  const pattern = context.createPattern(data, "repeat");
14288
14316
  return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
14289
14317
  }
@@ -52963,7 +52991,7 @@ TableSeriesNumber.defaultAttributes = {
52963
52991
  select: !0
52964
52992
  };
52965
52993
 
52966
- const version = "1.0.46-alpha.1";
52994
+ const version = "1.0.46";
52967
52995
  preLoadAllModule();
52968
52996
  if (isBrowserEnv()) {
52969
52997
  loadBrowserEnv(container);
package/dist/index.js CHANGED
@@ -4691,9 +4691,7 @@
4691
4691
  background: null,
4692
4692
  autoAnimateTexture: !1,
4693
4693
  textureRatio: 1,
4694
- textureOptions: {
4695
- alignToGraphic: !0
4696
- },
4694
+ textureOptions: null,
4697
4695
  backgroundOpacity: 1,
4698
4696
  backgroundCornerRadius: 0,
4699
4697
  texture: null,
@@ -9520,7 +9518,7 @@
9520
9518
  }
9521
9519
  constructor(params = {}) {
9522
9520
  var _a;
9523
- 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);
9521
+ 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);
9524
9522
  }
9525
9523
  getGraphicService() {
9526
9524
  var _a, _b;
@@ -9709,7 +9707,7 @@
9709
9707
  });
9710
9708
  }
9711
9709
  setAttributes(params, forceUpdateTag = !1, context) {
9712
- 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));
9710
+ 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));
9713
9711
  }
9714
9712
  _setAttributes(params, forceUpdateTag = !1, context) {
9715
9713
  const keys = Object.keys(params);
@@ -9743,7 +9741,7 @@
9743
9741
  const context = {
9744
9742
  type: exports.AttributeUpdateType.INIT
9745
9743
  };
9746
- 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);
9744
+ 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);
9747
9745
  }
9748
9746
  translate(x, y) {
9749
9747
  var _a, _b;
@@ -14064,6 +14062,7 @@
14064
14062
  }
14065
14063
  const defaultBaseClipRenderAfterContribution = new DefaultBaseClipRenderAfterContribution();
14066
14064
 
14065
+ const builtinProceduralTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid"]);
14067
14066
  function formatRatio(ratio) {
14068
14067
  return ratio <= .5 ? 4 * ratio - 1 : -4 * ratio + 3;
14069
14068
  }
@@ -14177,13 +14176,14 @@
14177
14176
  texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
14178
14177
  }
14179
14178
  drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
14180
- var _a, _b, _c, _d, _e;
14179
+ var _a, _b, _c, _d, _e, _f;
14181
14180
  const {
14182
14181
  textureRatio = graphicAttribute.textureRatio,
14183
14182
  textureOptions = null
14184
14183
  } = graphic.attribute;
14185
14184
  let pattern = null;
14186
- const patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr);
14185
+ const textureRadius = null !== (_a = null == textureOptions ? void 0 : textureOptions.radius) && void 0 !== _a ? _a : 0,
14186
+ patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr, textureRadius);
14187
14187
  if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
14188
14188
  if ("string" == typeof texture) switch (texture) {
14189
14189
  case "circle":
@@ -14210,7 +14210,7 @@
14210
14210
  case "grid":
14211
14211
  pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
14212
14212
  }
14213
- pattern || (pattern = this.createResourcePattern(texture, graphic, context)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
14213
+ pattern || (pattern = this.createResourcePattern(texture, graphic, context, texturePadding, textureRadius)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
14214
14214
  }
14215
14215
  if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
14216
14216
  const {
@@ -14257,19 +14257,19 @@
14257
14257
  for (let i = 0; i < gridRows; i++) for (let j = 0; j < gridColumns; j++) {
14258
14258
  const _x = x + cellSize / 2 + j * cellSize,
14259
14259
  _y = y + cellSize / 2 + i * cellSize;
14260
- null === (_a = textureOptions.beforeDynamicTexture) || void 0 === _a || _a.call(textureOptions, context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height()), context.beginPath(), !1 === parsedPath.draw(context, Math.min(sizeW - gutterColumn, sizeH - gutterRow), _x, _y, 0) && context.closePath(), context.fillStyle = textureColor, textureOptions.dynamicTexture(context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height());
14260
+ null === (_b = textureOptions.beforeDynamicTexture) || void 0 === _b || _b.call(textureOptions, context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height()), context.beginPath(), !1 === parsedPath.draw(context, Math.min(sizeW - gutterColumn, sizeH - gutterRow), _x, _y, 0) && context.closePath(), context.fillStyle = textureColor, textureOptions.dynamicTexture(context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height());
14261
14261
  }
14262
14262
  useNewCanvas && (originalContext.globalAlpha = 1, originalContext.drawImage(newCanvas.nativeCanvas, 0, 0, newCanvas.nativeCanvas.width, newCanvas.nativeCanvas.height, b.x1, b.y1, b.width() * originalContext.dpr, b.height() * originalContext.dpr)), originalContext.restore();
14263
14263
  } else if (pattern) {
14264
14264
  if (pattern.setTransform) {
14265
14265
  const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
14266
- alignOffsetX = null !== (_b = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _b ? _b : 0,
14267
- alignOffsetY = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _c ? _c : 0;
14266
+ alignOffsetX = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _c ? _c : 0,
14267
+ alignOffsetY = null !== (_d = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _d ? _d : 0;
14268
14268
  let translateX = 0,
14269
14269
  translateY = 0;
14270
14270
  if (alignToGraphic) {
14271
14271
  const m = context.currentMatrix;
14272
- translateX = (null !== (_d = null == m ? void 0 : m.e) && void 0 !== _d ? _d : 0) + x + alignOffsetX, translateY = (null !== (_e = null == m ? void 0 : m.f) && void 0 !== _e ? _e : 0) + y + alignOffsetY;
14272
+ translateX = (null !== (_e = null == m ? void 0 : m.e) && void 0 !== _e ? _e : 0) + x + alignOffsetX, translateY = (null !== (_f = null == m ? void 0 : m.f) && void 0 !== _f ? _f : 0) + y + alignOffsetY;
14273
14273
  } else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
14274
14274
  pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
14275
14275
  }
@@ -14282,14 +14282,42 @@
14282
14282
  }), x + b.x1 - x, y + b.y1 - y), context.restore();
14283
14283
  }
14284
14284
  }
14285
- getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr) {
14286
- return "string" != typeof texture ? texture : "wave" === texture ? null : `${texture}-${textureSize}-${texturePadding}-${textureColor}-${dpr}`;
14285
+ getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr, textureRadius) {
14286
+ return "string" != typeof texture ? texturePadding > 0 || textureRadius > 0 ? null : texture : "wave" === texture ? null : builtinProceduralTextureTypes.has(texture) ? `builtin:${texture}|size:${textureSize}|padding:${texturePadding}|color:${textureColor}|dpr:${dpr}` : `resource:${texture}|padding:${texturePadding}|radius:${textureRadius}|dpr:${dpr}`;
14287
14287
  }
14288
- createResourcePattern(texture, graphic, context) {
14288
+ createResourcePattern(texture, graphic, context, texturePadding, textureRadius) {
14289
14289
  var _a;
14290
14290
  const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
14291
14291
  data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
14292
14292
  if (!data) return null;
14293
+ if (texturePadding > 0 || textureRadius > 0) {
14294
+ const w = data.naturalWidth || data.width,
14295
+ h = data.naturalHeight || data.height;
14296
+ if (w > 0 && h > 0) {
14297
+ const tileW = w + 2 * texturePadding,
14298
+ tileH = h + 2 * texturePadding,
14299
+ canvas = canvasAllocate.allocate({
14300
+ width: tileW,
14301
+ height: tileH,
14302
+ dpr: context.dpr
14303
+ }),
14304
+ ctx = canvas.getContext("2d");
14305
+ if (ctx) {
14306
+ if (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, tileW, tileH), textureRadius > 0) {
14307
+ const r = Math.max(0, Math.min(textureRadius, Math.min(w, h) / 2)),
14308
+ x0 = texturePadding,
14309
+ y0 = texturePadding,
14310
+ x1 = x0 + w,
14311
+ y1 = y0 + h;
14312
+ ctx.beginPath(), ctx.moveTo(x0 + r, y0), ctx.lineTo(x1 - r, y0), ctx.quadraticCurveTo(x1, y0, x1, y0 + r), ctx.lineTo(x1, y1 - r), ctx.quadraticCurveTo(x1, y1, x1 - r, y1), ctx.lineTo(x0 + r, y1), ctx.quadraticCurveTo(x0, y1, x0, y1 - r), ctx.lineTo(x0, y0 + r), ctx.quadraticCurveTo(x0, y0, x0 + r, y0), ctx.closePath(), ctx.clip();
14313
+ }
14314
+ ctx.drawImage(data, texturePadding, texturePadding, w, h);
14315
+ const pattern = context.createPattern(canvas.nativeCanvas, "repeat");
14316
+ return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), canvasAllocate.free(canvas), pattern;
14317
+ }
14318
+ canvasAllocate.free(canvas);
14319
+ }
14320
+ }
14293
14321
  const pattern = context.createPattern(data, "repeat");
14294
14322
  return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
14295
14323
  }
@@ -52969,7 +52997,7 @@
52969
52997
  select: !0
52970
52998
  };
52971
52999
 
52972
- const version = "1.0.46-alpha.1";
53000
+ const version = "1.0.46";
52973
53001
  preLoadAllModule();
52974
53002
  if (isBrowserEnv()) {
52975
53003
  loadBrowserEnv(container);