Fix: position du calendrier par défaut

calendrier positionné indépendamment par user
default setting pour la position initiale
This commit is contained in:
Vincent Vandemeulebrouck 2021-06-08 14:11:23 +02:00
parent 1ff48f84ab
commit 23d192fdbb
2 changed files with 6 additions and 4 deletions

View File

@ -37,6 +37,9 @@ const MAX_NOMBRE_ASTRAL = 12;
/* -------------------------------------------- */ /* -------------------------------------------- */
export class RdDCalendrier extends Application { export class RdDCalendrier extends Application {
static createCalendrierPos() {
return { top: 200, left: 200 };
}
static getCalendrier(index) { static getCalendrier(index) {
let calendrier = { let calendrier = {
@ -67,9 +70,7 @@ export class RdDCalendrier extends Application {
// position // position
this.calendrierPos = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "calendrier-pos")); this.calendrierPos = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "calendrier-pos"));
if (this.calendrierPos == undefined || this.calendrierPos.top == undefined) { if (this.calendrierPos == undefined || this.calendrierPos.top == undefined) {
this.calendrierPos = {}; this.calendrierPos = RdDCalendrier.createCalendrierPos();
this.calendrierPos.top = 200;
this.calendrierPos.left = 200;
if (game.user.isGM) { // Uniquement si GM if (game.user.isGM) { // Uniquement si GM
game.settings.set("foundryvtt-reve-de-dragon", "calendrier-pos", this.calendrierPos); game.settings.set("foundryvtt-reve-de-dragon", "calendrier-pos", this.calendrierPos);
} }

View File

@ -88,8 +88,9 @@ Hooks.once("init", async function () {
/* -------------------------------------------- */ /* -------------------------------------------- */
game.settings.register("foundryvtt-reve-de-dragon", "calendrier-pos", { game.settings.register("foundryvtt-reve-de-dragon", "calendrier-pos", {
name: "calendrierPos", name: "calendrierPos",
scope: "world", scope: "client",
config: false, config: false,
default: RdDCalendrier.createCalendrierPos(),
type: Object type: Object
}); });