From 0c11013694a4ed1343c1405e52772c36c231b20f Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 8 Mar 2023 22:33:23 +0100 Subject: [PATCH] Ajout Aiguille Horloge --- module/rdd-calendrier.js | 2 + module/rdd-timestamp.js | 1 + module/sommeil/app-astrologie.js | 19 +++++-- styles/img/ui/rdd-aiguille-horloge.svg | 68 ++++++++++++++++++++++++++ styles/simple.css | 10 +++- templates/sommeil/astrologie-theme.hbs | 3 ++ 6 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 styles/img/ui/rdd-aiguille-horloge.svg diff --git a/module/rdd-calendrier.js b/module/rdd-calendrier.js index db158270..0053d319 100644 --- a/module/rdd-calendrier.js +++ b/module/rdd-calendrier.js @@ -49,6 +49,7 @@ export class RdDCalendrier extends Application { if (setting.key == SYSTEM_RDD + '.' + WORLD_TIMESTAMP_SETTING) { this.timestamp = RdDTimestamp.getWorldTime(); this.updateDisplay(); + Hooks.callAll(APP_ASTROLOGIE_REFRESH); } } @@ -286,6 +287,7 @@ export class RdDCalendrier extends Application { this.positionnerHeure(Number(calendarSet.value)); } this.updateDisplay(); + Hooks.callAll(APP_ASTROLOGIE_REFRESH); } /* -------------------------------------------- */ diff --git a/module/rdd-timestamp.js b/module/rdd-timestamp.js index 06b77d7d..4fb70d84 100644 --- a/module/rdd-timestamp.js +++ b/module/rdd-timestamp.js @@ -252,6 +252,7 @@ export class RdDTimestamp { get heure() { return Math.floor(this.indexMinute / RDD_MINUTES_PAR_HEURES) } get minute() { return this.indexMinute % RDD_MINUTES_PAR_HEURES } get round() { return ROUNDS_PAR_MINUTE * (this.indexMinute - Math.floor(this.indexMinute)) } + get pourcentageDuJour() { return this.indexMinute / RDD_MINUTES_PAR_JOUR } formatDate() { const jour = this.jour + 1; diff --git a/module/sommeil/app-astrologie.js b/module/sommeil/app-astrologie.js index 8e273657..cc7aef76 100644 --- a/module/sommeil/app-astrologie.js +++ b/module/sommeil/app-astrologie.js @@ -161,16 +161,24 @@ export class AppAstrologie extends Application { this.html.find(`select[name="signe-astral"]`).val(this.appData.theme.signeAstral.key) this.html.find(`select[name="signe-naissance"]`).val(this.appData.theme.signeNaissance.key) - const angle = ((chiffreAstral + heureNaissance) * 30) % 360; - const rotation = `rotate(${angle}deg)`; - this.html.find(`div.astro-roue div.astro-disque img`).css({ + const angleAstrologie = ((chiffreAstral + heureNaissance) * 30) % 360; + this.html.find(`div.astro-roue div.astro-disque img`).css(this.cssRotation(angleAstrologie)); + + const timestamp = game.system.rdd.calendrier.getTimestamp(); + const angleHeure = timestamp.pourcentageDuJour * 360 + this.html.find(`div.astro-roue div.astro-horloge img`).css(this.cssRotation(angleHeure)); + } + + cssRotation(angleAstrologie) { + const rotation = `rotate(${angleAstrologie}deg)`; + const cssRotation = { 'transform': rotation, '-ms-transform': rotation, '-moz-transform': rotation, '-webkit-transform': rotation, '-o-transform': rotation - }); - + }; + return cssRotation; } requestJetAstrologie() { @@ -199,6 +207,7 @@ export class AppAstrologie extends Application { refreshAstrologie() { this.render(true) } + async close(options) { Hooks.off(APP_ASTROLOGIE_REFRESH, this.hookReference); this.hookReference = undefined diff --git a/styles/img/ui/rdd-aiguille-horloge.svg b/styles/img/ui/rdd-aiguille-horloge.svg new file mode 100644 index 00000000..4331e6fc --- /dev/null +++ b/styles/img/ui/rdd-aiguille-horloge.svg @@ -0,0 +1,68 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/styles/simple.css b/styles/simple.css index 77db8254..eeaa4aff 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -907,7 +907,15 @@ div.astro-roue div.astro-disque { width: calc(100% - 5rem); height: calc(100% - 5rem); } -div.astro-roue div.astro-disque img { border: none; } +div.astro-roue div.astro-horloge { + position: absolute; + border: none; + top: calc(50% - 3.5rem); + left: calc(50% - 3.5rem); + width: calc(100% - 6rem); + height: calc(100% - 6rem); +} +div.astro-roue div:is(.astro-disque,.astro-horloge) img { border: none; } div.astro-roue div.astro-heure img.astro-heure-img { width: 2rem; height: 2rem; diff --git a/templates/sommeil/astrologie-theme.hbs b/templates/sommeil/astrologie-theme.hbs index 0d9b6219..fb6948e9 100644 --- a/templates/sommeil/astrologie-theme.hbs +++ b/templates/sommeil/astrologie-theme.hbs @@ -28,5 +28,8 @@
{{/each}} +
+ +
\ No newline at end of file