How to use the @antv/dom-util/lib/add-event-listener function in @antv/dom-util

To help you get started, we’ve selected a few @antv/dom-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G6 / src / graph / controller / event.ts View on Github external
private initEvents() {
    const self = this
    const graph = this.graph;
    const canvas = graph.get('canvas');
    const el = canvas.get('el');
    const extendEvents = this.extendEvents;
    const canvasHandler: Fun = wrapBehavior(self, 'onCanvasEvents') as Fun;
    const originHandler = wrapBehavior(self, 'onExtendEvents');
    const wheelHandler = wrapBehavior(self, 'onWheelEvent');
    each(EVENTS, event => {
      canvas.on(event, canvasHandler);
    });
    this.canvasHandler = canvasHandler;
    extendEvents.push(addEventListener(el, 'DOMMouseScroll', wheelHandler));
    extendEvents.push(addEventListener(el, 'mousewheel', wheelHandler));
    if (typeof window !== 'undefined') {
      extendEvents.push(addEventListener(window as any, 'keydown', originHandler));
      extendEvents.push(addEventListener(window as any, 'keyup', originHandler));
    }
  }
github antvis / G6 / src / graph / controller / event.ts View on Github external
const graph = this.graph;
    const canvas = graph.get('canvas');
    const el = canvas.get('el');
    const extendEvents = this.extendEvents;
    const canvasHandler: Fun = wrapBehavior(self, 'onCanvasEvents') as Fun;
    const originHandler = wrapBehavior(self, 'onExtendEvents');
    const wheelHandler = wrapBehavior(self, 'onWheelEvent');
    each(EVENTS, event => {
      canvas.on(event, canvasHandler);
    });
    this.canvasHandler = canvasHandler;
    extendEvents.push(addEventListener(el, 'DOMMouseScroll', wheelHandler));
    extendEvents.push(addEventListener(el, 'mousewheel', wheelHandler));
    if (typeof window !== 'undefined') {
      extendEvents.push(addEventListener(window as any, 'keydown', originHandler));
      extendEvents.push(addEventListener(window as any, 'keyup', originHandler));
    }
  }
github antvis / G6 / src / graph / controller / event.ts View on Github external
private initEvents() {
    const self = this
    const graph = this.graph;
    const canvas = graph.get('canvas');
    const el = canvas.get('el');
    const extendEvents = this.extendEvents;
    const canvasHandler: Fun = wrapBehavior(self, 'onCanvasEvents') as Fun;
    const originHandler = wrapBehavior(self, 'onExtendEvents');
    const wheelHandler = wrapBehavior(self, 'onWheelEvent');
    each(EVENTS, event => {
      canvas.on(event, canvasHandler);
    });
    this.canvasHandler = canvasHandler;
    extendEvents.push(addEventListener(el, 'DOMMouseScroll', wheelHandler));
    extendEvents.push(addEventListener(el, 'mousewheel', wheelHandler));
    if (typeof window !== 'undefined') {
      extendEvents.push(addEventListener(window as any, 'keydown', originHandler));
      extendEvents.push(addEventListener(window as any, 'keyup', originHandler));
    }
  }
github antvis / G6 / src / graph / controller / event.ts View on Github external
const self = this
    const graph = this.graph;
    const canvas = graph.get('canvas');
    const el = canvas.get('el');
    const extendEvents = this.extendEvents;
    const canvasHandler: Fun = wrapBehavior(self, 'onCanvasEvents') as Fun;
    const originHandler = wrapBehavior(self, 'onExtendEvents');
    const wheelHandler = wrapBehavior(self, 'onWheelEvent');
    each(EVENTS, event => {
      canvas.on(event, canvasHandler);
    });
    this.canvasHandler = canvasHandler;
    extendEvents.push(addEventListener(el, 'DOMMouseScroll', wheelHandler));
    extendEvents.push(addEventListener(el, 'mousewheel', wheelHandler));
    if (typeof window !== 'undefined') {
      extendEvents.push(addEventListener(window as any, 'keydown', originHandler));
      extendEvents.push(addEventListener(window as any, 'keyup', originHandler));
    }
  }