feat: Add tracker scaling option and display session controls on hover.
This commit is contained in:
parent
44b80af3d0
commit
690c9d45c9
4 changed files with 49 additions and 10 deletions
|
|
@ -12,7 +12,7 @@ Hooks.once("init", () => {
|
|||
type: Number,
|
||||
default: 1,
|
||||
onChange: () => {
|
||||
if (SessionTrackerApp.instance) SessionTrackerApp.instance.render(true);
|
||||
if (SessionTrackerApp.instance) SessionTrackerApp.instance.render();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -66,6 +66,24 @@ Hooks.once("init", () => {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Register scale setting
|
||||
game.settings.register("fvtt-session-tracker", "scale", {
|
||||
name: "Tracker Scale",
|
||||
hint: "Adjust the size of the session tracker.",
|
||||
scope: "world",
|
||||
config: true,
|
||||
type: Number,
|
||||
default: 1.0,
|
||||
range: {
|
||||
min: 0.5,
|
||||
max: 2.0,
|
||||
step: 0.1
|
||||
},
|
||||
onChange: () => {
|
||||
if (SessionTrackerApp.instance) SessionTrackerApp.instance.render();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Hooks.once("ready", () => {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ export class SessionTrackerApp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
async _prepareContext(options) {
|
||||
return {
|
||||
sessionNumber: game.settings.get("fvtt-session-tracker", "sessionCount"),
|
||||
scale: game.settings.get("fvtt-session-tracker", "scale"),
|
||||
isGM: game.user.isGM
|
||||
};
|
||||
}
|
||||
|
|
@ -97,10 +98,17 @@ export class SessionTrackerApp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
|
||||
// Save position
|
||||
const rect = this.element.getBoundingClientRect();
|
||||
game.settings.set("fvtt-session-tracker", "position", {
|
||||
const pos = {
|
||||
top: rect.top,
|
||||
left: rect.left
|
||||
});
|
||||
};
|
||||
|
||||
// Update the application's position state
|
||||
this.position.top = pos.top;
|
||||
this.position.left = pos.left;
|
||||
|
||||
// Save to settings for persistence across sessions
|
||||
game.settings.set("fvtt-session-tracker", "position", pos);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue