What I do is to make a grid of named rectangles (they may or may not be visible). I put the names of these into a variable or an array. On mouseUp I traverse the variabel/array to check if the mouseLoc is within any of the rectangles. When there is a match I set the loc of the grabbed control to the loc of the matching rectangle.
Regards Tore Nilsen > 7. apr. 2020 kl. 21:24 skrev Roger Guay via use-livecode > <use-livecode@lists.runrev.com>: > > Hi all, > > I know there must be a simple way to do this but it is escaping me at the > moment. How can I move an object (grab me on mouseDown) and have it snap to a > grid (square on a board game) on mouseUp? > > Thanks much, > > Roger > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode