@antv/g 5.16.30 → 5.16.31

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.umd.js CHANGED
@@ -9489,11 +9489,11 @@
9489
9489
  * @see https://github.com/pixijs/pixi.js/blob/dev/packages/interaction/README.md
9490
9490
  *
9491
9491
  * also provide some extra events such as `drag`
9492
- */var EventPlugin=/*#__PURE__*/function(){function EventPlugin(){var _this=this;this.autoPreventDefault=false;this.rootPointerEvent=new FederatedPointerEvent(null);this.rootWheelEvent=new FederatedWheelEvent(null);this.context=void 0;this.onPointerMove=function(nativeEvent){var _this$context$renderi,_this$context$renderi2;var canvas=(_this$context$renderi=_this.context.renderingContext.root)===null||_this$context$renderi===void 0?void 0:(_this$context$renderi2=_this$context$renderi.ownerDocument)===null||_this$context$renderi2===void 0?void 0:_this$context$renderi2.defaultView;if(canvas.supportsTouchEvents&&nativeEvent.pointerType==='touch')return;var normalizedEvents=_this.normalizeToPointerEvent(nativeEvent,canvas);for(var _iterator=_createForOfIteratorHelperLoose(normalizedEvents),_step;!(_step=_iterator()).done;){var normalizedEvent=_step.value;var event=_this.bootstrapEvent(_this.rootPointerEvent,normalizedEvent,canvas,nativeEvent);_this.context.eventService.mapEvent(event);}_this.setCursor(_this.context.eventService.cursor);};}var _proto=EventPlugin.prototype;_proto.apply=function apply(context){var _this2=this;this.context=context;var renderingService=context.renderingService;var canvas=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(position){var _this2$context$render=_this2.context.renderingService.hooks.pickSync.call({position:position,picked:[],topmost:true// we only concern the topmost element
9493
- }),picked=_this2$context$render.picked;return picked[0]||null;});renderingService.hooks.pointerWheel.tap(EventPlugin.tag,function(nativeEvent){var wheelEvent=_this2.normalizeWheelEvent(nativeEvent);_this2.context.eventService.mapEvent(wheelEvent);});renderingService.hooks.pointerDown.tap(EventPlugin.tag,function(nativeEvent){if(canvas.supportsTouchEvents&&nativeEvent.pointerType==='touch')return;var events=_this2.normalizeToPointerEvent(nativeEvent,canvas);if(_this2.autoPreventDefault&&events[0].isNormalized){var cancelable=nativeEvent.cancelable||!('cancelable'in nativeEvent);if(cancelable){nativeEvent.preventDefault();}}for(var _iterator2=_createForOfIteratorHelperLoose(events),_step2;!(_step2=_iterator2()).done;){var event=_step2.value;var federatedEvent=_this2.bootstrapEvent(_this2.rootPointerEvent,event,canvas,nativeEvent);_this2.context.eventService.mapEvent(federatedEvent);}_this2.setCursor(_this2.context.eventService.cursor);});renderingService.hooks.pointerUp.tap(EventPlugin.tag,function(nativeEvent){if(canvas.supportsTouchEvents&&nativeEvent.pointerType==='touch')return;// account for element in SVG
9492
+ */var EventPlugin=/*#__PURE__*/function(){function EventPlugin(){var _this=this;this.autoPreventDefault=false;this.rootPointerEvent=new FederatedPointerEvent(null);this.rootWheelEvent=new FederatedWheelEvent(null);this.context=void 0;this.onPointerMove=function(nativeEvent){var _this$context$renderi,_this$context$renderi2;var canvas=(_this$context$renderi=_this.context.renderingContext.root)===null||_this$context$renderi===void 0?void 0:(_this$context$renderi2=_this$context$renderi.ownerDocument)===null||_this$context$renderi2===void 0?void 0:_this$context$renderi2.defaultView;if(canvas.supportsTouchEvents&&nativeEvent.pointerType==='touch')return;var normalizedEvents=_this.normalizeToPointerEvent(nativeEvent,canvas);for(var _iterator=_createForOfIteratorHelperLoose(normalizedEvents),_step;!(_step=_iterator()).done;){var normalizedEvent=_step.value;var event=_this.bootstrapEvent(_this.rootPointerEvent,normalizedEvent,canvas,nativeEvent);_this.context.eventService.mapEvent(event);}_this.setCursor(_this.context.eventService.cursor);};this.onClick=function(nativeEvent){var _this$context$renderi3,_this$context$renderi4;var canvas=(_this$context$renderi3=_this.context.renderingContext.root)===null||_this$context$renderi3===void 0?void 0:(_this$context$renderi4=_this$context$renderi3.ownerDocument)===null||_this$context$renderi4===void 0?void 0:_this$context$renderi4.defaultView;var normalizedEvents=_this.normalizeToPointerEvent(nativeEvent,canvas);for(var _iterator2=_createForOfIteratorHelperLoose(normalizedEvents),_step2;!(_step2=_iterator2()).done;){var normalizedEvent=_step2.value;var event=_this.bootstrapEvent(_this.rootPointerEvent,normalizedEvent,canvas,nativeEvent);_this.context.eventService.mapEvent(event);}_this.setCursor(_this.context.eventService.cursor);};}var _proto=EventPlugin.prototype;_proto.apply=function apply(context){var _this2=this;this.context=context;var renderingService=context.renderingService;var canvas=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(position){var _this2$context$render=_this2.context.renderingService.hooks.pickSync.call({position:position,picked:[],topmost:true// we only concern the topmost element
9493
+ }),picked=_this2$context$render.picked;return picked[0]||null;});renderingService.hooks.pointerWheel.tap(EventPlugin.tag,function(nativeEvent){var wheelEvent=_this2.normalizeWheelEvent(nativeEvent);_this2.context.eventService.mapEvent(wheelEvent);});renderingService.hooks.pointerDown.tap(EventPlugin.tag,function(nativeEvent){if(canvas.supportsTouchEvents&&nativeEvent.pointerType==='touch')return;var events=_this2.normalizeToPointerEvent(nativeEvent,canvas);if(_this2.autoPreventDefault&&events[0].isNormalized){var cancelable=nativeEvent.cancelable||!('cancelable'in nativeEvent);if(cancelable){nativeEvent.preventDefault();}}for(var _iterator3=_createForOfIteratorHelperLoose(events),_step3;!(_step3=_iterator3()).done;){var event=_step3.value;var federatedEvent=_this2.bootstrapEvent(_this2.rootPointerEvent,event,canvas,nativeEvent);_this2.context.eventService.mapEvent(federatedEvent);}_this2.setCursor(_this2.context.eventService.cursor);});renderingService.hooks.pointerUp.tap(EventPlugin.tag,function(nativeEvent){if(canvas.supportsTouchEvents&&nativeEvent.pointerType==='touch')return;// account for element in SVG
9494
9494
  var $element=_this2.context.contextService.getDomElement();var outside='outside';try{outside=$element&&nativeEvent.target&&nativeEvent.target!==$element&&$element.contains&&!$element.contains(nativeEvent.target)?'outside':'';}catch(e){// nativeEvent.target maybe not Node, such as Window
9495
9495
  // @see https://github.com/antvis/G/issues/1235
9496
- }var normalizedEvents=_this2.normalizeToPointerEvent(nativeEvent,canvas);for(var _iterator3=_createForOfIteratorHelperLoose(normalizedEvents),_step3;!(_step3=_iterator3()).done;){var normalizedEvent=_step3.value;var event=_this2.bootstrapEvent(_this2.rootPointerEvent,normalizedEvent,canvas,nativeEvent);event.type+=outside;_this2.context.eventService.mapEvent(event);}_this2.setCursor(_this2.context.eventService.cursor);});renderingService.hooks.pointerMove.tap(EventPlugin.tag,this.onPointerMove);renderingService.hooks.pointerOver.tap(EventPlugin.tag,this.onPointerMove);renderingService.hooks.pointerOut.tap(EventPlugin.tag,this.onPointerMove);renderingService.hooks.click.tap(EventPlugin.tag,this.onPointerMove);renderingService.hooks.pointerCancel.tap(EventPlugin.tag,function(nativeEvent){var normalizedEvents=_this2.normalizeToPointerEvent(nativeEvent,canvas);for(var _iterator4=_createForOfIteratorHelperLoose(normalizedEvents),_step4;!(_step4=_iterator4()).done;){var normalizedEvent=_step4.value;var event=_this2.bootstrapEvent(_this2.rootPointerEvent,normalizedEvent,canvas,nativeEvent);_this2.context.eventService.mapEvent(event);}_this2.setCursor(_this2.context.eventService.cursor);});};_proto.getViewportXY=function getViewportXY(nativeEvent){var x;var y;/**
9496
+ }var normalizedEvents=_this2.normalizeToPointerEvent(nativeEvent,canvas);for(var _iterator4=_createForOfIteratorHelperLoose(normalizedEvents),_step4;!(_step4=_iterator4()).done;){var normalizedEvent=_step4.value;var event=_this2.bootstrapEvent(_this2.rootPointerEvent,normalizedEvent,canvas,nativeEvent);event.type+=outside;_this2.context.eventService.mapEvent(event);}_this2.setCursor(_this2.context.eventService.cursor);});renderingService.hooks.pointerMove.tap(EventPlugin.tag,this.onPointerMove);renderingService.hooks.pointerOver.tap(EventPlugin.tag,this.onPointerMove);renderingService.hooks.pointerOut.tap(EventPlugin.tag,this.onPointerMove);renderingService.hooks.click.tap(EventPlugin.tag,this.onClick);renderingService.hooks.pointerCancel.tap(EventPlugin.tag,function(nativeEvent){var normalizedEvents=_this2.normalizeToPointerEvent(nativeEvent,canvas);for(var _iterator5=_createForOfIteratorHelperLoose(normalizedEvents),_step5;!(_step5=_iterator5()).done;){var normalizedEvent=_step5.value;var event=_this2.bootstrapEvent(_this2.rootPointerEvent,normalizedEvent,canvas,nativeEvent);_this2.context.eventService.mapEvent(event);}_this2.setCursor(_this2.context.eventService.cursor);});};_proto.getViewportXY=function getViewportXY(nativeEvent){var x;var y;/**
9497
9497
  * Should account for CSS Transform applied on container.
9498
9498
  * @see https://github.com/antvis/G/issues/1161
9499
9499
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/MouseEvent/offsetX