Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Add UI checkbox to control enabling mirror animations

Scott Petrovic96461b361536
diff --git a/src/index.html b/src/index.html
index 7eaf011..a19e75b 100644
--- a/src/index.html
+++ b/src/index.html
@@ -150,6 +150,14 @@
</span>
</button>
<a id="download-hidden-link" href="#" style="display:none"></a>
+
+ <!-- testing the mirroring options -->
+ <div class="styled-checkbox icon-toggle">
+ <input type="checkbox" id="mirror-animations-checkbox" name="mirror-animations" value="true" style="display:none;">
+ <label for="mirror-animations-checkbox" data-tippy-content="Mirror animations" tabindex="0">
+ Mirror
+ </label>
+ </div>
</div>
diff --git a/src/lib/UI.ts b/src/lib/UI.ts
index fc11e0b..7f808ab 100644
--- a/src/lib/UI.ts
+++ b/src/lib/UI.ts
@@ -59,6 +59,8 @@ export class UI {
dom_animation_clip_list: HTMLElement | null = null
dom_export_button: HTMLButtonElement | null = null
+ dom_mirror_animations_checkbox: HTMLInputElement | null = null
+
// Animation player controls
dom_animation_player: HTMLElement | null = null
dom_current_animation_name: HTMLElement | null = null
@@ -154,6 +156,8 @@ export class UI {
// UI Controls for working with animation list/selection and export
this.dom_animation_clip_list = document.querySelector('#animations-items')
this.dom_export_button = document.querySelector('#export-button')
+ this.dom_import_animations_button = document.querySelector('#mirror-animations-checkbox')
+ this.dom_mirror_animations_checkbox = document.querySelector('#mirror-animations-checkbox')
// Animation player controls
this.dom_animation_player = document.querySelector('#animation-player')
diff --git a/src/lib/processes/animations-listing/StepAnimationsListing.ts b/src/lib/processes/animations-listing/StepAnimationsListing.ts
index ed26b28..5c7b37c 100644
--- a/src/lib/processes/animations-listing/StepAnimationsListing.ts
+++ b/src/lib/processes/animations-listing/StepAnimationsListing.ts
@@ -37,6 +37,9 @@ export class StepAnimationsListing extends EventTarget {
private _added_event_listeners: boolean = false
+ // enable status for mirroring animations
+ public mirror_animations_enabled: boolean = false
+
// Animation search functionality
public animation_search: AnimationSearch | null = null
@@ -312,6 +315,12 @@ export class StepAnimationsListing extends EventTarget {
this.play_animation(this.current_playing_index)
})
+ // check for changes to mirror animations checkbox
+ this.ui.dom_mirror_animations_checkbox?.addEventListener('change', (event) => {
+ const is_checked: boolean = this.ui.dom_mirror_animations_checkbox?.checked ?? false
+ this.mirror_animations_enabled = is_checked
+ })
+
// helps ensure we don't add event listeners multiple times
this.has_added_event_listeners = true
}