UNPKG

@antv/g-plugin-mobile-interaction

Version:

A G plugin listening events in mobile environment

11 lines (10 loc) 4.05 kB
/*! * @antv/g-plugin-mobile-interaction * @description A G plugin listening events in mobile environment * @version 1.0.42 * @date 12/12/2025, 3:30:21 AM * @author AntVis * @docs https://g.antv.antgroup.com/ */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.MobileInteraction={}),e.window.G)}(this,function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function r(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}function i(e,t){for(var n=0;t.length>n;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,r(o.key),o)}}function c(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function f(e,t){if(t&&("object"==o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var s=function(){function e(){n(this,e)}return c(e,[{key:"apply",value:function(t){var n=t.renderingService,o=t.config,r=t.contextService.getDomElement(),i=function(e){n.hooks.pointerDown.call(e)},c=function(e){n.hooks.pointerUp.call(e)},u=function(e){n.hooks.pointerMove.call(e)},a=function(e){n.hooks.pointerOver.call(e)},f=function(e){n.hooks.pointerOut.call(e)},l=function(e){n.hooks.click.call(e)},s=function(e){n.hooks.pointerCancel.call(e)};n.hooks.init.tap(e.tag,function(){r.addEventListener("touchstart",i,!0),r.addEventListener("touchend",c,!0),r.addEventListener("touchmove",u,!0),r.addEventListener("touchcancel",s,!0),r.addEventListener("mouseout",f,!0),r.addEventListener("mouseover",a,!0),o.useNativeClickEvent&&r.addEventListener("click",l,!0)}),n.hooks.destroy.tap(e.tag,function(){r.removeEventListener("touchstart",i,!0),r.removeEventListener("touchend",c,!0),r.removeEventListener("touchmove",u,!0),r.removeEventListener("touchcancel",s,!0),r.removeEventListener("mouseout",f,!0),r.removeEventListener("mouseover",a,!0),o.useNativeClickEvent&&r.removeEventListener("click",l,!0)})}}])}();s.tag="MobileInteraction";var v=function(e){function t(){var e,o,r,i;n(this,t);for(var c=arguments.length,l=Array(c),s=0;c>s;s++)l[s]=arguments[s];return o=this,r=t,i=[].concat(l),r=u(r),(e=f(o,a()?Reflect.construct(r,i||[],u(o).constructor):r.apply(o,i))).name="mobile-interaction",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),c(t,[{key:"init",value:function(){this.addRenderingPlugin(new s)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(t.AbstractRendererPlugin);e.Plugin=v}); //# sourceMappingURL=index.umd.min.js.map