@visactor/vrender 0.22.9-alpha.1 → 0.22.9-alpha.2

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/dist/index.js CHANGED
@@ -492,14 +492,11 @@
492
492
  const ContributionProvider = Symbol("ContributionProvider");
493
493
  class ContributionProviderCache {
494
494
  constructor(serviceIdentifier, container) {
495
- this.serviceIdentifier = serviceIdentifier, this.container = container, ContributionStore.setStore(this.serviceIdentifier, this);
495
+ this.serviceIdentifier = serviceIdentifier, this.container = container;
496
496
  }
497
497
  getContributions() {
498
498
  return this.caches || (this.caches = [], this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier))), this.caches;
499
499
  }
500
- refresh() {
501
- this.caches && (this.caches.length = 0, this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier)));
502
- }
503
500
  }
504
501
  function bindContributionProvider(bind, id) {
505
502
  bind(ContributionProvider).toDynamicValue(_ref => {
@@ -517,20 +514,6 @@
517
514
  return new ContributionProviderCache(id, container);
518
515
  }).whenTargetNamed(id);
519
516
  }
520
- class ContributionStore {
521
- static getStore(id) {
522
- return this.store.get(id);
523
- }
524
- static setStore(id, cache) {
525
- this.store.set(id, cache);
526
- }
527
- static refreshAllContributions() {
528
- this.store.forEach(cache => {
529
- cache.refresh();
530
- });
531
- }
532
- }
533
- ContributionStore.store = new Map();
534
517
 
535
518
  class Hook {
536
519
  constructor(args, name) {
@@ -16333,9 +16316,6 @@
16333
16316
  init(contributions) {
16334
16317
  contributions && (this._renderContribitions = contributions.getContributions()), this._renderContribitions || (this._renderContribitions = []), this.builtinContributions || (this.builtinContributions = []), this.builtinContributions.push(defaultBaseClipRenderBeforeContribution), this.builtinContributions.push(defaultBaseClipRenderAfterContribution), this.builtinContributions.forEach(item => this._renderContribitions.push(item)), this._renderContribitions.length && (this._renderContribitions.sort((a, b) => b.order - a.order), this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === exports.BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === exports.BaseRenderContributionTime.afterFillStroke));
16335
16318
  }
16336
- reInit() {
16337
- this.init(this.graphicRenderContributions);
16338
- }
16339
16319
  beforeRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
16340
16320
  this._beforeRenderContribitions && this._beforeRenderContribitions.forEach(c => {
16341
16321
  if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
@@ -16505,8 +16485,8 @@
16505
16485
  };
16506
16486
  };
16507
16487
  exports.DefaultCanvasArcRender = class DefaultCanvasArcRender extends BaseRender {
16508
- constructor(graphicRenderContributions) {
16509
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = ARC_NUMBER_TYPE, this.builtinContributions = [defaultArcRenderContribution, defaultArcBackgroundRenderContribution, defaultArcTextureRenderContribution], this.init(graphicRenderContributions);
16488
+ constructor(arcRenderContribitions) {
16489
+ super(), this.arcRenderContribitions = arcRenderContribitions, this.numberType = ARC_NUMBER_TYPE, this.builtinContributions = [defaultArcRenderContribution, defaultArcBackgroundRenderContribution, defaultArcTextureRenderContribution], this.init(arcRenderContribitions);
16510
16490
  }
16511
16491
  drawArcTailCapPath(arc, context, cx, cy, outerRadius, innerRadius, _sa, _ea) {
16512
16492
  const capAngle = _ea - _sa,
@@ -16681,8 +16661,8 @@
16681
16661
  };
16682
16662
  };
16683
16663
  exports.DefaultCanvasCircleRender = class DefaultCanvasCircleRender extends BaseRender {
16684
- constructor(graphicRenderContributions) {
16685
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = CIRCLE_NUMBER_TYPE, this.builtinContributions = [defaultCircleRenderContribution, defaultCircleBackgroundRenderContribution, defaultCircleTextureRenderContribution], this.init(graphicRenderContributions);
16664
+ constructor(circleRenderContribitions) {
16665
+ super(), this.circleRenderContribitions = circleRenderContribitions, this.numberType = CIRCLE_NUMBER_TYPE, this.builtinContributions = [defaultCircleRenderContribution, defaultCircleBackgroundRenderContribution, defaultCircleTextureRenderContribution], this.init(circleRenderContribitions);
16686
16666
  }
16687
16667
  drawShape(circle, context, x, y, drawContext, params, fillCb, strokeCb) {
16688
16668
  const circleAttribute = getTheme(circle, null == params ? void 0 : params.theme).circle,
@@ -17068,8 +17048,8 @@
17068
17048
  };
17069
17049
  };
17070
17050
  exports.DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
17071
- constructor(graphicRenderContributions) {
17072
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(graphicRenderContributions);
17051
+ constructor(areaRenderContribitions) {
17052
+ super(), this.areaRenderContribitions = areaRenderContribitions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(areaRenderContribitions);
17073
17053
  }
17074
17054
  drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
17075
17055
  var _a, _b, _c;
@@ -17312,8 +17292,8 @@
17312
17292
  };
17313
17293
  };
17314
17294
  exports.DefaultCanvasPathRender = class DefaultCanvasPathRender extends BaseRender {
17315
- constructor(graphicRenderContributions) {
17316
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = PATH_NUMBER_TYPE, this.builtinContributions = [defaultPathBackgroundRenderContribution, defaultPathTextureRenderContribution], this.init(graphicRenderContributions);
17295
+ constructor(pathRenderContribitions) {
17296
+ super(), this.pathRenderContribitions = pathRenderContribitions, this.numberType = PATH_NUMBER_TYPE, this.builtinContributions = [defaultPathBackgroundRenderContribution, defaultPathTextureRenderContribution], this.init(pathRenderContribitions);
17317
17297
  }
17318
17298
  drawShape(path, context, x, y, drawContext, params, fillCb, strokeCb) {
17319
17299
  var _a, _b, _c;
@@ -17368,8 +17348,8 @@
17368
17348
  };
17369
17349
  };
17370
17350
  exports.DefaultCanvasRectRender = class DefaultCanvasRectRender extends BaseRender {
17371
- constructor(graphicRenderContributions) {
17372
- super(), this.graphicRenderContributions = graphicRenderContributions, this.type = "rect", this.numberType = RECT_NUMBER_TYPE, this.builtinContributions = [defaultRectRenderContribution, defaultRectBackgroundRenderContribution, defaultRectTextureRenderContribution], this.init(graphicRenderContributions);
17351
+ constructor(rectRenderContribitions) {
17352
+ super(), this.rectRenderContribitions = rectRenderContribitions, this.type = "rect", this.numberType = RECT_NUMBER_TYPE, this.builtinContributions = [defaultRectRenderContribution, defaultRectBackgroundRenderContribution, defaultRectTextureRenderContribution], this.init(rectRenderContribitions);
17373
17353
  }
17374
17354
  drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
17375
17355
  var _a;
@@ -17440,8 +17420,8 @@
17440
17420
  };
17441
17421
  };
17442
17422
  exports.DefaultCanvasSymbolRender = class DefaultCanvasSymbolRender extends BaseRender {
17443
- constructor(graphicRenderContributions) {
17444
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(graphicRenderContributions);
17423
+ constructor(symbolRenderContribitions) {
17424
+ super(), this.symbolRenderContribitions = symbolRenderContribitions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(symbolRenderContribitions);
17445
17425
  }
17446
17426
  drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb) {
17447
17427
  var _a;
@@ -17612,8 +17592,8 @@
17612
17592
  };
17613
17593
  };
17614
17594
  exports.DefaultCanvasTextRender = class DefaultCanvasTextRender extends BaseRender {
17615
- constructor(graphicRenderContributions) {
17616
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = TEXT_NUMBER_TYPE, this.builtinContributions = [defaultTextBackgroundRenderContribution], this.init(graphicRenderContributions);
17595
+ constructor(textRenderContribitions) {
17596
+ super(), this.textRenderContribitions = textRenderContribitions, this.numberType = TEXT_NUMBER_TYPE, this.builtinContributions = [defaultTextBackgroundRenderContribution], this.init(textRenderContribitions);
17617
17597
  }
17618
17598
  drawShape(text, context, x, y, drawContext, params, fillCb, strokeCb) {
17619
17599
  var _a, _b, _c;
@@ -17827,8 +17807,8 @@
17827
17807
  };
17828
17808
  };
17829
17809
  exports.DefaultCanvasPolygonRender = class DefaultCanvasPolygonRender extends BaseRender {
17830
- constructor(graphicRenderContributions) {
17831
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
17810
+ constructor(polygonRenderContribitions) {
17811
+ super(), this.polygonRenderContribitions = polygonRenderContribitions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(polygonRenderContribitions);
17832
17812
  }
17833
17813
  drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
17834
17814
  const polygonAttribute = getTheme(polygon, null == params ? void 0 : params.theme).polygon,
@@ -17883,9 +17863,6 @@
17883
17863
  constructor(groupRenderContribitions) {
17884
17864
  this.groupRenderContribitions = groupRenderContribitions, this.numberType = GROUP_NUMBER_TYPE;
17885
17865
  }
17886
- reInit() {
17887
- this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [], this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);
17888
- }
17889
17866
  drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb) {
17890
17867
  const groupAttribute = getTheme(group, null == params ? void 0 : params.theme).group,
17891
17868
  {
@@ -18016,8 +17993,8 @@
18016
17993
  };
18017
17994
  const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
18018
17995
  exports.DefaultCanvasImageRender = class DefaultCanvasImageRender extends BaseRender {
18019
- constructor(graphicRenderContributions) {
18020
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
17996
+ constructor(imageRenderContribitions) {
17997
+ super(), this.imageRenderContribitions = imageRenderContribitions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(imageRenderContribitions);
18021
17998
  }
18022
17999
  drawShape(image, context, x, y, drawContext, params, fillCb, strokeCb) {
18023
18000
  const imageAttribute = getTheme(image).image,
@@ -18347,9 +18324,6 @@
18347
18324
  afterDraw(params) {
18348
18325
  this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, Object.assign({}, this.drawParams));
18349
18326
  }
18350
- reInit() {
18351
- this.drawContribution.reInit();
18352
- }
18353
18327
  render(groups, params) {
18354
18328
  this.renderTreeRoots = groups, this.drawParams = params;
18355
18329
  const updateBounds = params.updateBounds;
@@ -18753,11 +18727,6 @@
18753
18727
  constructor(contributions, drawItemInterceptorContributions) {
18754
18728
  this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this.currentRenderMap = new Map(), this.defaultRenderMap = new Map(), this.styleRenderMap = new Map(), this.dirtyBounds = new Bounds(), this.backupDirtyBounds = new Bounds(), this.global = application.global, this.layerService = application.layerService, isArray$1(this.contributions) || (this.contributions = [this.contributions]), this.init();
18755
18729
  }
18756
- reInit() {
18757
- this.init(), this.contributions.forEach(item => {
18758
- item.reInit();
18759
- });
18760
- }
18761
18730
  init() {
18762
18731
  this.contributions.forEach(item => {
18763
18732
  if (item.style) {
@@ -19885,9 +19854,6 @@
19885
19854
  getPickerService() {
19886
19855
  return this.pickerService || (this.pickerService = container.get(PickerService)), this.pickerService;
19887
19856
  }
19888
- reInit() {
19889
- this.renderService.reInit(), this.pickerService.reInit();
19890
- }
19891
19857
  }
19892
19858
 
19893
19859
  function createStage(params) {
@@ -20485,9 +20451,6 @@
20485
20451
  constructor(pickItemInterceptorContributions, pickServiceInterceptorContributions) {
20486
20452
  this.pickItemInterceptorContributions = pickItemInterceptorContributions, this.pickServiceInterceptorContributions = pickServiceInterceptorContributions, this.type = "default", this.global = application.global;
20487
20453
  }
20488
- reInit() {
20489
- this._init();
20490
- }
20491
20454
  _init() {
20492
20455
  this.InterceptorContributions = this.pickItemInterceptorContributions.getContributions().sort((a, b) => a.order - b.order), this.pickerServiceInterceptorContributions = this.pickServiceInterceptorContributions.getContributions().sort((a, b) => a.order - b.order);
20493
20456
  }
@@ -20602,7 +20565,6 @@
20602
20565
  this.configure(global, env);
20603
20566
  }), this.configure(this.global, this.global.env);
20604
20567
  }
20605
- reInit() {}
20606
20568
  configure(global, env) {}
20607
20569
  pick(graphics, point, params) {
20608
20570
  let result = {
@@ -20692,9 +20654,15 @@
20692
20654
  currentTarget: {
20693
20655
  value: event.currentTarget
20694
20656
  }
20695
- }), event instanceof MouseEvent || event instanceof PointerEvent) transformPoint(event.clientX, event.clientY, transformMatrix, containerRect, transformedEvent);else if (event instanceof TouchEvent && event.touches.length > 0) {
20696
- const touch = event.touches[0];
20697
- transformPoint(touch.clientX, touch.clientY, transformMatrix, containerRect, transformedEvent);
20657
+ }), event instanceof MouseEvent || event instanceof PointerEvent) transformPoint(event.clientX, event.clientY, transformMatrix, containerRect, transformedEvent);else if (event instanceof TouchEvent) {
20658
+ if (event.touches.length > 0) {
20659
+ const touch = transformedEvent.touches[0];
20660
+ transformPoint(touch.clientX, touch.clientY, transformMatrix, containerRect, touch);
20661
+ }
20662
+ if (event.changedTouches.length > 0) {
20663
+ const touch = transformedEvent.changedTouches[0];
20664
+ transformPoint(touch.clientX, touch.clientY, transformMatrix, containerRect, touch);
20665
+ }
20698
20666
  }
20699
20667
  return transformedEvent;
20700
20668
  };
@@ -20725,10 +20693,22 @@
20725
20693
  });
20726
20694
  }
20727
20695
  function mapToCanvasPointForCanvas(nativeEvent) {
20696
+ var _a;
20728
20697
  if (isNumber(nativeEvent._canvasX) && isNumber(nativeEvent._canvasY)) return {
20729
20698
  x: nativeEvent._canvasX,
20730
20699
  y: nativeEvent._canvasY
20731
20700
  };
20701
+ if (nativeEvent.changedTouches) {
20702
+ const data = null !== (_a = nativeEvent.changedTouches[0]) && void 0 !== _a ? _a : {};
20703
+ return {
20704
+ x: data._canvasX,
20705
+ y: data._canvasY
20706
+ };
20707
+ }
20708
+ return {
20709
+ x: nativeEvent._canvasX || 0,
20710
+ y: nativeEvent._canvasY || 0
20711
+ };
20732
20712
  }
20733
20713
 
20734
20714
  var __rest$1 = undefined && undefined.__rest || function (s, e) {
@@ -21942,7 +21922,6 @@
21942
21922
  constructor() {
21943
21923
  this.numberType = GLYPH_NUMBER_TYPE;
21944
21924
  }
21945
- reInit() {}
21946
21925
  drawShape(glyph, context, x, y, drawContext, params, fillCb, strokeCb) {
21947
21926
  drawContext.drawContribution && glyph.getSubGraphic().forEach(item => {
21948
21927
  const renderer = drawContext.drawContribution.getRenderContribution(item);
@@ -24475,10 +24454,6 @@
24475
24454
  drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb) {
24476
24455
  if (this.canvasRenderer.drawShape) return this.canvasRenderer.drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb);
24477
24456
  }
24478
- reInit() {
24479
- var _a;
24480
- null === (_a = this.canvasRenderer) || void 0 === _a || _a.reInit();
24481
- }
24482
24457
  }
24483
24458
 
24484
24459
  var __decorate$18 = undefined && undefined.__decorate || function (decorators, target, key, desc) {
@@ -32033,7 +32008,7 @@
32033
32008
 
32034
32009
  const roughModule = _roughModule;
32035
32010
 
32036
- const version = "0.22.9-alpha.1";
32011
+ const version = "0.22.9-alpha.2";
32037
32012
  preLoadAllModule();
32038
32013
  if (isBrowserEnv()) {
32039
32014
  loadBrowserEnv(container);
@@ -32130,7 +32105,6 @@
32130
32105
  exports.ContainerModule = ContainerModule;
32131
32106
  exports.Context2dFactory = Context2dFactory;
32132
32107
  exports.ContributionProvider = ContributionProvider;
32133
- exports.ContributionStore = ContributionStore;
32134
32108
  exports.CurveContext = CurveContext;
32135
32109
  exports.CustomEvent = CustomEvent;
32136
32110
  exports.CustomPath2D = CustomPath2D;