I'm implementing a task relative to draw the diagram. It requires that when the user hovers on a cell of the diagram, it will highlight all preceding and subsequent of that cell and links. I found just how to highlight one element by clicking it. And not sure can I highlight links. Is it possible to do?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
Links and elements inherit from cell. Cells are backbone models that have associated cellViews. The cellView is a backbone view, where the highlight method resides. LinkView is the specific view for links, it inherits from CellView. CellViews default 'highlight' method works fine for rectangular cells, but for links it's not so good as the highlight is a right angle rectangle bounding box around the entire link.
The highlight method takes two parameters, the second of which allows you to specify the type of highlight. This is documented here. One of the 'types' allowed is where you can specify a css class. You can define a class, and specify it here.
If that isn't enough, another option would be to extend linkView, and implement your own 'highlight' methods on that. Then provide this new linkView to the paper constructor as a template.
I have solved it in this way: