logo

G

  • Tutorials
  • API
  • Examples
  • Plugins
  • Productsantv logo arrow
  • 6.1.26
  • Introduction to the plug-in system
  • 插件结构
  • g-plugin-a11y
  • g-plugin-annotation
  • g-plugin-box2d
  • g-plugin-gpgpu
  • g-plugin-matterjs
  • g-plugin-yoga
  • g-plugin-css-select
  • g-plugin-3d
  • g-plugin-device-renderer
  • g-plugin-canvas-renderer
  • g-plugin-canvaskit-renderer
  • g-plugin-rough-canvas-renderer
  • g-plugin-rough-svg-renderer
  • g-plugin-canvas-path-generator
  • g-plugin-canvas-picker
  • g-plugin-svg-renderer
  • g-plugin-svg-picker
  • g-plugin-dom-interaction
  • g-plugin-dragndrop
  • g-plugin-control

g-plugin-canvas-picker

Previous
g-plugin-canvas-path-generator
Next
g-plugin-svg-renderer

Resource

Ant Design
Galacea Effects
Umi-React Application Framework
Dumi-Component doc generator
ahooks-React Hooks Library

Community

Ant Financial Experience Tech
seeconfSEE Conf-Experience Tech Conference

Help

GitHub
StackOverflow

more productsMore Productions

Ant DesignAnt Design-Enterprise UI design language
yuqueYuque-Knowledge creation and Sharing tool
EggEgg-Enterprise-class Node development framework
kitchenKitchen-Sketch Tool set
GalaceanGalacean-Interactive solution
xtechLiven Experience technology
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

Provides Canvas2D-based pickup capabilities.

Usage

The g-canvas renderer is built in by default, so there is no need to introduce it manually.

import { Renderer as CanvasRenderer } from '@antv/g-canvas';
// Create a renderer with the plugin built in
const canvasRenderer = new CanvasRenderer();

Principle of implementation

Pickups based on the Canvas2D API implementation.

  1. Use the R-Tree spatial index to find a series of graph bounding boxes hit by a pickup point
  2. Find the topmost graph among these graphs, based on the z-index
  3. Use mathematical calculations to determine precisely whether the figure is hit or miss, e.g. Circle measures whether the distance to the center of the circle is less than the radius

The solution is CPU-based, so the optimization point is whether the enclosing box intersection operation is fast enough.