wgge 1.0.16 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -144,6 +144,15 @@ export default class Vector2 extends ObjectModel {
144
144
  return neighbors;
145
145
  }
146
146
 
147
+ isNeighborPosition(position, size = 1, includeCenter = false) {
148
+ const distX = Math.abs(this.x - position.x);
149
+ const distY = Math.abs(this.y - position.y);
150
+ if (distX === 0 && distY === 0) {
151
+ return includeCenter;
152
+ }
153
+ return Math.max(distX, distY) <= size;
154
+ }
155
+
147
156
  getClosest(positions) {
148
157
  if ((!positions) || positions.length === 0) return null;
149
158
  if (positions.length === 1) return positions[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wgge",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "Web GL Game Engine",
5
5
  "main": "index.js",
6
6
  "devDependencies": {