diff --git a/Changelog.md b/Changelog.md index 01b831e..b5984a3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,8 @@ +# 0.6.6 +Update geometry lib to v0.1.5. Fix for incorrect diagonal measurement in grids (issue #3). Issue with dnd5e may still result in questionable rounded values when measuring Euclidean distances and 5/10/5 measurements on hex maps. See https://github.com/foundryvtt/dnd5e/issues/2257 and https://github.com/foundryvtt/dnd5e/issues/2256. +Fix for updating ruler elevation label on gridless maps when increasing or decreasing elevation. +Fix for measuring elevation for terrains created by Enhanced Terrain Elevation (issues #8, #15). + # 0.6.5 Update geometry lib to v0.1.4. diff --git a/scripts/geometry b/scripts/geometry index 69beb1a..24d14f7 160000 --- a/scripts/geometry +++ b/scripts/geometry @@ -1 +1 @@ -Subproject commit 69beb1a3060bfd451f717544bbc1de1af33451ea +Subproject commit 24d14f72f2b0dbbe36fed19689e76855c1681550 diff --git a/scripts/ruler.js b/scripts/ruler.js index 05f8cc7..0fdd8a0 100644 --- a/scripts/ruler.js +++ b/scripts/ruler.js @@ -152,8 +152,9 @@ export function incrementElevation() { ruler._userElevationIncrements += 1; // Weird, but slightly change the destination to trigger a measure + const destination = { x: this.destination.x, y: this.destination.y }; this.destination.x -= 1; - ruler.measure(this.destination); + ruler.measure(destination); // Broadcast the activity (see ControlsLayer.prototype._onMouseMove) game.user.broadcastActivity({ ruler: ruler.toJSON() }); @@ -167,8 +168,9 @@ export function decrementElevation() { ruler._userElevationIncrements -= 1; // Weird, but slightly change the destination to trigger a measure + const destination = { x: this.destination.x, y: this.destination.y }; this.destination.x -= 1; - ruler.measure(this.destination); + ruler.measure(destination); // Broadcast the activity (see ControlsLayer.prototype._onMouseMove) game.user.broadcastActivity({ ruler: ruler.toJSON() }); diff --git a/scripts/terrain_elevation.js b/scripts/terrain_elevation.js index fd27fa0..079f0fd 100644 --- a/scripts/terrain_elevation.js +++ b/scripts/terrain_elevation.js @@ -185,8 +185,9 @@ function TerrainLayerElevationAtPoint({x, y}) { // must account for possibility of // TO-DO: Allow user to ignore certain terrain types? let terrain_max_elevation = terrains.reduce((total, t) => { - if ( !isFinite(t.max) ) return total; - return Math.max(total, t.max); + const elevation = t.document?.elevation; + if ( !isFinite(elevation) ) return total; + return Math.max(total, elevation); }, Number.NEGATIVE_INFINITY); // In case all the terrain maximums are infinite.