Skip to content

Commit

Permalink
(amend)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunomiac committed Jan 3, 2024
1 parent ece1fba commit 3f6d7a6
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 79 deletions.
1 change: 0 additions & 1 deletion css/style.min.css
Original file line number Diff line number Diff line change
Expand Up @@ -26736,7 +26736,6 @@ template {
height: auto;
line-height: unset;
font-size: 20px;
text-shadow: var(--text-shadow-dark);
opacity: 1;
}
:root body.vtt.game.system-eunos-blades .app.window-app.sheet.item.clock-keeper .window-content form .button-icon i.fa-duotone, :root body.vtt.game.system-eunos-blades .app.window-app.sheet.item.clock-keeper .window-content form .toggle-icon i.fa-duotone {
Expand Down
5 changes: 3 additions & 2 deletions module/blades.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ import BladesActiveEffect from "./documents/BladesActiveEffect.js";
import BladesGMTrackerSheet from "./sheets/item/BladesGMTrackerSheet.js";
import BladesClockKeeperSheet from "./sheets/item/BladesClockKeeperSheet.js";
CONFIG.debug.logging = false;
/* DEVCODE*/ CONFIG.debug.logging = true;
/* DEVCODE*/
Object.assign(globalThis, { eLog: logger });
Handlebars.registerHelper("eLog", logger.hbsLog); /* !DEVCODE*/
Handlebars.registerHelper("eLog", logger.hbsLog);
/* !DEVCODE*/
let socket; // ~ SocketLib interface
// #endregion ▮▮▮▮[IMPORTS]▮▮▮▮
class GlobalGetter {
Expand Down
40 changes: 6 additions & 34 deletions module/classes/BladesClocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ class BladesClockKey extends BladesTargetLink {
return game.eunoblades.Director.appendToClockKeySection(await this.getHTML());
}
async removeFromOverlay() {
delete this._hoverOverTimeline;
delete this._keySwingTimeline;
return game.eunoblades.Director.removeFromClockKeySection(this.id);
}
get elem() {
Expand Down Expand Up @@ -381,16 +383,6 @@ class BladesClockKey extends BladesTargetLink {
}
return this._keySwingTimeline;
}
_keyControlZoomTimeline;
get keyControlZoomTimeline() {
if (!this.elem) {
return undefined;
}
if (!this._keyControlZoomTimeline) {
this._keyControlZoomTimeline = U.gsap.effects.keyControlZoom(this.elem).pause();
}
return this._keyControlZoomTimeline;
}
_hoverOverTimeline;
get hoverOverTimeline() {
if (!this.elem) {
Expand All @@ -402,30 +394,6 @@ class BladesClockKey extends BladesTargetLink {
return this._hoverOverTimeline;
}
// #endregion
// #region > GM-ONLY CLIENT-SIDE ANIMATIONS ~
showControls() {
if (!game.user.isGM) {
return;
}
if (!this.elem) {
return;
}
this.keySwingTimeline?.tweenTo(1, { duration: 0.25, ease: "none" });
this.keyControlZoomTimeline?.play();
game.eunoblades.ClockKeeper.showClockKeyControls(this.id);
}
hideControls() {
if (!game.user.isGM) {
return;
}
if (!this.elem) {
return;
}
this.keySwingTimeline?.resume();
this.keyControlZoomTimeline?.reverse();
game.eunoblades.ClockKeeper.hideClockKeyControls(this.id);
}
// #endregion
// #region > SOCKET CALLS: _SocketCall / static _SocketResponse / _Animation
async drop_Animation(callback) {
await this.appendToOverlay();
Expand Down Expand Up @@ -488,6 +456,8 @@ class BladesClockKey extends BladesTargetLink {
const clockData = this.parseClockConfig(clockConfig);
// Write to state
await this.updateTarget(`clocksData.${clockData.id}`, clockData);
// Regnerate clocks collection
void this.clocks;
}
async deleteClock(clockID) {
if (this.size <= 1) {
Expand All @@ -499,6 +469,8 @@ class BladesClockKey extends BladesTargetLink {
}
await this.getClockByID(clockID)?.delete();
await this.updateClockIndices();
// Regnerate clocks collection
void this.clocks;
}
}
class BladesClock extends BladesTargetLink {
Expand Down
2 changes: 1 addition & 1 deletion module/classes/BladesDirector.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class BladesDirector {
if (typeof elem === "string") {
elem = $(`#${elem}`);
}
$(elem).parents(".clock-key-container").remove();
$(elem).closest(".clock-key-container").remove();
}
get locationSection$() {
return this.overlayContainer$.find(".overlay-section-location");
Expand Down
2 changes: 1 addition & 1 deletion scss/sheets/_clock-keeper-sheet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
height: auto;
line-height: unset;
font-size: 20px;
text-shadow: var(--text-shadow-dark);
// text-shadow: var(--text-shadow-dark);
opacity: 1;

&.fa-duotone {
Expand Down
4 changes: 1 addition & 3 deletions templates/overlay/blades-overlay.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
{{eLog "BLADES OVERLAY" this}}

<div class="overlay-section overlay-section-clock-keys">
{{#each sceneKeys}}
{{> "systems/eunos-blades/templates/components/clock-key.hbs"}}
{{/each}}

</div>

<div class="overlay-section overlay-section-location">
Expand Down
66 changes: 59 additions & 7 deletions templates/parts/clock-sheet-key-controls.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
</div>

<div class="clock-key-control-panel controls-back">

{{#if isSceneTab}}
{{!-- Drop Key --}}
{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="clock-control-button clock-control-drop-key"
Expand All @@ -47,18 +49,68 @@
action="drop-clock-key"
targetId=clockKey.id
}}

{{!-- Select Overlay Position --}}
{{!-- Spawns a draggable targeting reticule on GM's overlay, deleted once its position is retrieved and the key is dropped --}}
{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="clock-control-button clock-spawn-position-dragger"
buttonClass="fa-solid fa-location-crosshairs"
action="spawn-position-dragger"
targetId=clockKey.id
}}
{{else}}
{{!-- Add to Scene --}}
{{!-- Remove from Scene --}}
{{!-- Delete Key --}}

{{!-- Name --}}

{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="clock-control-button clock-control-add-key-to-scene"
buttonClass="fa-sharp fa-solid fa-clapperboard-play"
action="add-key-to-scene"
targetId=clockKey.id
}}
{{!-- Toggle Name Visibility --}}
{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="clock-control-button clock-toggle-name-visible"
buttonClass=(test (test clockKey.isNameVisible "&&" "fas fa-barcode-alt") "||" "fal fa-barcode-alt")
action="toggle-name-visibility"
targetId=clockKey.id
}}
{{/if}}


{{!-- Select Overlay Position --}}

{{!-- Add Clock --}}
{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="clock-control-button clock-control-add-clock-to-key"
buttonClass="fa-sharp fa-solid fa-octagon-plus"
action="add-clock-to-key"
targetId=clockKey.id
}}

{{!-- Name --}}
<input type="text" class="clock-key-input clock-key-input-name"
data-target-id="{{clockKey.targetID}}"
data-target-key="{{clockKey.targetKeyPrefix}}.name"
value="{{clockKey.name}}"
/>

{{#if isSceneTab}}
{{#if isClockKeeperKey}}
{{!-- Delete Key --}}
{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="clock-control-button clock-control-delete-key"
buttonClass="fa-sharp fa-solid fa-trash-xmark"
action="delete-clock-key"
targetId=clockKey.id
}}
{{else}}
{{!-- Remove from Scene --}}
{{> "systems/eunos-blades/templates/components/button-icon.hbs"
blockClass="clock-control-button clock-control-remove-key-from-scene"
buttonClass="fa-sharp fa-solid fa-camera-slash"
action="remove-key-from-scene"
targetId=clockKey.id
}}
{{/if}}
{{/if}}


</div>

Expand Down
5 changes: 3 additions & 2 deletions ts/blades.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ import BladesGMTrackerSheet from "./sheets/item/BladesGMTrackerSheet";
import BladesClockKeeperSheet from "./sheets/item/BladesClockKeeperSheet";

CONFIG.debug.logging = false;
/* DEVCODE*/CONFIG.debug.logging = true;
/* DEVCODE*/
Object.assign(globalThis, {eLog: logger});
Handlebars.registerHelper("eLog", logger.hbsLog); /* !DEVCODE*/
Handlebars.registerHelper("eLog", logger.hbsLog);
/* !DEVCODE*/

let socket: Socket; // ~ SocketLib interface

Expand Down
34 changes: 7 additions & 27 deletions ts/classes/BladesClocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ class BladesClockKey extends BladesTargetLink<BladesClockKey.Schema> implements
return game.eunoblades.Director.appendToClockKeySection(await this.getHTML());
}
async removeFromOverlay(): Promise<void> {
delete this._hoverOverTimeline;
delete this._keySwingTimeline;
return game.eunoblades.Director.removeFromClockKeySection(this.id);
}

Expand Down Expand Up @@ -468,15 +470,6 @@ class BladesClockKey extends BladesTargetLink<BladesClockKey.Schema> implements
return this._keySwingTimeline;
}

_keyControlZoomTimeline?: gsap.core.Timeline;
get keyControlZoomTimeline() {
if (!this.elem) {return undefined;}
if (!this._keyControlZoomTimeline) {
this._keyControlZoomTimeline = U.gsap.effects.keyControlZoom(this.elem).pause();
}
return this._keyControlZoomTimeline;
}

_hoverOverTimeline?: gsap.core.Timeline;
get hoverOverTimeline() {
if (!this.elem) {return undefined;}
Expand All @@ -487,24 +480,6 @@ class BladesClockKey extends BladesTargetLink<BladesClockKey.Schema> implements
}
// #endregion

// #region > GM-ONLY CLIENT-SIDE ANIMATIONS ~
showControls() {
if (!game.user.isGM) {return;}
if (!this.elem) {return;}
this.keySwingTimeline?.tweenTo(1, {duration: 0.25, ease: "none"});
this.keyControlZoomTimeline?.play();
game.eunoblades.ClockKeeper.showClockKeyControls(this.id);
}

hideControls() {
if (!game.user.isGM) {return;}
if (!this.elem) {return;}
this.keySwingTimeline?.resume();
this.keyControlZoomTimeline?.reverse();
game.eunoblades.ClockKeeper.hideClockKeyControls(this.id);
}
// #endregion

// #region > SOCKET CALLS: _SocketCall / static _SocketResponse / _Animation
async drop_Animation(callback?: () => void) {
await this.appendToOverlay();
Expand Down Expand Up @@ -560,6 +535,9 @@ class BladesClockKey extends BladesTargetLink<BladesClockKey.Schema> implements

// Write to state
await this.updateTarget(`clocksData.${clockData.id}`, clockData);

// Regnerate clocks collection
void this.clocks;
}

async deleteClock(clockID?: IDString) {
Expand All @@ -568,6 +546,8 @@ class BladesClockKey extends BladesTargetLink<BladesClockKey.Schema> implements
if (!clockID) {return;}
await this.getClockByID(clockID)?.delete();
await this.updateClockIndices();
// Regnerate clocks collection
void this.clocks;
}
// #endregion
}
Expand Down
2 changes: 1 addition & 1 deletion ts/classes/BladesDirector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class BladesDirector {
if (typeof elem === "string") {
elem = $(`#${elem}`);
}
$(elem).parents(".clock-key-container").remove();
$(elem).closest(".clock-key-container").remove();
}

private get locationSection$(): JQuery<HTMLElement> {
Expand Down

0 comments on commit 3f6d7a6

Please sign in to comment.