@visactor/vrender-core 0.17.5-alpha.1 → 0.17.5

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 (51) hide show
  1. package/cjs/color-string/store.js +4 -4
  2. package/cjs/color-string/store.js.map +1 -1
  3. package/cjs/core/stage.js +7 -7
  4. package/cjs/core/stage.js.map +1 -1
  5. package/cjs/event/event-manager.d.ts +1 -0
  6. package/cjs/event/event-manager.js +5 -6
  7. package/cjs/event/event-manager.js.map +1 -1
  8. package/cjs/event/event-system.d.ts +2 -2
  9. package/cjs/event/event-system.js +7 -5
  10. package/cjs/event/event-system.js.map +1 -1
  11. package/cjs/graphic/config.js +2 -1
  12. package/cjs/graphic/config.js.map +1 -1
  13. package/cjs/graphic/text.d.ts +1 -0
  14. package/cjs/graphic/text.js +7 -4
  15. package/cjs/graphic/text.js.map +1 -1
  16. package/cjs/interface/graphic/text.d.ts +2 -0
  17. package/cjs/interface/graphic/text.js.map +1 -1
  18. package/cjs/interface/plugin.d.ts +1 -0
  19. package/cjs/interface/plugin.js.map +1 -1
  20. package/cjs/plugins/plugin-service.d.ts +1 -0
  21. package/cjs/plugins/plugin-service.js +4 -0
  22. package/cjs/plugins/plugin-service.js.map +1 -1
  23. package/cjs/render/contributions/render/text-render.js +2 -2
  24. package/cjs/render/contributions/render/text-render.js.map +1 -1
  25. package/dist/index.js +47 -25
  26. package/dist/index.min.js +1 -1
  27. package/es/color-string/store.js +1 -3
  28. package/es/color-string/store.js.map +1 -1
  29. package/es/core/stage.js +7 -7
  30. package/es/core/stage.js.map +1 -1
  31. package/es/event/event-manager.d.ts +1 -0
  32. package/es/event/event-manager.js +6 -6
  33. package/es/event/event-manager.js.map +1 -1
  34. package/es/event/event-system.d.ts +2 -2
  35. package/es/event/event-system.js +7 -5
  36. package/es/event/event-system.js.map +1 -1
  37. package/es/graphic/config.js +2 -1
  38. package/es/graphic/config.js.map +1 -1
  39. package/es/graphic/text.d.ts +1 -0
  40. package/es/graphic/text.js +7 -4
  41. package/es/graphic/text.js.map +1 -1
  42. package/es/interface/graphic/text.d.ts +2 -0
  43. package/es/interface/graphic/text.js.map +1 -1
  44. package/es/interface/plugin.d.ts +1 -0
  45. package/es/interface/plugin.js.map +1 -1
  46. package/es/plugins/plugin-service.d.ts +1 -0
  47. package/es/plugins/plugin-service.js +4 -0
  48. package/es/plugins/plugin-service.js.map +1 -1
  49. package/es/render/contributions/render/text-render.js +2 -2
  50. package/es/render/contributions/render/text-render.js.map +1 -1
  51. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3158,7 +3158,8 @@
3158
3158
  whiteSpace: 'no-wrap',
3159
3159
  heightLimit: Infinity,
3160
3160
  lineClamp: Infinity,
3161
- suffixPosition: 'end'
3161
+ suffixPosition: 'end',
3162
+ disableAutoClipedPoptip: undefined
3162
3163
  };
3163
3164
  const DefaultPickStyle = {
3164
3165
  pickStrokeBuffer: 0
@@ -5598,6 +5599,7 @@
5598
5599
  class EventManager {
5599
5600
  constructor(root, config) {
5600
5601
  this.dispatch = new vutils.EventEmitter();
5602
+ this.cursorTarget = null;
5601
5603
  this.mappingState = {
5602
5604
  trackingData: {}
5603
5605
  };
@@ -5689,6 +5691,7 @@
5689
5691
  }
5690
5692
  if (isMouse) {
5691
5693
  this[propagationMethod](e, 'mousemove');
5694
+ this.cursorTarget = e.target;
5692
5695
  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();
5693
5696
  }
5694
5697
  trackingData.overTargets = e.composedPath();
@@ -5708,6 +5711,7 @@
5708
5711
  this.dispatchEvent(e, 'mouseover');
5709
5712
  }
5710
5713
  if (e.pointerType === 'mouse') {
5714
+ this.cursorTarget = e.target;
5711
5715
  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();
5712
5716
  }
5713
5717
  const enterEvent = this.clonePointerEvent(e, 'pointerenter');
@@ -5752,6 +5756,7 @@
5752
5756
  this.freeEvent(outEvent);
5753
5757
  this.freeEvent(leaveEvent);
5754
5758
  }
5759
+ this.cursorTarget = null;
5755
5760
  this.cursor = '';
5756
5761
  };
5757
5762
  this.onPointerUp = (from, target) => {
@@ -6153,7 +6158,7 @@
6153
6158
  else if (pickResult && pickResult.group) {
6154
6159
  target = pickResult.group;
6155
6160
  }
6156
- else if (x >= 0 && x <= vutils.get(this.rootTarget, 'width') && y >= 0 && y <= vutils.get(this.rootTarget, 'height')) {
6161
+ else if (this.rootTarget.AABBBounds.contains(x, y)) {
6157
6162
  target = this.rootTarget;
6158
6163
  }
6159
6164
  else {
@@ -6212,7 +6217,7 @@
6212
6217
  const federatedEvent = this.bootstrapEvent(this.rootPointerEvent, nativeEvent);
6213
6218
  this.manager.mapEvent(federatedEvent);
6214
6219
  }
6215
- this.setCursor(this.manager.cursor);
6220
+ this.setCursor(this.manager.cursor, this.manager.cursorTarget);
6216
6221
  };
6217
6222
  this.onPointerMove = (nativeEvent) => {
6218
6223
  if (this.supportsTouchEvents && nativeEvent.pointerType === 'touch') {
@@ -6226,7 +6231,7 @@
6226
6231
  const event = this.bootstrapEvent(this.rootPointerEvent, normalizedEvents[i]);
6227
6232
  this.manager.mapEvent(event);
6228
6233
  }
6229
- this.setCursor(this.manager.cursor);
6234
+ this.setCursor(this.manager.cursor, this.manager.cursorTarget);
6230
6235
  };
6231
6236
  this.onPointerUp = (nativeEvent) => {
6232
6237
  if (this.supportsTouchEvents && nativeEvent.pointerType === 'touch') {
@@ -6239,7 +6244,7 @@
6239
6244
  event.type += outside;
6240
6245
  this.manager.mapEvent(event);
6241
6246
  }
6242
- this.setCursor(this.manager.cursor);
6247
+ this.setCursor(this.manager.cursor, this.manager.cursorTarget);
6243
6248
  };
6244
6249
  this.onPointerOverOut = (nativeEvent) => {
6245
6250
  if (this.supportsTouchEvents && nativeEvent.pointerType === 'touch') {
@@ -6250,7 +6255,7 @@
6250
6255
  const event = this.bootstrapEvent(this.rootPointerEvent, normalizedEvents[i]);
6251
6256
  this.manager.mapEvent(event);
6252
6257
  }
6253
- this.setCursor(this.manager.cursor);
6258
+ this.setCursor(this.manager.cursor, this.manager.cursorTarget);
6254
6259
  };
6255
6260
  this.onWheel = (nativeEvent) => {
6256
6261
  const wheelEvent = this.normalizeWheelEvent(nativeEvent);
@@ -6280,7 +6285,13 @@
6280
6285
  release() {
6281
6286
  this.setTargetElement(null);
6282
6287
  }
6283
- setCursor(mode = 'default') {
6288
+ setCursor(mode, target) {
6289
+ if (!target && !this.manager.rootTarget.window._handler.canvas.controled) {
6290
+ return;
6291
+ }
6292
+ if (!mode) {
6293
+ mode = 'default';
6294
+ }
6284
6295
  const { applyStyles, domElement } = this;
6285
6296
  if (this.currentCursor === mode) {
6286
6297
  return;
@@ -9753,10 +9764,9 @@
9753
9764
  return res;
9754
9765
  };
9755
9766
 
9756
- const { Color } = vutils.ColorUtil;
9757
9767
  function colorEqual(color1, color2) {
9758
- const c1 = Color.parseColorString(color1);
9759
- const c2 = Color.parseColorString(color2);
9768
+ const c1 = vutils.Color.parseColorString(color1);
9769
+ const c2 = vutils.Color.parseColorString(color2);
9760
9770
  return c1 && c2 ? c1.r === c2.r && c1.g === c2.g && c1.b === c2.b && c1.opacity === c2.opacity : false;
9761
9771
  }
9762
9772
  exports.ColorType = void 0;
@@ -9775,7 +9785,7 @@
9775
9785
  arr[3] = color[3];
9776
9786
  return arr;
9777
9787
  }
9778
- const c = Color.parseColorString(str);
9788
+ const c = vutils.Color.parseColorString(str);
9779
9789
  if (c) {
9780
9790
  const data = [c.r / 255, c.g / 255, c.b / 255, c.opacity];
9781
9791
  ColorStore.store1[str] = data;
@@ -9795,7 +9805,7 @@
9795
9805
  arr[3] = color[3];
9796
9806
  return arr;
9797
9807
  }
9798
- const c = Color.parseColorString(str);
9808
+ const c = vutils.Color.parseColorString(str);
9799
9809
  if (c) {
9800
9810
  ColorStore.store1[str] = [c.r / 255, c.g / 255, c.b / 255, c.opacity];
9801
9811
  ColorStore.store255[str] = [c.r, c.g, c.b, c.opacity];
@@ -13540,7 +13550,7 @@
13540
13550
  var _a;
13541
13551
  const attribute = this.attribute;
13542
13552
  const textTheme = getTheme(this).text;
13543
- if (Array.isArray(attribute.text)) {
13553
+ if (this.isMultiLine) {
13544
13554
  return undefined;
13545
13555
  }
13546
13556
  const { maxLineWidth = textTheme.maxLineWidth } = attribute;
@@ -13551,7 +13561,7 @@
13551
13561
  return this.cache.clipedText;
13552
13562
  }
13553
13563
  get clipedWidth() {
13554
- if (Array.isArray(this.attribute.text)) {
13564
+ if (this.isMultiLine) {
13555
13565
  return undefined;
13556
13566
  }
13557
13567
  this.tryUpdateAABBBounds();
@@ -13560,7 +13570,7 @@
13560
13570
  get cliped() {
13561
13571
  const textTheme = getTheme(this).text;
13562
13572
  const attribute = this.attribute;
13563
- if (Array.isArray(attribute.text)) {
13573
+ if (this.isMultiLine) {
13564
13574
  return undefined;
13565
13575
  }
13566
13576
  const { maxLineWidth = textTheme.maxLineWidth } = attribute;
@@ -13571,12 +13581,15 @@
13571
13581
  return this.clipedText !== attribute.text.toString();
13572
13582
  }
13573
13583
  get multilineLayout() {
13574
- if (!Array.isArray(this.attribute.text)) {
13584
+ if (!this.isMultiLine) {
13575
13585
  return undefined;
13576
13586
  }
13577
13587
  this.tryUpdateAABBBounds();
13578
13588
  return this.cache.layoutData;
13579
13589
  }
13590
+ get isMultiLine() {
13591
+ return Array.isArray(this.attribute.text) || this.attribute.whiteSpace === 'normal';
13592
+ }
13580
13593
  constructor(params = { text: '', fontSize: 16 }) {
13581
13594
  super(params);
13582
13595
  this.type = 'text';
@@ -21274,7 +21287,7 @@
21274
21287
  drawShape(text, context, x, y, drawContext, params, fillCb, strokeCb) {
21275
21288
  var _a, _b, _c;
21276
21289
  const textAttribute = getTheme(text, params === null || params === void 0 ? void 0 : params.theme).text;
21277
- const { text: str, underline = textAttribute.underline, lineThrough = textAttribute.lineThrough, keepDirIn3d = textAttribute.keepDirIn3d, direction = textAttribute.direction, fontSize = textAttribute.fontSize, verticalMode = textAttribute.verticalMode, x: originX = textAttribute.x, y: originY = textAttribute.y } = text.attribute;
21290
+ const { text: str, underline = textAttribute.underline, lineThrough = textAttribute.lineThrough, keepDirIn3d = textAttribute.keepDirIn3d, direction = textAttribute.direction, whiteSpace = textAttribute.whiteSpace, fontSize = textAttribute.fontSize, verticalMode = textAttribute.verticalMode, x: originX = textAttribute.x, y: originY = textAttribute.y } = text.attribute;
21278
21291
  let { textAlign = textAttribute.textAlign, textBaseline = textAttribute.textBaseline } = text.attribute;
21279
21292
  if (!verticalMode && direction === 'vertical') {
21280
21293
  const t = textAlign;
@@ -21328,7 +21341,7 @@
21328
21341
  context.setTransformForCurrent();
21329
21342
  }
21330
21343
  };
21331
- if (Array.isArray(str)) {
21344
+ if (text.isMultiLine) {
21332
21345
  context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);
21333
21346
  if (direction === 'horizontal') {
21334
21347
  const { multilineLayout } = text;
@@ -22095,6 +22108,15 @@
22095
22108
  plugin.activate(this);
22096
22109
  }
22097
22110
  }
22111
+ unRegister(plugin) {
22112
+ if (plugin.activeEvent === 'onStartupFinished') {
22113
+ this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(plugin), 1);
22114
+ }
22115
+ else if (plugin.activeEvent === 'onRegister') {
22116
+ this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(plugin), 1);
22117
+ }
22118
+ plugin.deactivate(this);
22119
+ }
22098
22120
  release(...params) {
22099
22121
  this.onStartupFinishedPlugin.forEach(plugin => {
22100
22122
  plugin.deactivate(this);
@@ -24957,7 +24979,7 @@
24957
24979
  }
24958
24980
  this.view3dTranform = false;
24959
24981
  this.pluginService.findPluginsByName('ViewTransform3dPlugin').forEach(plugin => {
24960
- plugin.deactivate(this.pluginService);
24982
+ this.pluginService.unRegister(plugin);
24961
24983
  });
24962
24984
  }
24963
24985
  enableAutoRender() {
@@ -24973,7 +24995,7 @@
24973
24995
  }
24974
24996
  this.autoRender = false;
24975
24997
  this.pluginService.findPluginsByName('AutoRenderPlugin').forEach(plugin => {
24976
- plugin.deactivate(this.pluginService);
24998
+ this.pluginService.unRegister(plugin);
24977
24999
  });
24978
25000
  }
24979
25001
  enableIncrementalAutoRender() {
@@ -24989,7 +25011,7 @@
24989
25011
  }
24990
25012
  this.increaseAutoRender = false;
24991
25013
  this.pluginService.findPluginsByName('IncrementalAutoRenderPlugin').forEach(plugin => {
24992
- plugin.deactivate(this.pluginService);
25014
+ this.pluginService.unRegister(plugin);
24993
25015
  });
24994
25016
  }
24995
25017
  enableDirtyBounds() {
@@ -25012,7 +25034,7 @@
25012
25034
  }
25013
25035
  this.dirtyBounds = null;
25014
25036
  this.pluginService.findPluginsByName('DirtyBoundsPlugin').forEach(plugin => {
25015
- plugin.deactivate(this.pluginService);
25037
+ this.pluginService.unRegister(plugin);
25016
25038
  });
25017
25039
  }
25018
25040
  enableLayout() {
@@ -25028,7 +25050,7 @@
25028
25050
  }
25029
25051
  this._enableLayout = false;
25030
25052
  this.pluginService.findPluginsByName('FlexLayoutPlugin').forEach(plugin => {
25031
- plugin.deactivate(this.pluginService);
25053
+ this.pluginService.unRegister(plugin);
25032
25054
  });
25033
25055
  }
25034
25056
  enableHtmlAttribute(container) {
@@ -25044,7 +25066,7 @@
25044
25066
  }
25045
25067
  this.htmlAttribute = false;
25046
25068
  this.pluginService.findPluginsByName('HtmlAttributePlugin').forEach(plugin => {
25047
- plugin.deactivate(this.pluginService);
25069
+ this.pluginService.unRegister(plugin);
25048
25070
  });
25049
25071
  }
25050
25072
  tryUpdateAABBBounds() {
@@ -25310,7 +25332,7 @@
25310
25332
  }
25311
25333
  setCursor(mode) {
25312
25334
  this._cursor = mode;
25313
- this.eventSystem.setCursor(mode);
25335
+ this.eventSystem.setCursor(mode, 'ignore');
25314
25336
  }
25315
25337
  getCursor() {
25316
25338
  return this._cursor;