@visactor/vrender-core 0.17.4-alpha.0 → 0.17.5-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.
Files changed (77) hide show
  1. package/cjs/animate/custom-animate.d.ts +1 -0
  2. package/cjs/animate/custom-animate.js +2 -2
  3. package/cjs/animate/custom-animate.js.map +1 -1
  4. package/cjs/color-string/colorName.js +1 -1
  5. package/cjs/color-string/index.js +1 -1
  6. package/cjs/color-string/interpolate.js +1 -1
  7. package/cjs/color-string/store.js +1 -1
  8. package/cjs/common/Reflect-metadata.js +1 -2
  9. package/cjs/common/contribution-provider.js +2 -1
  10. package/cjs/common/sort.js +1 -2
  11. package/cjs/common/utils.js +2 -1
  12. package/cjs/core/core-modules.js +1 -1
  13. package/cjs/core/global-module.js +2 -0
  14. package/cjs/core/global.js +1 -1
  15. package/cjs/core/graphic-utils.js +1 -1
  16. package/cjs/core/stage.js +1 -1
  17. package/cjs/core/stage.js.map +1 -1
  18. package/cjs/event/event-manager.d.ts +1 -0
  19. package/cjs/event/event-manager.js +5 -6
  20. package/cjs/event/event-manager.js.map +1 -1
  21. package/cjs/event/event-system.d.ts +2 -2
  22. package/cjs/event/event-system.js +7 -5
  23. package/cjs/event/event-system.js.map +1 -1
  24. package/cjs/graphic/config.js +1 -0
  25. package/cjs/graphic/config.js.map +1 -1
  26. package/cjs/graphic/text.js +8 -4
  27. package/cjs/graphic/text.js.map +1 -1
  28. package/cjs/graphic/wrap-text.d.ts +1 -0
  29. package/cjs/graphic/wrap-text.js +5 -0
  30. package/cjs/graphic/wrap-text.js.map +1 -1
  31. package/cjs/interface/graphic/text.d.ts +3 -2
  32. package/cjs/interface/graphic/text.js.map +1 -1
  33. package/cjs/plugins/builtin-plugin/flex-layout-plugin.d.ts +1 -0
  34. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +13 -5
  35. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  36. package/cjs/render/contributions/render/symbol-render.js +2 -2
  37. package/cjs/render/contributions/render/symbol-render.js.map +1 -1
  38. package/dist/index.js +60 -11
  39. package/dist/index.min.js +1 -1
  40. package/es/animate/custom-animate.d.ts +1 -0
  41. package/es/animate/custom-animate.js +2 -2
  42. package/es/animate/custom-animate.js.map +1 -1
  43. package/es/color-string/colorName.js +1 -1
  44. package/es/color-string/index.js +1 -1
  45. package/es/color-string/interpolate.js +1 -1
  46. package/es/color-string/store.js +1 -1
  47. package/es/common/Reflect-metadata.js +1 -2
  48. package/es/common/contribution-provider.js +2 -1
  49. package/es/common/sort.js +1 -2
  50. package/es/common/utils.js +2 -1
  51. package/es/core/core-modules.js +1 -1
  52. package/es/core/global-module.js +2 -0
  53. package/es/core/global.js +1 -1
  54. package/es/core/graphic-utils.js +1 -1
  55. package/es/core/stage.js +1 -1
  56. package/es/core/stage.js.map +1 -1
  57. package/es/event/event-manager.d.ts +1 -0
  58. package/es/event/event-manager.js +6 -6
  59. package/es/event/event-manager.js.map +1 -1
  60. package/es/event/event-system.d.ts +2 -2
  61. package/es/event/event-system.js +7 -5
  62. package/es/event/event-system.js.map +1 -1
  63. package/es/graphic/config.js +1 -0
  64. package/es/graphic/config.js.map +1 -1
  65. package/es/graphic/text.js +8 -4
  66. package/es/graphic/text.js.map +1 -1
  67. package/es/graphic/wrap-text.d.ts +1 -0
  68. package/es/graphic/wrap-text.js +5 -0
  69. package/es/graphic/wrap-text.js.map +1 -1
  70. package/es/interface/graphic/text.d.ts +3 -2
  71. package/es/interface/graphic/text.js.map +1 -1
  72. package/es/plugins/builtin-plugin/flex-layout-plugin.d.ts +1 -0
  73. package/es/plugins/builtin-plugin/flex-layout-plugin.js +13 -5
  74. package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  75. package/es/render/contributions/render/symbol-render.js +3 -1
  76. package/es/render/contributions/render/symbol-render.js.map +1 -1
  77. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -3154,6 +3154,7 @@
3154
3154
  wordBreak: 'break-all',
3155
3155
  ignoreBuf: false,
3156
3156
  verticalMode: 0,
3157
+ wrap: false,
3157
3158
  whiteSpace: 'no-wrap',
3158
3159
  heightLimit: Infinity,
3159
3160
  lineClamp: Infinity,
@@ -5597,6 +5598,7 @@
5597
5598
  class EventManager {
5598
5599
  constructor(root, config) {
5599
5600
  this.dispatch = new vutils.EventEmitter();
5601
+ this.cursorTarget = null;
5600
5602
  this.mappingState = {
5601
5603
  trackingData: {}
5602
5604
  };
@@ -5688,6 +5690,7 @@
5688
5690
  }
5689
5691
  if (isMouse) {
5690
5692
  this[propagationMethod](e, 'mousemove');
5693
+ this.cursorTarget = e.target;
5691
5694
  this.cursor = ((_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a.attribute) === null || _b === void 0 ? void 0 : _b.cursor) || this.rootTarget.getCursor();
5692
5695
  }
5693
5696
  trackingData.overTargets = e.composedPath();
@@ -5707,6 +5710,7 @@
5707
5710
  this.dispatchEvent(e, 'mouseover');
5708
5711
  }
5709
5712
  if (e.pointerType === 'mouse') {
5713
+ this.cursorTarget = e.target;
5710
5714
  this.cursor = ((_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a.attribute) === null || _b === void 0 ? void 0 : _b.cursor) || this.rootTarget.getCursor();
5711
5715
  }
5712
5716
  const enterEvent = this.clonePointerEvent(e, 'pointerenter');
@@ -5751,6 +5755,7 @@
5751
5755
  this.freeEvent(outEvent);
5752
5756
  this.freeEvent(leaveEvent);
5753
5757
  }
5758
+ this.cursorTarget = null;
5754
5759
  this.cursor = '';
5755
5760
  };
5756
5761
  this.onPointerUp = (from, target) => {
@@ -6152,7 +6157,7 @@
6152
6157
  else if (pickResult && pickResult.group) {
6153
6158
  target = pickResult.group;
6154
6159
  }
6155
- else if (x >= 0 && x <= vutils.get(this.rootTarget, 'width') && y >= 0 && y <= vutils.get(this.rootTarget, 'height')) {
6160
+ else if (this.rootTarget.AABBBounds.contains(x, y)) {
6156
6161
  target = this.rootTarget;
6157
6162
  }
6158
6163
  else {
@@ -6211,7 +6216,7 @@
6211
6216
  const federatedEvent = this.bootstrapEvent(this.rootPointerEvent, nativeEvent);
6212
6217
  this.manager.mapEvent(federatedEvent);
6213
6218
  }
6214
- this.setCursor(this.manager.cursor);
6219
+ this.setCursor(this.manager.cursor, this.manager.cursorTarget);
6215
6220
  };
6216
6221
  this.onPointerMove = (nativeEvent) => {
6217
6222
  if (this.supportsTouchEvents && nativeEvent.pointerType === 'touch') {
@@ -6225,7 +6230,7 @@
6225
6230
  const event = this.bootstrapEvent(this.rootPointerEvent, normalizedEvents[i]);
6226
6231
  this.manager.mapEvent(event);
6227
6232
  }
6228
- this.setCursor(this.manager.cursor);
6233
+ this.setCursor(this.manager.cursor, this.manager.cursorTarget);
6229
6234
  };
6230
6235
  this.onPointerUp = (nativeEvent) => {
6231
6236
  if (this.supportsTouchEvents && nativeEvent.pointerType === 'touch') {
@@ -6238,7 +6243,7 @@
6238
6243
  event.type += outside;
6239
6244
  this.manager.mapEvent(event);
6240
6245
  }
6241
- this.setCursor(this.manager.cursor);
6246
+ this.setCursor(this.manager.cursor, this.manager.cursorTarget);
6242
6247
  };
6243
6248
  this.onPointerOverOut = (nativeEvent) => {
6244
6249
  if (this.supportsTouchEvents && nativeEvent.pointerType === 'touch') {
@@ -6249,7 +6254,7 @@
6249
6254
  const event = this.bootstrapEvent(this.rootPointerEvent, normalizedEvents[i]);
6250
6255
  this.manager.mapEvent(event);
6251
6256
  }
6252
- this.setCursor(this.manager.cursor);
6257
+ this.setCursor(this.manager.cursor, this.manager.cursorTarget);
6253
6258
  };
6254
6259
  this.onWheel = (nativeEvent) => {
6255
6260
  const wheelEvent = this.normalizeWheelEvent(nativeEvent);
@@ -6279,7 +6284,13 @@
6279
6284
  release() {
6280
6285
  this.setTargetElement(null);
6281
6286
  }
6282
- setCursor(mode = 'default') {
6287
+ setCursor(mode, target) {
6288
+ if (!target && !this.manager.rootTarget.window._handler.canvas.controled) {
6289
+ return;
6290
+ }
6291
+ if (!mode) {
6292
+ mode = 'default';
6293
+ }
6283
6294
  const { applyStyles, domElement } = this;
6284
6295
  if (this.currentCursor === mode) {
6285
6296
  return;
@@ -8789,7 +8800,7 @@
8789
8800
  if (this.phi == null || this.theta == null) {
8790
8801
  return;
8791
8802
  }
8792
- const { center, r } = typeof this.params === 'function' ? this.params() : this.params;
8803
+ const { center, r, cb } = typeof this.params === 'function' ? this.params() : this.params;
8793
8804
  const deltaAngle = Math.PI * 2 * ratio;
8794
8805
  const theta = this.theta + deltaAngle;
8795
8806
  const phi = this.phi;
@@ -8805,6 +8816,7 @@
8805
8816
  }
8806
8817
  out.alpha = vutils.pi2 - out.alpha;
8807
8818
  out.zIndex = out.z * -10000;
8819
+ cb && cb(out);
8808
8820
  }
8809
8821
  }
8810
8822
  class GroupFadeIn extends ACustomAnimate {
@@ -13522,6 +13534,8 @@
13522
13534
  'lineHeight',
13523
13535
  'direction',
13524
13536
  'wordBreak',
13537
+ 'heightLimit',
13538
+ 'lineClamp',
13525
13539
  ...GRAPHIC_UPDATE_TAG_KEY
13526
13540
  ];
13527
13541
  class Text extends Graphic {
@@ -13584,6 +13598,9 @@
13584
13598
  }
13585
13599
  _isValid() {
13586
13600
  const { text } = this.attribute;
13601
+ if (vutils.isArray(text)) {
13602
+ return !text.every((t) => t == null || t === '');
13603
+ }
13587
13604
  return text != null && text !== '';
13588
13605
  }
13589
13606
  doUpdateAABBBounds() {
@@ -13723,6 +13740,10 @@
13723
13740
  updateHorizontalSinglelineAABBBounds(text) {
13724
13741
  var _a, _b;
13725
13742
  const textTheme = getTheme(this).text;
13743
+ const { wrap = textTheme.wrap } = this.attribute;
13744
+ if (wrap) {
13745
+ return this.updateWrapAABBBounds([text]);
13746
+ }
13726
13747
  const textMeasure = application.graphicUtil.textMeasure;
13727
13748
  let width;
13728
13749
  let str;
@@ -13851,6 +13872,10 @@
13851
13872
  updateHorizontalMultilineAABBBounds(text) {
13852
13873
  var _a, _b;
13853
13874
  const textTheme = getTheme(this).text;
13875
+ const { wrap = textTheme.wrap } = this.attribute;
13876
+ if (wrap) {
13877
+ return this.updateWrapAABBBounds(text);
13878
+ }
13854
13879
  const attribute = this.attribute;
13855
13880
  const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, whiteSpace = textTheme.whiteSpace, suffixPosition = textTheme.suffixPosition } = attribute;
13856
13881
  const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize);
@@ -13988,6 +14013,9 @@
13988
14013
 
13989
14014
  const WRAP_TEXT_UPDATE_TAG_KEY = ['heightLimit', 'lineClamp'];
13990
14015
  class WrapText extends Text {
14016
+ constructor(params) {
14017
+ super(Object.assign(Object.assign({}, params), { wrap: true }));
14018
+ }
13991
14019
  _isValid() {
13992
14020
  const { text } = this.attribute;
13993
14021
  if (vutils.isArray(text)) {
@@ -21113,7 +21141,7 @@
21113
21141
  const p = context.project(x, y, z);
21114
21142
  const camera = context.camera;
21115
21143
  context.camera = null;
21116
- if (parsedPath.draw(context, size, p.x, p.y, undefined, (p, a) => {
21144
+ if (parsedPath.draw(context, vutils.isArray(size) ? [size[0] * scaleX, size[1] * scaleY] : size * scaleX, p.x, p.y, undefined, (p, a) => {
21117
21145
  var _a, _b, _c;
21118
21146
  if (symbol._parsedPath.svgCache) {
21119
21147
  const obj = Object.assign({}, a);
@@ -24041,6 +24069,10 @@
24041
24069
  this.tempBounds = new vutils.AABBBounds();
24042
24070
  }
24043
24071
  tryLayout(graphic) {
24072
+ if (this.layouting) {
24073
+ return;
24074
+ }
24075
+ this.layouting = true;
24044
24076
  const p = graphic.parent;
24045
24077
  if (!p || !graphic.needUpdateLayout()) {
24046
24078
  return;
@@ -24213,6 +24245,7 @@
24213
24245
  p.addUpdateLayoutTag();
24214
24246
  if (!clip && !this.tempBounds.equals(p.AABBBounds)) {
24215
24247
  this.tryLayout(p);
24248
+ this.layouting = false;
24216
24249
  }
24217
24250
  }
24218
24251
  layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, currSeg) {
@@ -24266,6 +24299,13 @@
24266
24299
  }
24267
24300
  }
24268
24301
  }
24302
+ else if (justifyContent === 'center') {
24303
+ let pos = (main.len - currSeg.mainLen) / 2;
24304
+ for (let i = lastIdx; i <= currSeg.idx; i++) {
24305
+ children[i].attribute[main.field] = pos + getPadding(children[i], main.field);
24306
+ pos += mianLenArray[i].mainLen;
24307
+ }
24308
+ }
24269
24309
  }
24270
24310
  layoutCross(children, alignItem, cross, anchorPos, lenArray, currSeg, lastIdx) {
24271
24311
  if (alignItem === 'flex-end') {
@@ -24292,22 +24332,30 @@
24292
24332
  graphic = graphic.glyphHost;
24293
24333
  }
24294
24334
  this.tryLayout(graphic);
24335
+ this.layouting = false;
24295
24336
  });
24296
24337
  application.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, (graphic, stage, willUpdate, bounds) => {
24297
24338
  if (graphic.glyphHost) {
24298
24339
  graphic = graphic.glyphHost;
24299
24340
  }
24300
- if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {
24341
+ if (!(stage && stage === this.pluginService.stage)) {
24342
+ return;
24343
+ }
24344
+ if (!graphic.isContainer) {
24301
24345
  return;
24302
24346
  }
24303
24347
  _tempBounds.copy(bounds);
24304
24348
  });
24305
24349
  application.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, (graphic, stage, bounds, params, selfChange) => {
24306
- if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {
24350
+ if (!(stage && stage === this.pluginService.stage)) {
24351
+ return;
24352
+ }
24353
+ if (!graphic.isContainer) {
24307
24354
  return;
24308
24355
  }
24309
24356
  if (!_tempBounds.equals(bounds)) {
24310
24357
  this.tryLayout(graphic);
24358
+ this.layouting = false;
24311
24359
  }
24312
24360
  });
24313
24361
  application.graphicService.hooks.onSetStage.tap(this.key, graphic => {
@@ -24315,6 +24363,7 @@
24315
24363
  graphic = graphic.glyphHost;
24316
24364
  }
24317
24365
  this.tryLayout(graphic);
24366
+ this.layouting = false;
24318
24367
  });
24319
24368
  }
24320
24369
  deactivate(context) {
@@ -25271,7 +25320,7 @@
25271
25320
  }
25272
25321
  setCursor(mode) {
25273
25322
  this._cursor = mode;
25274
- this.eventSystem.setCursor(mode);
25323
+ this.eventSystem.setCursor(mode, 'ignore');
25275
25324
  }
25276
25325
  getCursor() {
25277
25326
  return this._cursor;