npm.io
2.1.3 • Published 1 week ago

@antv/g-plugin-gesture

Licence
MIT
Version
2.1.3
Deps
3
Size
158 kB
Vulns
0
Weekly
0
Stars
1.2K

@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);
});

Keywords