Graphin icon indicating copy to clipboard operation
Graphin copied to clipboard

G6有 create-edge 内置的 Behavior,但是 Graphin 没有

Open ZangYuSong opened this issue 3 years ago • 6 comments

Graphin 版本:2.0.7

描述:G6有 create-edge 内置的 Behavior,但是 Graphin 没有

下边是我自己写(勿喷):

import { FC } from 'react'
import useBehaviorHook from '@antv/graphin/es/behaviors/useBehaviorHook'
import { EdgeConfig, GraphEvent } from '@antv/graphin'

interface IConfig {
  disabled?: boolean
  trigger?: 'click' | 'drag'
  bindKey?: 'shift' | 'ctrl' | 'control' | 'alt' | 'meta'
  edgeConfig?: EdgeConfig
  shouldBegin?: (e: GraphEvent) => void
  shouldEnd?: (e: GraphEvent) => void
}

const defaultConfig = {
  disabled: false,
}

const CreateEdge: FC<IConfig> = ({ bindKey, ...other }) => {
  useBehaviorHook({
    type: 'create-edge',
    userProps: { ...other, key: bindKey },
    defaultConfig,
  })
  return null
}

export default CreateEdge

ZangYuSong avatar Jun 17 '21 02:06 ZangYuSong

突然发现他在,分析组件内部。

ZangYuSong avatar Jun 21 '21 02:06 ZangYuSong

试了下,Graphin 内置的功能太少了。不如G6 的功能。没有 trigger bindKey shouldBegin shouldEnd 这些功能。能否丰富一下。或者说本身支持只是没有相关的用法示例,麻烦提供一下

ZangYuSong avatar Jun 21 '21 02:06 ZangYuSong

@ZangYuSong 升级Graphin到最新的2.1.0,里面依赖的G6的最新版本4.3.4,通过context可以拿到G6的实例,更多的功能可以自定义组件实现,比如CreateEdge DEMO

pomelo-nwu avatar Jul 14 '21 07:07 pomelo-nwu

@pomelo-nwu That demo link doesn't seem to work anymore, is there an updated one? I'm also seeing the code for Create-Edge in the repo but not in the documentation site and I don't see it showing up when I go to consume the package. The create-edge functionality is one of our major requirements for adoption and this library seems really great so I'd love to use it if we can figure that part out. image image

msnyder-msft avatar Mar 06 '23 18:03 msnyder-msft

@msnyder-msft We were going to drop the @antv/graphin-components package because only components that bind to a specific UI component library will do the job better. For example: https://insight.antv.antgroup.com/#/open/assets-list?assetKey=FilterPanel there are nearly 60 analysis components here.

so we put the non-UI components that only rely on G6 canvas rendering and interaction in graphin/src/components, the migration process may have missed some components, createEdge should be among them.

pomelo-nwu avatar May 28 '23 07:05 pomelo-nwu

增加 CreateEdge 并且文档中做出说明

pomelo-nwu avatar May 28 '23 07:05 pomelo-nwu