Skip to content

Commit

Permalink
10.2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ironmonk88 committed Sep 26, 2022
1 parent b25d833 commit 6517ee3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Version 10.2

Fixed issues with checking if the terrain contains a point.

# Version 10.1

Fixed issue with migrating to v10.
Expand Down
2 changes: 1 addition & 1 deletion classes/terraininfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class PolygonTerrainInfo extends TerrainInfo {
}

get shape() {
return this.terrain.shape;
return this.terrain._pixishape;

This comment has been minimized.

Copy link
@lucasmiranda2711

lucasmiranda2711 Sep 26, 2022

Shouldn't this line goes like this.terrain.shape._pixishape? (Getting an undefined on v10.2 due to this);

This comment has been minimized.

Copy link
@ironmonk88

ironmonk88 Sep 26, 2022

Author Owner

Already fixed in 10.3. :-)

}
}

Expand Down
23 changes: 23 additions & 0 deletions classes/terrainshape.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,29 @@ export class TerrainShape extends DrawingShape {
this.setPosition();
}

get _pixishape() {
let shape;
switch (this.document.shape.type) {
case Drawing.SHAPE_TYPES.RECTANGLE:
shape = new PIXI.Rectangle(this.x, this.y, this.width, this.height);
break;
case Drawing.SHAPE_TYPES.ELLIPSE:
shape = new PIXI.Ellipse(this.x, this.y, this.width / 2, this.height / 2);
break;
case Drawing.SHAPE_TYPES.POLYGON:
shape = new PIXI.Polygon(this.document.shape.points);
break;
}
return shape;
}

contains(x, y) {
let shape = this._pixishape;
if (shape)
return shape.contains(x, y);
return false;
}

/* -------------------------------------------- */

/**
Expand Down
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "Enhanced Terrain Layer",
"description": "A base module that adds a Terrain Layer to Foundry. Used as a library for Rulers and other modules",
"version": "10.1",
"version": "10.2",
"authors": [
{
"name": "IronMonk",
Expand Down Expand Up @@ -47,7 +47,7 @@
"css/terrainlayer.css"
],
"url": "https://github.com/ironmonk88/enhanced-terrain-layer",
"download": "https://github.com/ironmonk88/enhanced-terrain-layer/archive/10.1.zip",
"download": "https://github.com/ironmonk88/enhanced-terrain-layer/archive/10.2.zip",
"manifest": "https://github.com/ironmonk88/enhanced-terrain-layer/releases/latest/download/module.json",
"bugs": "https://github.com/ironmonk88/enhanced-terrain-layer/issues",
"allowBugReporter": true,
Expand Down

0 comments on commit 6517ee3

Please sign in to comment.