-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
节点工具是否有鼠标事件监听,希望鼠标悬浮到节点工具上时,改变节点工具的背景颜色 #2577
Comments
@lloydzhou (。・∀・)ノ゙嗨,需要您的帮助。 现在的做法是去算节点工具的位置,通过cell:mousemove监听节点鼠标事件进入节点工具范围了 了就修改相关节点工具的markup ,是否有更好的办法来做这个事情,还是说只能通过自定义节点工具来增加mousemove方法 |
@NewByVector (。・∀・)ノ゙嗨,您能帮助我吗 |
https://codesandbox.io/s/proud-sea-uys8t4?file=/src/app.tsx
|
@lloydzhou |
@lloydzhou |
|
@lloydzhou (。・∀・)ノ゙嗨打扰了,自定义按钮后又爆出了新的问题 Uncaught TypeError: Cannot read property 'ToolItem' of undefined 我参照了 vitejs/vite#3413 |
@lloydzhou 老哥,我在自定义按钮时候碰到了类型的问题,我用自己定义的this.options.onMouseOver方法就会报类型错误,但是换成this.options.onClick就正常 |
然后有还有钉钉群可以进嘛,省的一直打扰您~ |
|
@695648896 这个问题解决了吗,我也遇到同样的问题 |
|
@695648896 主要是因为 cellview 在 ToolsView 里并且是 protected 因此到了 Button 后就变成了 private 这时就不能被 Button 的子类引用了。我的解决办法就是直接继承 ToolsView,即把 Button 的代码抄过来,改成MyButton |
你好,请问你是怎么在onMouseOver里改的背景色啊,我用了this.options.markup.attrs.fill = '#fff' 没好使,看到麻烦回复下,谢谢拉 |
|
你好,看代码你的onMouseOver是写在tools里的,想问下你是怎么做到写到tools里也能让onMouseOver好使的,而且看你代码,你的节点工具也不是自定义的节点工具,我在上面的例子中https://codesandbox.io/s/proud-sea-uys8t4?file=/src/app.tsx,在tools里直接用onMouseOver没好使,看到麻烦回复下,谢谢拉 |
/* eslint-disable @typescript-eslint/no-namespace */ export namespace MyButton { |
不好意思啊,再问下,你用的是X6是哪个版本啊,我按照你的写法来,结果报Class constructor Button cannot be invoked without 'new' ,我现在用的X6是1.34.5,看到麻烦回复下,谢谢拉 |
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread. |
问题描述
1.节点工具是否有onMove相关的鼠标事件监听,在源码中只看到了onClick
2.如何动态设置节点工具的attrs属性,用于改变背景颜色,
重现链接
https://codesandbox.io/s/proud-sea-uys8t4?file=/src/app.tsx:861-868
重现步骤
1.悬浮在节点工具上,无法获取hover或者mousemove事件
预期行为
鼠标悬浮到节点工具上时,可以改变节点工具的背景颜色
平台
Windows
屏幕截图或视频(可选)
No response
补充说明(可选)
No response
The text was updated successfully, but these errors were encountered: