forked from public/foundryvtt-reve-de-dragon
Fix toggle horloge
Affiche/masque correctement l'horloge pour le MJ et les joueurs
This commit is contained in:
@ -85,7 +85,7 @@ export class RdDCalendrier extends Application {
|
||||
|
||||
display() {
|
||||
const pos = this.getSavePosition()
|
||||
this.render(true, { left: pos.left, top: pos.top});
|
||||
this.render(true, { left: pos.left, top: pos.top });
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ export class RdDCalendrier extends Application {
|
||||
async onUpdateSetting(setting, update, options, id) {
|
||||
if (setting.key == SYSTEM_RDD + '.' + WORLD_TIMESTAMP_SETTING) {
|
||||
this.timestamp = RdDTimestamp.getWorldTime();
|
||||
this.updateDisplay();
|
||||
this.positionAiguilles()
|
||||
Hooks.callAll(APP_ASTROLOGIE_REFRESH);
|
||||
}
|
||||
}
|
||||
@ -140,8 +140,6 @@ export class RdDCalendrier extends Application {
|
||||
async activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
this.html = html;
|
||||
this.updateDisplay();
|
||||
|
||||
this.html.find('.ajout-chronologie').click(ev => DialogChronologie.create());
|
||||
this.html.find('.toggle-horloge-analogique').click(ev => this.onToggleHorlogeAnalogique())
|
||||
this.html.find('.calendar-btn').click(ev => this.onCalendarButton(ev));
|
||||
@ -158,12 +156,19 @@ export class RdDCalendrier extends Application {
|
||||
ev.preventDefault();
|
||||
this.showAstrologieEditor();
|
||||
});
|
||||
this.positionAiguilles()
|
||||
}
|
||||
|
||||
positionAiguilles() {
|
||||
const timestamp = this.getTimestamp();
|
||||
this.html.find(`div.horloge-roue div.horloge-aiguille-heure img`).css(Misc.cssRotation(timestamp.angleHeure));
|
||||
this.html.find(`div.horloge-roue div.horloge-aiguille-minute img`).css(Misc.cssRotation(timestamp.angleMinute));
|
||||
}
|
||||
|
||||
onToggleHorlogeAnalogique() {
|
||||
this.horlogeAnalogique = !this.horlogeAnalogique;
|
||||
this.savePosition()
|
||||
this.render(true)
|
||||
this.display()
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -292,7 +297,7 @@ export class RdDCalendrier extends Application {
|
||||
}
|
||||
this.timestamp = newTimestamp;
|
||||
await this.rebuildNombresAstraux();
|
||||
this.updateDisplay();
|
||||
this.positionAiguilles()
|
||||
this.display();
|
||||
}
|
||||
|
||||
@ -307,9 +312,9 @@ export class RdDCalendrier extends Application {
|
||||
else if (calendarSet) {
|
||||
this.positionnerHeure(Number(calendarSet.value));
|
||||
}
|
||||
this.updateDisplay();
|
||||
this.positionAiguilles()
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async incrementTime(minutes = 0) {
|
||||
if (game.user.isGM) {
|
||||
@ -317,12 +322,12 @@ export class RdDCalendrier extends Application {
|
||||
Hooks.callAll(APP_ASTROLOGIE_REFRESH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async incrementerJour() {
|
||||
await this.setNewTimestamp(this.timestamp.nouveauJour());
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async positionnerHeure(heure) {
|
||||
if (game.user.isGM) {
|
||||
@ -333,7 +338,7 @@ export class RdDCalendrier extends Application {
|
||||
Hooks.callAll(APP_ASTROLOGIE_REFRESH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getLectureAstrologieDifficulte(dateIndex) {
|
||||
let indexNow = this.timestamp.indexDate;
|
||||
@ -407,24 +412,6 @@ export class RdDCalendrier extends Application {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
updateDisplay() {
|
||||
const calendrier = this.fillCalendrierData();
|
||||
for (const heure of document.getElementsByClassName("calendar-heure-texte")) {
|
||||
heure.innerHTML = calendrier.heure.label;
|
||||
}
|
||||
for (const minute of document.getElementsByClassName("calendar-minute-texte")) {
|
||||
minute.innerHTML = `${calendrier.minute} minutes`;
|
||||
}
|
||||
this.postionnerAiguilles()
|
||||
}
|
||||
|
||||
postionnerAiguilles() {
|
||||
const timestamp = this.getTimestamp();
|
||||
this.html.find(`div.horloge-roue div.horloge-aiguille-heure img`).css(Misc.cssRotation(timestamp.angleHeure));
|
||||
this.html.find(`div.horloge-roue div.horloge-aiguille-minute img`).css(Misc.cssRotation(timestamp.angleMinute));
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async saveEditeur(calendrierData) {
|
||||
const newTimestamp = RdDTimestamp.timestamp(
|
||||
|
Reference in New Issue
Block a user