wgge 1.0.17 → 1.0.18

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.
@@ -153,6 +153,21 @@ export default class Vector2 extends ObjectModel {
153
153
  return Math.max(distX, distY) <= size;
154
154
  }
155
155
 
156
+ getDirectNeighborPositions(position, includeCenter = false) {
157
+ const positions = [];
158
+ if (includeCenter) positions.push(position);
159
+ positions.push(new Vector2(position.x - 1, position.y));
160
+ positions.push(new Vector2(position.x, position.y - 1));
161
+ positions.push(new Vector2(position.x + 1, position.y));
162
+ positions.push(new Vector2(position.x, position.y + 1));
163
+ return positions;
164
+ }
165
+
166
+ isDirectNeighborPosition(position, includeCenter = false) {
167
+ if (!this.isNeighborPosition(position, 1, includeCenter)) return false;
168
+ return (this.x === position.x || this.y === position.y);
169
+ }
170
+
156
171
  getClosest(positions) {
157
172
  if ((!positions) || positions.length === 0) return null;
158
173
  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.17",
3
+ "version": "1.0.18",
4
4
  "description": "Web GL Game Engine",
5
5
  "main": "index.js",
6
6
  "devDependencies": {