How to move a puzzle piece in the middle? #45
-
After the puzzle is almost solved, how can we remove a piece in the middle? If I click on a middle piece (surrounded by all 4 sides), then the whole puzzle structure is moved, which is not what is expected. Expected - remove that selected puzzle piece and be draggable. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hi!👋 That behavior is actually by design, in order to allow all operations - drag group, connect pieces, push pieces, disconnect pieces - simple in terms of gestures. However I know that may not not cover all use cases. For example, we could use the alt or control key to tell that user wants to disconnect the piece - at the cost of a more complex set of user commands. Or perhaps implement a whole new gesture. But, in any case, that is not supported out of the box. You'll need to implement by yourself at the Konva layer. Here #42 there is a code sample that shows how to access the figures - the visual objects on top of the puzzle model. You could try to disconnect the pieces as part of the drag event, on a condition of your preference. Just ask back if you need more assistance with it! 😁 |
Beta Was this translation helpful? Give feedback.
-
PS: I have made some progress with integrating those ideas into the core code. See here #47. |
Beta Was this translation helpful? Give feedback.
-
I have just released a new version of You can find more details here: Lines 336 to 357 in d015591 |
Beta Was this translation helpful? Give feedback.
I have just released a new version of
headbreaker
that ships with that functionality. You can check it here: https://flbulgarelli.github.io/headbreaker/#keyboard-gestures.You can find more details here:
headbreaker/src/canvas.js
Lines 336 to 357 in d015591