You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I often find myself looking at Grid to check whether a position is in bounds. (Grid.isInBounds)
However, if the appropriate Grid is not available, this feels wasteful, since isInBounds is a function of width and height, but not the grid itself (which contains a 2d array). It would be nice to create a Dimensions class that owns height and width and can do any calculations based on these.
// when a grid exists
grid.dims.isInBounds({ x: 1, y: 2});
// or when an appropriate grid does not exist
const dims = new Dimensions(3, 4); // no array created :D
dims.isInBounds({ x: 1, y: 2});
The text was updated successfully, but these errors were encountered:
I often find myself looking at
Grid
to check whether a position is in bounds. (Grid.isInBounds)However, if the appropriate Grid is not available, this feels wasteful, since isInBounds is a function of width and height, but not the grid itself (which contains a 2d array). It would be nice to create a
Dimensions
class that owns height and width and can do any calculations based on these.Before
After
The text was updated successfully, but these errors were encountered: