erikbroo / dungeon-sketch

Automatically exported from code.google.com/p/dungeon-sketch
0 stars 0 forks source link

Snap tokens to grid #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Feature work.

Original issue reported on code.google.com by tim.bo...@gmail.com on 6 Jun 2011 at 5:31

GoogleCodeExporter commented 8 years ago
-Should snap to the nearest "snap point" if within n pixels of it in screen 
space (NOT world space).  Maybe try n=5?

If token radius <n in screen space, then n=token radius.

Snap points in world space are <x + r/2, y + r/2>, where <x, y> is the 
coordinate of a grid intersection and r is the radius of the token being 
snapped.  With a standard token (r=1) this will snap to the grid square 
centroid.

Note that this allows a token to snap to a subgrid if it is a small size, and 
allows a larger-sized token to snap correctly such that it occupies multiple 
squares equally (i.e. a token of diameter 2 should snap to a grid point, not a 
centroid).

Original comment by tim.bo...@gmail.com on 7 Jun 2011 at 8:09

GoogleCodeExporter commented 8 years ago

Original comment by tim.bo...@gmail.com on 8 Jun 2011 at 4:23