Skip to content

Commit

Permalink
Merge branch 'release/0.6.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
caewok committed Apr 7, 2023
2 parents 0b86adb + 4900c94 commit fde38fc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion scripts/geometry
Submodule geometry updated 2 files
+40 −8 3d/Ray3d.js
+4 −0 Changelog.md
6 changes: 4 additions & 2 deletions scripts/ruler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() });
Expand All @@ -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() });
Expand Down
5 changes: 3 additions & 2 deletions scripts/terrain_elevation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit fde38fc

Please sign in to comment.