JasperJeuken / QNodeEditor

Node editor for PyQt5
BSD 3-Clause "New" or "Revised" License
20 stars 4 forks source link

The clickable area of the horizontal lines between nodes is too small. #20

Open Cassianvale opened 1 month ago

Cassianvale commented 1 month ago

https://github.com/user-attachments/assets/eb258305-6ab2-41d3-9d4f-2370cd3d2c78

Cassianvale commented 1 month ago

It would be great if the selected markers could be made more noticeable.

JasperJeuken commented 1 month ago

I think this is due to the way Qt calculates whether a point is on the line path. It might be possible to add an invisible stroke to the lines that count as their shape to make it easier to select them

JasperJeuken commented 1 month ago

It seems indeed the path shape as calculated by Qt is not accurate enough. Instead, generating a shape with a stroke around the original path fixes the issue:

stroker = QPainterPathStroker()
stroker.setWidth(10)  # can adjust the hoverable range around the line
hover_path = stroker.createStroke(path)

https://github.com/user-attachments/assets/46fa1ad6-f1f5-4792-96df-2c565aee175d

JasperJeuken commented 1 month ago

Merged into dev, next release will contain the changes