dikalo / lienzo-core

Lienzo Structure Graphics GWT Toolkit
Apache License 2.0
51 stars 58 forks source link

Issue#153 - Improve connectors selection. #154

Closed romartin closed 7 years ago

romartin commented 7 years ago

Hey @SprocketNYC , @manstis @hasys ,

See this issue.

Current problem It results difficult to fire the different human events on lines that are using a small stroke width value. It applies for any line type, although right now the ones we're interested on are OrtogonalPolylines, as are the ones supported in our Wires implementation.

Proposed solution Right now we're only using the OrtogonalPolylines for Wires, so just added this in that class. What you think about this solution? Does really makes sense overriding the fillBoundingBoxForSelection stuff for this?

The idea is instead of filling the BoundingBox (which is huge for ortogonal polylines), it fills several rectangles, one for each "line", so the resulting selection is more accurate.

PS: It works nice on the other hand. You can adjust the bounding box "offset" by calling setSelectionBoundingBoxOffset too. On the other hand this fix is only applicable for ortogonal polylines at this point.

hasys commented 7 years ago

Hi @romartin, how can I test this PR?

romartin commented 7 years ago

This feature can be tested/used as: OrtogonalPolyline line = .... line.setSelectionBoundingBoxOffset(50).setFillBoundsForSelection(true); So you can add for example a mouse click handler to check how it works: line.addNodeMouseClickHandler(new NodeMouseClickHandler() { @Override public void onNodeMouseClick(NodeMouseClickEvent event) { GWT.log("YEAH CLICKK"); } });

hasys commented 7 years ago

Hi @romartin, @SprocketNYC I pushed PR https://github.com/ahome-it/lienzo-ks/pull/21 to manually test this changes. I don't know why, but sometimes lines not selectable, or selectable just in corners. You can try it by changing Line Width / Selection Boundaries (using appropriate TextBoxes)

romartin commented 7 years ago

Closing as this solution is not valid.