@visactor/vrender 0.17.11-alpha.3 → 0.17.12-alpha.1

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,4 +1,4 @@
1
1
  import '@visactor/vrender-core';
2
- export declare const version = "0.17.11-alpha.3";
2
+ export declare const version = "0.17.12-alpha.1";
3
3
  export * from '@visactor/vrender-core';
4
4
  export * from '@visactor/vrender-kits';
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.17.11-alpha.3", (0, vrender_core_1.preLoadAllModule)(), (0,
24
+ exports.version = "0.17.12-alpha.1", (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,yDAA8F;AAC9F,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,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,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport { container, isBrowserEnv, isNodeEnv, preLoadAllModule } 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.17.11-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();\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA8F;AAC9F,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,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,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport { container, isBrowserEnv, isNodeEnv, preLoadAllModule } 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.17.12-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();\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
package/dist/index.js CHANGED
@@ -5163,6 +5163,7 @@
5163
5163
  textureSize: 10,
5164
5164
  texturePadding: 2,
5165
5165
  backgroundMode: "no-repeat",
5166
+ backgroundFit: !0,
5166
5167
  blur: 0,
5167
5168
  cursor: null,
5168
5169
  html: null
@@ -13788,10 +13789,12 @@
13788
13789
  get: function get() {
13789
13790
  var textTheme = getTheme(this).text,
13790
13791
  attribute = this.attribute;
13791
- if (!this.isSimplify()) return;
13792
+ if (this.isMultiLine) return;
13792
13793
  var _attribute$maxLineWid2 = attribute.maxLineWidth,
13793
13794
  maxLineWidth = _attribute$maxLineWid2 === void 0 ? textTheme.maxLineWidth : _attribute$maxLineWid2;
13794
- return !!Number.isFinite(maxLineWidth) && (this.tryUpdateAABBBounds(), null != this.clipedText && this.clipedText !== attribute.text.toString());
13795
+ return !!Number.isFinite(maxLineWidth) && (this.tryUpdateAABBBounds(), "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(function (item) {
13796
+ return item.text;
13797
+ }).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString());
13795
13798
  }
13796
13799
  }, {
13797
13800
  key: "multilineLayout",
@@ -18452,7 +18455,9 @@
18452
18455
  var _graphic$attribute = graphic.attribute,
18453
18456
  background = _graphic$attribute.background,
18454
18457
  _graphic$attribute$ba = _graphic$attribute.backgroundMode,
18455
- backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba;
18458
+ backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba,
18459
+ _graphic$attribute$ba2 = _graphic$attribute.backgroundFit,
18460
+ backgroundFit = _graphic$attribute$ba2 === void 0 ? graphicAttribute.backgroundFit : _graphic$attribute$ba2;
18456
18461
  if (background) if (graphic.backgroundImg && graphic.resources) {
18457
18462
  var res = graphic.resources.get(background);
18458
18463
  if ("success" !== res.state || !res.data) return;
@@ -18467,15 +18472,35 @@
18467
18472
  }
18468
18473
  context.clip();
18469
18474
  var b = graphic.AABBBounds;
18470
- context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, backgroundMode), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
18475
+ context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
18471
18476
  } else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
18472
18477
  }
18473
18478
  }, {
18474
18479
  key: "doDrawImage",
18475
- value: function doDrawImage(context, data, b, backgroundMode) {
18480
+ value: function doDrawImage(context, data, b, backgroundMode, backgroundFit) {
18476
18481
  if ("no-repeat" === backgroundMode) context.drawImage(data, b.x1, b.y1, b.width(), b.height());else {
18482
+ var targetW = b.width(),
18483
+ targetH = b.height();
18484
+ var w = targetW,
18485
+ h = targetH;
18486
+ if (backgroundFit && "repeat" !== backgroundMode && (data.width || data.height)) {
18487
+ var resW = data.width,
18488
+ resH = data.height;
18489
+ if ("repeat-x" === backgroundMode) {
18490
+ w = resW * (targetH / resH);
18491
+ } else if ("repeat-y" === backgroundMode) {
18492
+ h = resH * (targetW / resW);
18493
+ }
18494
+ var canvas = canvasAllocate.allocate({
18495
+ width: w,
18496
+ height: h,
18497
+ dpr: context.dpr
18498
+ }),
18499
+ ctx = canvas.getContext("2d");
18500
+ ctx && (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, w, h), ctx.drawImage(data, 0, 0, w, h), data = canvas.nativeCanvas), document.body.appendChild(data), canvasAllocate.free(canvas);
18501
+ }
18477
18502
  var pattern = context.createPattern(data, backgroundMode);
18478
- context.fillStyle = pattern, context.translate(b.x1, b.y1), context.fillRect(0, 0, b.width(), b.height()), context.translate(-b.x1, -b.y1);
18503
+ context.fillStyle = pattern, context.translate(b.x1, b.y1), context.fillRect(0, 0, targetW, targetH), context.translate(-b.x1, -b.y1);
18479
18504
  }
18480
18505
  }
18481
18506
  }]);
@@ -18799,13 +18824,15 @@
18799
18824
  var _graphic$attribute = graphic.attribute,
18800
18825
  background = _graphic$attribute.background,
18801
18826
  _graphic$attribute$ba = _graphic$attribute.backgroundMode,
18802
- backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba;
18827
+ backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba,
18828
+ _graphic$attribute$ba2 = _graphic$attribute.backgroundFit,
18829
+ backgroundFit = _graphic$attribute$ba2 === void 0 ? graphicAttribute.backgroundFit : _graphic$attribute$ba2;
18803
18830
  if (background) if (graphic.backgroundImg && graphic.resources) {
18804
18831
  var res = graphic.resources.get(background);
18805
18832
  if ("success" !== res.state || !res.data) return;
18806
18833
  context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
18807
18834
  var b = graphic.AABBBounds;
18808
- this.doDrawImage(context, res.data, b, backgroundMode), context.highPerformanceRestore(), context.setTransformForCurrent();
18835
+ this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit), context.highPerformanceRestore(), context.setTransformForCurrent();
18809
18836
  } else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
18810
18837
  }
18811
18838
  }]);
@@ -18887,7 +18914,9 @@
18887
18914
  var _graphic$attribute = graphic.attribute,
18888
18915
  background = _graphic$attribute.background,
18889
18916
  _graphic$attribute$ba = _graphic$attribute.backgroundMode,
18890
- backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba;
18917
+ backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba,
18918
+ _graphic$attribute$ba2 = _graphic$attribute.backgroundFit,
18919
+ backgroundFit = _graphic$attribute$ba2 === void 0 ? graphicAttribute.backgroundFit : _graphic$attribute$ba2;
18891
18920
  if (background) if (graphic.backgroundImg) {
18892
18921
  var res = graphic.resources.get(background);
18893
18922
  if ("success" !== res.state || !res.data) return;
@@ -18901,7 +18930,7 @@
18901
18930
  context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.translate(scrollX, scrollY);
18902
18931
  }
18903
18932
  var b = graphic.AABBBounds;
18904
- this.doDrawImage(context, res.data, b, backgroundMode), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
18933
+ this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
18905
18934
  } else if (isObject$1(background)) {
18906
18935
  var stroke = background.stroke,
18907
18936
  fill = background.fill,
@@ -20377,13 +20406,15 @@
20377
20406
  var _graphic$attribute = graphic.attribute,
20378
20407
  background = _graphic$attribute.background,
20379
20408
  _graphic$attribute$ba = _graphic$attribute.backgroundMode,
20380
- backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba;
20409
+ backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba,
20410
+ _graphic$attribute$ba2 = _graphic$attribute.backgroundFit,
20411
+ backgroundFit = _graphic$attribute$ba2 === void 0 ? graphicAttribute.backgroundFit : _graphic$attribute$ba2;
20381
20412
  if (!background) return;
20382
20413
  var b = graphic.AABBBounds;
20383
20414
  if (graphic.backgroundImg && graphic.resources) {
20384
20415
  var res = graphic.resources.get(background);
20385
20416
  if ("success" !== res.state || !res.data) return;
20386
- context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), this.doDrawImage(context, res.data, b, backgroundMode), context.highPerformanceRestore(), context.setTransformForCurrent();
20417
+ context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit), context.highPerformanceRestore(), context.setTransformForCurrent();
20387
20418
  } else context.highPerformanceSave(), context.fillStyle = background, context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
20388
20419
  }
20389
20420
  }]);
@@ -22904,10 +22935,10 @@
22904
22935
  var left = 0,
22905
22936
  top = 0;
22906
22937
  if ("position" === anchorType) {
22907
- var matrix = graphic.transMatrix;
22938
+ var matrix = graphic.globalTransMatrix;
22908
22939
  left = matrix.e, top = matrix.f;
22909
22940
  } else {
22910
- var b = graphic.AABBBounds;
22941
+ var b = graphic.globalAABBBounds;
22911
22942
  left = b.x1, top = b.y1;
22912
22943
  }
22913
22944
  var containerTL = application.global.getElementTopLeft(nativeContainer, !1),
@@ -34450,7 +34481,7 @@
34450
34481
 
34451
34482
  var roughModule = _roughModule;
34452
34483
 
34453
- const version = "0.17.11-alpha.3";
34484
+ const version = "0.17.12-alpha.1";
34454
34485
  preLoadAllModule();
34455
34486
  if (isBrowserEnv()) {
34456
34487
  loadBrowserEnv(container);