henck / trizbort

This is a browser implementation of the Trizbort adventure game mapping and code generation software.
MIT License
24 stars 16 forks source link

Clicking on a connector dot makes a teeny tiny connector #82

Closed dfabulich closed 4 years ago

dfabulich commented 4 years ago

Create a room, hover its connector dots, and click on one.

Actual: It creates a tiny connector starting from the connector dot you clicked on, ending a few pixels away (attached to no room)

Expected: I don't know exactly what should happen when you click on a connector dot, but I think it could behave like the shift-arrow shortcut, which either creates a room in that direction, or it selects the room if one already exists.

henck commented 4 years ago

It shouldn't create anything at all, at the moment, though your expectation is a good one. I think it creates the tiny connector because your mouse moves a pixel or two, or it's just wrong behavior.

On Sun, May 10, 2020, 20:19 dfabulich notifications@github.com wrote:

Create a room, hover its connector dots, and click on one.

Actual: It creates a tiny connector starting from the connector dot you clicked on, ending a few pixels away (attached to no room)

Expected: I don't know exactly what should happen when you click on a connector dot, but I think it could behave like the shift-arrow shortcut, which either creates a room in that direction, or it selects the room if one already exists.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/henck/trizbort/issues/82, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACTAL5IEPTC5L5BANJZD74DRQ3V3TANCNFSM4M5LDJCQ .

dfabulich commented 4 years ago

I tried it a few times just now; it always create a tiny connector, even if you don't move your mouse at all.

jeremydouglass commented 4 years ago

it always create a tiny connector, even if you don't move your mouse at all

This happens for me as well.

henck commented 4 years ago

The reason you can drag a connector anywhere is because you can create connectors that are not connected to any room, but just lead off into space. However, the code should require that the mouse is dragged at least a few pixels before creating a connector, so this is a bug.

henck commented 4 years ago

When you click a connector dot, a new connector is created and you are now in "Connect" mode, and a new state is push onto the undo stack. When you let go of the mouse button, the the connector is left where it is and you go back to normal mode.

I've made a change: when you let go of the mouse button, the code checks the length of the connector. If it's under 5px, the connector is cancelled by popping the undo stack.