Is there a parameter that controls piece "snap" distance? #70
-
I've noticed that some of the demonstration puzzles enjoy a fairly large "snap" distance. What I mean is if I move a piece to within say 1/16th of an inch of another piece that fits the piece I moved "snaps" into place upon mouseup. Mine, on that other hand, suffer from almost no "snap" and remain frustratingly hard to put together especially on a mobile phone device involving the use of fingertips as large or larger than the piece diameter. Is there a parameter available which dictates the distance that would trigger "snap"? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
👋 Hi @JeffroDB! Have you tried to tune the new headbreaker.Canvas('...', {
width: 500,
height: 300,
proximity: 20 // <---
}); Larger values make more distante pieces to the get connected. The exact value you will need largely depends on your pieces size. Hope that helps! |
Beta Was this translation helpful? Give feedback.
Hi! 👋
The function of
proximity
is to control the minimum distance between two pieces inserts that make them get connected, so increasing the proximity is definitely the way to go. E.g. your snippet here shows a proximity of ~2% of the piece size, while in the examples provided it is usually between 10 and 20%.That said, yes, it is true that
proximity
also controls shuffle. It is intentional, because otherwise puzzle would get connected just after shuffling, or even after a minimal movement. So you might try to change proximity manually after shuffling the canvas, but it won't probably work as expected. Also, canvas are not designed to mutate proximity after intialization, but I haven't …