@visactor/vrender 0.12.0 → 0.12.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.
Files changed (36) hide show
  1. package/cjs/canvas/contributions/browser/context.d.ts +4 -2
  2. package/cjs/canvas/contributions/browser/context.js +3 -2
  3. package/cjs/canvas/contributions/browser/context.js.map +1 -1
  4. package/cjs/common/text.js +2 -1
  5. package/cjs/common/text.js.map +1 -1
  6. package/cjs/graphic/config.js +2 -1
  7. package/cjs/graphic/config.js.map +1 -1
  8. package/cjs/index.d.ts +1 -1
  9. package/cjs/index.js +1 -1
  10. package/cjs/index.js.map +1 -1
  11. package/cjs/interface/context.d.ts +1 -0
  12. package/cjs/interface/context.js.map +1 -1
  13. package/cjs/interface/graphic/text.d.ts +1 -0
  14. package/cjs/interface/graphic/text.js.map +1 -1
  15. package/cjs/plugins/builtin-plugin/3dview-transform-plugin.js +4 -2
  16. package/cjs/plugins/builtin-plugin/3dview-transform-plugin.js.map +1 -1
  17. package/dist/index.js +10 -6
  18. package/dist/index.min.js +1 -1
  19. package/es/canvas/contributions/browser/context.d.ts +4 -2
  20. package/es/canvas/contributions/browser/context.js +3 -1
  21. package/es/canvas/contributions/browser/context.js.map +1 -1
  22. package/es/common/text.js +2 -1
  23. package/es/common/text.js.map +1 -1
  24. package/es/graphic/config.js +2 -1
  25. package/es/graphic/config.js.map +1 -1
  26. package/es/index.d.ts +1 -1
  27. package/es/index.js +1 -1
  28. package/es/index.js.map +1 -1
  29. package/es/interface/context.d.ts +1 -0
  30. package/es/interface/context.js.map +1 -1
  31. package/es/interface/graphic/text.d.ts +1 -0
  32. package/es/interface/graphic/text.js.map +1 -1
  33. package/es/plugins/builtin-plugin/3dview-transform-plugin.js +4 -2
  34. package/es/plugins/builtin-plugin/3dview-transform-plugin.js.map +1 -1
  35. package/es/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +1 -1
@@ -15,13 +15,15 @@ class ViewTransform3dPlugin {
15
15
  }, this.onMouseUp = e => {
16
16
  this.option3d || (this.option3d = this.pluginService.stage.option3d), this.option3d && (this.mousedown = !1);
17
17
  }, this.onMouseMove = e => {
18
+ var _a, _b;
18
19
  const stage = this.pluginService.stage;
19
20
  if (this.option3d || (this.option3d = stage.option3d), this.option3d && this.mousedown) if (this.pageX && this.pageY) {
20
21
  const deltaX = e.page.x - this.pageX, deltaY = e.page.y - this.pageY;
21
22
  this.pageX = e.page.x, this.pageY = e.page.y;
22
23
  const angle1 = deltaX / 100, angle2 = deltaY / 100;
23
- this.option3d.alpha += angle1, this.option3d.beta += angle2, stage.set3dOptions(this.option3d),
24
- stage.renderNextFrame();
24
+ this.option3d.alpha = (null !== (_a = this.option3d.alpha) && void 0 !== _a ? _a : 0) + angle1,
25
+ this.option3d.beta = (null !== (_b = this.option3d.beta) && void 0 !== _b ? _b : 0) + angle2,
26
+ stage.set3dOptions(this.option3d), stage.renderNextFrame();
25
27
  } else this.pageX = e.page.x, this.pageY = e.page.y;
26
28
  };
27
29
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/plugins/builtin-plugin/3dview-transform-plugin.ts"],"names":[],"mappings":";;;AACA,sDAAmD;AAEnD,MAAa,qBAAqB;IAAlC;QACE,SAAI,GAA4B,uBAAuB,CAAC;QACxD,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,qBAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAMpC,gBAAW,GAAG,CAAC,CAAmB,EAAE,EAAE;YACpC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC;aACnD;YACD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAClB,OAAO;aACR;YACD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IA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CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBAEtB,MAAM,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;oBAC5B,MAAM,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;oBAC5B,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,MAAM,CAAC;oBAC9B,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,MAAM,CAAC;oBAC7B,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBAClC,KAAK,CAAC,eAAe,EAAE,CAAC;iBACzB;aACF;QACH,CAAC,CAAC;IAgBJ,CAAC;IAdC,QAAQ,CAAC,OAAuB;QAC9B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,KAAK,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACtD,KAAK,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAClD,KAAK,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACxD,CAAC;IACD,UAAU,CAAC,OAAuB;QAChC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5B,KAAK,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACzD,KAAK,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACrD,KAAK,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3D,CAAC;CACF;AAzED,sDAyEC","file":"3dview-transform-plugin.js","sourcesContent":["import type { IOption3D, IPlugin, IPluginService } from '../../interface';\nimport { Generator } from '../../common/generator';\n\nexport class ViewTransform3dPlugin implements IPlugin {\n name: 'ViewTransform3dPlugin' = 'ViewTransform3dPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n mousedown?: boolean;\n pageX?: number;\n pageY?: number;\n option3d?: IOption3D;\n\n onMouseDown = (e: MouseEvent | any) => {\n if (!this.option3d) {\n this.option3d = this.pluginService.stage.option3d;\n }\n if (!this.option3d) {\n return;\n }\n this.mousedown = true;\n this.pageX = e.page.x;\n this.pageY = e.page.y;\n };\n onMouseUp = (e: MouseEvent | any) => {\n if (!this.option3d) {\n this.option3d = this.pluginService.stage.option3d;\n }\n if (!this.option3d) {\n return;\n }\n this.mousedown = false;\n };\n onMouseMove = (e: MouseEvent | any) => {\n const stage = this.pluginService.stage;\n if (!this.option3d) {\n this.option3d = stage.option3d;\n }\n if (!this.option3d) {\n return;\n }\n if (this.mousedown) {\n if (!this.pageX || !this.pageY) {\n this.pageX = e.page.x;\n this.pageY = e.page.y;\n } else {\n const deltaX = e.page.x - this.pageX;\n const deltaY = e.page.y - this.pageY;\n this.pageX = e.page.x;\n this.pageY = e.page.y;\n\n const angle1 = deltaX / 100;\n const angle2 = deltaY / 100;\n this.option3d.alpha += angle1;\n this.option3d.beta += angle2;\n stage.set3dOptions(this.option3d);\n stage.renderNextFrame();\n }\n }\n };\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n const stage = context.stage;\n this.option3d = stage.option3d;\n stage.addEventListener('mousedown', this.onMouseDown);\n stage.addEventListener('mouseup', this.onMouseUp);\n stage.addEventListener('mousemove', this.onMouseMove);\n }\n deactivate(context: IPluginService): void {\n const stage = context.stage;\n stage.removeEventListener('mousedown', this.onMouseDown);\n stage.removeEventListener('mouseup', this.onMouseUp);\n stage.removeEventListener('mousemove', this.onMouseMove);\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/plugins/builtin-plugin/3dview-transform-plugin.ts"],"names":[],"mappings":";;;A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AAK,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACtD,KAAK,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAClD,KAAK,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACxD,CAAC;IACD,UAAU,CAAC,OAAuB;QAChC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5B,KAAK,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACzD,KAAK,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACrD,KAAK,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3D,CAAC;CACF;AAzED,sDAyEC","file":"3dview-transform-plugin.js","sourcesContent":["import type { IOption3D, IPlugin, IPluginService } from '../../interface';\nimport { Generator } from '../../common/generator';\n\nexport class ViewTransform3dPlugin implements IPlugin {\n name: 'ViewTransform3dPlugin' = 'ViewTransform3dPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n mousedown?: boolean;\n pageX?: number;\n pageY?: number;\n option3d?: IOption3D;\n\n onMouseDown = (e: MouseEvent | any) => {\n if (!this.option3d) {\n this.option3d = this.pluginService.stage.option3d;\n }\n if (!this.option3d) {\n return;\n }\n this.mousedown = true;\n this.pageX = e.page.x;\n this.pageY = e.page.y;\n };\n onMouseUp = (e: MouseEvent | any) => {\n if (!this.option3d) {\n this.option3d = this.pluginService.stage.option3d;\n }\n if (!this.option3d) {\n return;\n }\n this.mousedown = false;\n };\n onMouseMove = (e: MouseEvent | any) => {\n const stage = this.pluginService.stage;\n if (!this.option3d) {\n this.option3d = stage.option3d;\n }\n if (!this.option3d) {\n return;\n }\n if (this.mousedown) {\n if (!this.pageX || !this.pageY) {\n this.pageX = e.page.x;\n this.pageY = e.page.y;\n } else {\n const deltaX = e.page.x - this.pageX;\n const deltaY = e.page.y - this.pageY;\n this.pageX = e.page.x;\n this.pageY = e.page.y;\n\n const angle1 = deltaX / 100;\n const angle2 = deltaY / 100;\n this.option3d.alpha = (this.option3d.alpha ?? 0) + angle1;\n this.option3d.beta = (this.option3d.beta ?? 0) + angle2;\n stage.set3dOptions(this.option3d);\n stage.renderNextFrame();\n }\n }\n };\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n const stage = context.stage;\n this.option3d = stage.option3d;\n stage.addEventListener('mousedown', this.onMouseDown);\n stage.addEventListener('mouseup', this.onMouseUp);\n stage.addEventListener('mousemove', this.onMouseMove);\n }\n deactivate(context: IPluginService): void {\n const stage = context.stage;\n stage.removeEventListener('mousedown', this.onMouseDown);\n stage.removeEventListener('mouseup', this.onMouseUp);\n stage.removeEventListener('mousemove', this.onMouseMove);\n }\n}\n"]}
package/dist/index.js CHANGED
@@ -7552,7 +7552,8 @@
7552
7552
  fontStyle: '',
7553
7553
  lineHeight: undefined,
7554
7554
  underline: 0,
7555
- lineThrough: 0
7555
+ lineThrough: 0,
7556
+ scaleIn3d: false
7556
7557
  };
7557
7558
  const DefaultStyle = {
7558
7559
  opacity: 1,
@@ -17383,7 +17384,9 @@
17383
17384
  }
17384
17385
 
17385
17386
  function getContextFont(text, defaultAttr = {}, fontSizeScale) {
17386
- fontSizeScale = 1;
17387
+ if (!fontSizeScale) {
17388
+ fontSizeScale = 1;
17389
+ }
17387
17390
  const { fontStyle = defaultAttr.fontStyle, fontVariant = defaultAttr.fontVariant, fontWeight = defaultAttr.fontWeight, fontSize = defaultAttr.fontSize, fontFamily = defaultAttr.fontFamily } = text;
17388
17391
  return ('' +
17389
17392
  (fontStyle ? fontStyle + ' ' : '') +
@@ -26396,11 +26399,12 @@
26396
26399
  if (!defaultParams) {
26397
26400
  defaultParams = this.textAttributes;
26398
26401
  }
26402
+ const { scaleIn3d = defaultParams.scaleIn3d } = params;
26399
26403
  if (params.font) {
26400
26404
  _context.font = params.font;
26401
26405
  }
26402
26406
  else {
26403
- _context.font = getContextFont(params, defaultParams, this.camera && this.camera.getProjectionScale(z));
26407
+ _context.font = getContextFont(params, defaultParams, scaleIn3d && this.camera && this.camera.getProjectionScale(z));
26404
26408
  }
26405
26409
  const { fontFamily = defaultParams.fontFamily, fontSize = defaultParams.fontSize } = params;
26406
26410
  this.fontFamily = fontFamily;
@@ -32974,8 +32978,8 @@
32974
32978
  this.pageY = e.page.y;
32975
32979
  const angle1 = deltaX / 100;
32976
32980
  const angle2 = deltaY / 100;
32977
- this.option3d.alpha += angle1;
32978
- this.option3d.beta += angle2;
32981
+ this.option3d.alpha = (this.option3d.alpha ?? 0) + angle1;
32982
+ this.option3d.beta = (this.option3d.beta ?? 0) + angle2;
32979
32983
  stage.set3dOptions(this.option3d);
32980
32984
  stage.renderNextFrame();
32981
32985
  }
@@ -33739,7 +33743,7 @@
33739
33743
  'rect'
33740
33744
  ];
33741
33745
 
33742
- const version = "0.12.0";
33746
+ const version = "0.12.1";
33743
33747
 
33744
33748
  exports.ACustomAnimate = ACustomAnimate;
33745
33749
  exports.ARC3D_NUMBER_TYPE = ARC3D_NUMBER_TYPE;