diff --git a/README.md b/README.md index 0e25c42..e388b81 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ It adds additional labels for the metric measurements to your ruler. It is not c ## NEW --- NEW --- NEW You can now add your [Customizable Measurement Conversions](#customizable-conversions) and [Travel times](#travel-times) if you want :) Have fun! -Compatability with V11!!! +Compatability with V12!!! ## V12 - Compatability The latest version is compatible with V12. If you find problems with future subversions of V12, then please let me know. @@ -109,6 +109,11 @@ Nothing yet. Feel free to recommend enhancements. If you find a bug or have any feedback for me just add an issue in the [issuetracker](https://github.com/Roger92/metric-ruler-labels/issues). Thx alot and i hope this module helps you in your game :) ## Changelog +**v3.2.0** +- Compatibility for PF2e Token Drag Ruler (and build in Drag Ruler of the pathfinder system) +- Italian Language Support (Thx to GregoryWarn) +- Fixed warning for unsupported manifest field + **v3.2.0** - V12 Compatibility diff --git a/languages/de.json b/languages/de.json index 6da778b..340bcec 100644 --- a/languages/de.json +++ b/languages/de.json @@ -5,6 +5,10 @@ "name": "Anzeige bei DragRuler", "hint": "Falls aktiviert, werden zusätzliche metrische Angaben bei Benutzung des Moduls DragRuler (by Stäbchenfisch) angezeigt. (Änderung nach Neuladen aktiv)" }, + "pf2eDragRulerSupport": { + "name": "Anzeige bei PF2e Token Drag Ruler", + "hint": "Falls aktiviert, werden zusätzliche metrische Angaben bei Benutzung des Moduls PF2e Token Drag Ruler (by 7H3LaughingMan) angezeigt. (Änderung nach Neuladen aktiv)" + }, "measureTemplateSupport": { "name": "Anzeige bei Schablonen", "hint": "Falls aktiviert, werden zusätzliche metrische Angaben bei Benutzung der Schablonen/Formen (Kegel, Kreis, Rechteck, Strahl) angezeigt." diff --git a/languages/en.json b/languages/en.json index c7a7161..321da73 100644 --- a/languages/en.json +++ b/languages/en.json @@ -5,6 +5,10 @@ "name": "Show on DragRuler", "hint": "When enabled, additional metric units are also shown for the DragRuler package from the author Stäbchenfisch. (Changes apply after reload) " }, + "pf2eDragRulerSupport": { + "name": "Show on PF2e Token Drag Ruler", + "hint": "When enabled, additional metric units are also shown for the PF2e Token Drag Ruler package from the author 7H3LaughingMan. (Changes apply after reload) " + }, "measureTemplateSupport": { "name": "Show on Measure Templates", "hint": "When enabled, additional metric units are also shown when using the measure templates (circle, cone, ray, rectangle)." diff --git a/languages/it.json b/languages/it.json index 0f07694..5ad542f 100644 --- a/languages/it.json +++ b/languages/it.json @@ -5,6 +5,10 @@ "name": "Mostra in DragRuler", "hint": "Se abilitato, vengono visualizzate anche unità metriche aggiuntive per il pacchetto DragRuler dell'autore Stäbchenfisch. (Le modifiche si applicano dopo il riavvio) " }, + "pf2eDragRulerSupport": { + "name": "Mostra in PF2e Token Drag Ruler", + "hint": "Se abilitato, vengono visualizzate anche unità metriche aggiuntive per il pacchetto PF2e Token Drag Ruler dell'autore 7H3LaughingMan. (Le modifiche si applicano dopo il riavvio) " + }, "measureTemplateSupport": { "name": "Mostra in Measure Templates", "hint": "Se abilitato, vengono visualizzate anche unità metriche aggiuntive quando si utilizzano i modelli di misura (cerchio, cono, raggio, rettangolo)." diff --git a/scripts/module.js b/scripts/module.js index 880e8e5..0c29022 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -54,8 +54,6 @@ Hooks.once('ready', () => { libWrapper.register("metric-ruler-labels", "CONFIG.MeasuredTemplate.layerClass.prototype._onDragLeftDrop", async function (wrapped, ...args) { let wrappedResult = await wrapped(...args); let measureTemplateSupport = game.settings.get("metric-ruler-labels", "measureTemplateSupport"); - //console.log("MeasuredTemplate.prototype._onDragLeftMove"); - //console.log(wrappedResult); let rulers = game.canvas.controls.rulers.children; for (let i = 0; i < rulers.length; i++) { let rulerSegments = rulers[i].segments @@ -168,8 +166,10 @@ Hooks.once('ready', () => { }, 'WRAPPER'); let dragRulerSupportActive = game.settings.get("metric-ruler-labels", "dragRulerSupport") + let pf2eDragRulerSupportActive = game.settings.get("metric-ruler-labels", "pf2eDragRulerSupport") - if (foundryGeneration >= 10 && dragRulerSupportActive) { + //Dragruler p2fe game.canvas.dragRuler.rulers.children + if (foundryGeneration >= 10 && (dragRulerSupportActive || pf2eDragRulerSupportActive)) { //Handling of DragRuler V10 libWrapper.register("metric-ruler-labels", "Token.prototype._onDragLeftMove", function (wrapped, ...args) { @@ -178,9 +178,15 @@ Hooks.once('ready', () => { //Delay, so that drag-ruler does not overwrite setTimeout(function () { - let rulers = game.canvas.controls.rulers.children; + let rulers = []; + if (dragRulerSupportActive) { + rulers = game.canvas.controls.rulers.children; + + } else if (pf2eDragRulerSupportActive) { + rulers = game.canvas.dragRuler.rulers.children; + } for (let i = 0; i < rulers.length; i++) { - if (rulers[i].isDragRuler) { + if ((rulers[i].isDragRuler && dragRulerSupportActive) || pf2eDragRulerSupportActive) { let dragRulerSegments = rulers[i].segments; if (dragRulerSegments && Array.isArray(dragRulerSegments) && dragRulerSegments.length > 0) { for (let i = 0; i < dragRulerSegments.length; i++) { @@ -195,6 +201,7 @@ Hooks.once('ready', () => { } } }, 60); + return wrappedResult; }, 'WRAPPER'); } @@ -219,6 +226,14 @@ function registerSettings() { type: Boolean, default: true, }); + game.settings.register("metric-ruler-labels", "pf2eDragRulerSupport", { + name: "metric-ruler-labels.settings.pf2eDragRulerSupport.name", + hint: "metric-ruler-labels.settings.pf2eDragRulerSupport.hint", + scope: "client", + config: true, + type: Boolean, + default: true, + }); game.settings.register("metric-ruler-labels", "hideFoundryMeasurement", { name: "metric-ruler-labels.settings.hideFoundryMeasurement.name", hint: "metric-ruler-labels.settings.hideFoundryMeasurement.hint",