Import a 3D Model and automatically assign and export animations
TypeScript
prop panel UI improvement
Scott Petrovic9dfef5a94a03
diff --git a/src/create.html b/src/create.htmlindex 3e8f0e4..6dc2127 100644--- a/src/create.html+++ b/src/create.html@@ -434,7 +434,14 @@<div id="props-panel" class="props-panel" role="region" aria-label="Props" hidden><div id="props-left-hand" class="prop-picker"></div><div id="props-right-hand" class="prop-picker"></div>- <div>Prop</div>+ <button+ class="secondary-button"+ id="props-close-button"+ data-tippy-content="Close props"+ aria-label="Close props"+ >+ <img src="images/icons/props.svg" alt="" width="32" height="32" />+ </button></div></div>diff --git a/src/index.html b/src/index.htmlindex 4a8acf7..b7ba9a5 100644--- a/src/index.html+++ b/src/index.html@@ -184,7 +184,9 @@<div id="props-panel" class="props-panel" role="region" aria-label="Props" hidden><div id="props-left-hand" class="prop-picker"></div><div id="props-right-hand" class="prop-picker"></div>- <div>Prop</div>+ <button class="secondary-button" id="props-close-button" data-tippy-content="Close props" aria-label="Close props">+ <img src="images/icons/props.svg" alt="" width="32" height="32" />+ </button></div></div>diff --git a/src/lib/UI.ts b/src/lib/UI.tsindex cf9831e..735669d 100644--- a/src/lib/UI.ts+++ b/src/lib/UI.ts@@ -101,6 +101,7 @@ export class UI {dom_import_animations_button: HTMLButtonElement | null = nulldom_import_animations_input: HTMLInputElement | null = nulldom_props_toggle_button: HTMLButtonElement | null = null+ dom_props_close_button: HTMLButtonElement | null = nulldom_props_panel: HTMLElement | null = nulldom_props_dock: HTMLElement | null = nulldom_extend_arm_range_input: HTMLInputElement | null = null@@ -227,6 +228,7 @@ export class UI {this.dom_export_button = document.querySelector('#export-button')this.dom_import_animations_button = document.querySelector('#import-animations-button')this.dom_props_toggle_button = document.querySelector('#props-toggle-button')+ this.dom_props_close_button = document.querySelector('#props-close-button')this.dom_props_panel = document.querySelector('#props-panel')this.dom_props_dock = document.querySelector('#props-dock')this.dom_import_animations_input = document.querySelector('#import-animations-input')diff --git a/src/lib/processes/animations-listing/props/PropsPanel.ts b/src/lib/processes/animations-listing/props/PropsPanel.tsindex e07dc60..9c46d36 100644--- a/src/lib/processes/animations-listing/props/PropsPanel.ts+++ b/src/lib/processes/animations-listing/props/PropsPanel.ts@@ -26,8 +26,14 @@ export class PropsPanel extends EventTarget {this.left_picker.addEventListener('change', () => { this.dispatch_selection_changed() })this.right_picker.addEventListener('change', () => { this.dispatch_selection_changed() })+ // the toggle only shows while collapsed; the close button inside the panel collapses itthis.ui.dom_props_toggle_button?.addEventListener('click', () => {- this.set_expanded(this.ui.dom_props_panel?.hidden === true)+ this.set_expanded(true)+ this.ui.dom_props_close_button?.focus()+ })+ this.ui.dom_props_close_button?.addEventListener('click', () => {+ this.set_expanded(false)+ this.ui.dom_props_toggle_button?.focus()})// keep the floating panel docked beside the tool panel as its width changes@@ -70,7 +76,7 @@ export class PropsPanel extends EventTarget {const toggle_button = this.ui.dom_props_toggle_buttonif (toggle_button !== null) {toggle_button.setAttribute('aria-expanded', String(is_expanded))- toggle_button.classList.toggle('active', is_expanded)+ toggle_button.hidden = is_expanded}if (!is_expanded) {diff --git a/src/lib/processes/animations-listing/props/props.css b/src/lib/processes/animations-listing/props/props.cssindex 2d40a5d..467c8ee 100644--- a/src/lib/processes/animations-listing/props/props.css+++ b/src/lib/processes/animations-listing/props/props.css@@ -1,8 +1,3 @@-#props-toggle-button.active {- background: var(--bg-alternate);- outline: 1px solid var(--text-primary);-}-#props-dock {position: fixed;top: calc(var(--navigation-height) + 0.5rem);@@ -20,18 +15,31 @@order: -1;}-#props-toggle-button {+#props-toggle-button,+#props-close-button {display: flex;align-items: center;justify-content: center;padding: 0.5rem;}+#props-toggle-button[hidden] {+ display: none;+}++/* close button sits at the far right of the open panel, where the toggle was */+#props-close-button {+ align-self: center;+ margin-left: auto;+ background: var(--bg-alternate);+ outline: 1px solid var(--text-primary);+}+.props-panel {display: flex;flex-direction: row;gap: 1rem;- padding: 0.5rem 0.75rem;+ padding: 1.0rem;border: 1px solid var(--bg-tertiary);border-radius: 6px;background: color-mix(in srgb, var(--bg-primary) 90%, black);