snozbot / fungus

An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
MIT License
1.59k stars 291 forks source link

Fix visual bug when dragging blocks with FungusEditorPreferences.useGridSnap enabled #972

Closed ongjinwen closed 1 year ago

ongjinwen commented 3 years ago

Description

Minor refactoring to fix visual bug when FungusEditorPreferences.useGridSnap is enabled.

What is the current behavior?

When FungusEditorPreferences.useGridSnap is enabled, labels and connections do not follow the snapped position of block._NodeRect. Apparently, this change also fixes the snap width when scrolling.

What is the new behavior?

stevehalliwell commented 3 years ago

Thanks for the PR.

Clarifying, the minor, purely visual bug mentioned is the connecting lines not matching perfectly the snap point during while user is dragging.

Having looked at the severity of the issue and the changes to the code, I'm going to remove this from the current bugfix. I'll return to it soon. At that time I'll most likely merge it in and then make changes to the solution here to remove the need for the dictonary, as it makes the source of truth for block positions unclear and makes future work more error prone.