Package detail

@antv/g-plugin-gesture

antvis976MIT2.0.36

A G plugin for Gesture implemented with PointerEvents

antv, g

readme

@antv/g-plugin-gesture

Getting Started

Create and register plugin in renderer.

import { Renderer } from '@antv/g-canvas';
import { Plugin } from '@antv/g-plugin-gesture';

const plugin = new Plugin();
const renderer = new Renderer();
renderer.registerPlugin(plugin);

Enable gesture with gestureEnabled in style.

const circle = new Circle({
    style: {
        cx: 200,
        cy: 200,
        r: 100,
        fill: 'blue',
        gestureEnabled: true,
    },
});

Then we can listen gesture event such as press on plugin:

canvas.addEventListener('press', (e) => {
    console.log(e.target);
});