delph-in / delphin-viz

JavaScript visualizations of various DELPH-IN structures.
http://delph-in.github.io/delphin-viz/demo/
MIT License
15 stars 4 forks source link

Highlight when hovering variable on mrs.js doesn't have memory #7

Open yfaria opened 3 years ago

yfaria commented 3 years ago

I am implementing a web page that is built upon mrs.js for reimplementing the WSI interface (https://github.com/own-pt/wql/tree/demo/flask-demo). I need to highlight the matches that are relative to the pattern that matched and I still want to keep the highlighting of all variables of same name when hovering the variable name. The problem is that the code of the event mouseleave is harcoded to put every variable highlighted to black, overwriting my highlight of the matches. I can create a new event listener to solve this problem, but wouldn't it the be better if the code natively had this support to place the old color instead of always putting the same color?

goodmami commented 3 years ago

That sounds like a useful improvement. Note that mrs.js and dmrs.js were developed separately by different people. I wrote dmrs.js so that hovering on a node highlights it and things it's connected to (similar to how mrs.js works), but also you can click a node to make the highlighting persistent. Clicking another node highlights that one instead. To clear highlighting, you click on the highlighted node again, but it's not obvious that it's been cleared until you move the cursor away from the node.

I think such a system for mrs.js sounds useful and I think we would accept a pull request that accomplishes that. Or you may have some better idea, which would also be welcome.

arademaker commented 3 years ago

Thank you @goodmami, @yfaria is working with me. We will make our best to contribute to this repo considering the changes we may need for our use case (wsi interface)