Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

调用addItem方法报错:p.getType is not a function #1613

Closed
jason1ee opened this issue May 27, 2020 · 8 comments
Closed

调用addItem方法报错:p.getType is not a function #1613

jason1ee opened this issue May 27, 2020 · 8 comments
Labels

Comments

@jason1ee
Copy link

image

@yfzm01
Copy link

yfzm01 commented May 29, 2020

我也遇到这个问题,然后把onClick方法稍微改动就可以了,改黑色粗体部分
this.edge = graph.addItem('edge', {
source: model.id,
target: model.id
});

@jason1ee
Copy link
Author

我也遇到这个问题,然后把onClick方法稍微改动就可以了,改黑色粗体部分
this.edge = graph.addItem('edge', {
source: model.id,
target: model.id
});

我这里的需求是想实现用鼠标点击连线,按照g6曾经的demo示例是给target一个坐标实现的。但现在g6 3.5版本不支持target传入坐标了,传入id是可以的。

@yfzm01
Copy link

yfzm01 commented May 29, 2020

@jason1ee 你按我的方法改,可以实现同样的需求

@Yanyan-Wang
Copy link
Contributor

@SagittariusZhu
Copy link

src/graph/controller/item.ts

if (target.getType() === 'combo') model.isComboEdge = true
当target为点坐标时报错,只能设置为和source一样的ID,不知道是故意的还是bug,但导致gg-editor的behavior用不了了。

@yfzm01
Copy link

yfzm01 commented May 30, 2020

@SagittariusZhu 既然updateItem的target可以指定为坐标,那么addItem的target也应该可以指定为坐标,所以应该是一个bug

@Yanyan-Wang
Copy link
Contributor

下个小版本修复

@Yanyan-Wang
Copy link
Contributor

3.5.1 已修复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants