Compare commits

...

3 Commits

Author SHA1 Message Date
Manuel Vögele 52b64c3016 Release v1.13.6 2023-06-12 22:22:54 +02:00
Manuel Vögele 48d0d17628 Use canvas.scene.grid.type instead of cnavas.scene.gridType (which is undefined since v10) (fixes #272) 2023-06-12 22:21:19 +02:00
Manuel Vögele 8101381cc4 Remove redundant & broken code path in _computeDistance (fixes #280) 2023-06-12 21:40:04 +02:00
4 changed files with 26 additions and 26 deletions
+6
View File
@@ -1,3 +1,9 @@
## 1.13.6
### Bugfixes
- Fixed a bug that caused no measurements to be shown next to the ruler
- Fixed a bug where diagonal paths would sometimes highlight squares that don't blong to the path on square maps
## 1.13.5 ## 1.13.5
### Compatibility ### Compatibility
- Drag Ruler is now compatible with Foundry VTT v11 (thanks to pkonshik for doing much of the porting work!) - Drag Ruler is now compatible with Foundry VTT v11 (thanks to pkonshik for doing much of the porting work!)
+3 -3
View File
@@ -2,7 +2,7 @@
"id": "drag-ruler", "id": "drag-ruler",
"title": "Drag Ruler", "title": "Drag Ruler",
"description": "When dragging a token displays a ruler showing how far you've moved that token.", "description": "When dragging a token displays a ruler showing how far you've moved that token.",
"version": "1.13.5", "version": "1.13.6",
"compatibility": { "compatibility": {
"minimum": "11", "minimum": "11",
"verified": "11" "verified": "11"
@@ -80,10 +80,10 @@
}, },
"socket": true, "socket": true,
"url": "https://github.com/manuelVo/foundryvtt-drag-ruler", "url": "https://github.com/manuelVo/foundryvtt-drag-ruler",
"download": "https://github.com/manuelVo/foundryvtt-drag-ruler/archive/v1.13.5.zip", "download": "https://github.com/manuelVo/foundryvtt-drag-ruler/archive/v1.13.6.zip",
"manifest": "https://raw.githubusercontent.com/manuelVo/foundryvtt-drag-ruler/master/module.json", "manifest": "https://raw.githubusercontent.com/manuelVo/foundryvtt-drag-ruler/master/module.json",
"readme": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/README.md", "readme": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/README.md",
"changelog": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/CHANGELOG.md", "changelog": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/CHANGELOG.md",
"bugs": "https://github.com/manuelVo/foundryvtt-drag-ruler/issues", "bugs": "https://github.com/manuelVo/foundryvtt-drag-ruler/issues",
"allowBugReporter": true "allowBugReporter": true
} }
+1 -1
View File
@@ -185,7 +185,7 @@ export function highlightMeasurementNative(
tokenShape = [{x: 0, y: 0}], tokenShape = [{x: 0, y: 0}],
alpha = 1, alpha = 1,
) { ) {
const spacer = canvas.scene.gridType === CONST.GRID_TYPES.SQUARE ? 1.41 : 1; const spacer = canvas.scene.grid.type === CONST.GRID_TYPES.SQUARE ? 1.41 : 1;
const nMax = Math.max( const nMax = Math.max(
Math.floor(ray.distance / (spacer * Math.min(canvas.grid.w, canvas.grid.h))), Math.floor(ray.distance / (spacer * Math.min(canvas.grid.w, canvas.grid.h))),
1, 1,
+16 -22
View File
@@ -262,29 +262,23 @@ export function extendRuler() {
if (!this.isDragRuler) { if (!this.isDragRuler) {
return super._computeDistance(gridSpaces); return super._computeDistance(gridSpaces);
} }
if (!this.dragRulerEnableTerrainRuler) { const shape = this.draggedEntity ? getTokenShape(this.draggedEntity) : null;
if (!this.dragRulerIgnoreGrid) { const options = {
gridSpaces = true; ignoreGrid: this.dragRulerIgnoreGrid,
} gridSpaces,
super._computeDistance(gridSpaces); enableTerrainRuler: this.dragRulerEnableTerrainRuler,
} else { };
const shape = this.draggedEntity ? getTokenShape(this.draggedEntity) : null; const distances = measureDistances(this.segments, this.draggedEntity, shape, options);
const options = { let totalDistance = 0;
ignoreGrid: this.dragRulerIgnoreGrid, for (const [i, d] of distances.entries()) {
gridSpaces, let s = this.segments[i];
enableTerrainRuler: this.dragRulerEnableTerrainRuler, s.startDistance = totalDistance;
}; totalDistance += d;
const distances = measureDistances(this.segments, this.draggedEntity, shape, options); s.last = i === this.segments.length - 1;
let totalDistance = 0; s.distance = d;
for (const [i, d] of distances.entries()) { s.text = this._getSegmentLabel(s, totalDistance);
let s = this.segments[i];
s.startDistance = totalDistance;
totalDistance += d;
s.last = i === this.segments.length - 1;
s.distance = d;
s.text = this._getSegmentLabel(s, totalDistance);
}
} }
for (const [i, segment] of this.segments.entries()) { for (const [i, segment] of this.segments.entries()) {
const unsnappedSegment = this.dragRulerUnsnappedSegments[i]; const unsnappedSegment = this.dragRulerUnsnappedSegments[i];
unsnappedSegment.startDistance = segment.startDistance; unsnappedSegment.startDistance = segment.startDistance;