Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

small UI change with explore page

Scott Petrovic95f45f7e995e
diff --git a/src/lib/processes/animations-listing/ModelVariationSwitcher.ts b/src/lib/processes/animations-listing/ModelVariationSwitcher.ts
index 1663c47..935f6b5 100644
--- a/src/lib/processes/animations-listing/ModelVariationSwitcher.ts
+++ b/src/lib/processes/animations-listing/ModelVariationSwitcher.ts
@@ -68,10 +68,8 @@ export class ModelVariationSwitcher extends EventTarget {
return
}
- // Sort a copy so the rig's default (first) variation is unchanged
- const sorted_variations = [...variations].sort((a, b) => a.display_name.localeCompare(b.display_name))
-
- for (const variation of sorted_variations) {
+ // RigConfig orders the list with the rig's default model first
+ for (const variation of variations) {
const card = document.createElement('div')
card.className = 'variation-card'
card.dataset.variation = variation.name
@@ -88,21 +86,26 @@ export class ModelVariationSwitcher extends EventTarget {
details.className = 'variation-details'
card.appendChild(details)
- if (variation.attribution !== 'None') {
- const attribution_el = document.createElement('div')
- attribution_el.className = 'variation-attribution'
- attribution_el.textContent = variation.attribution
- details.appendChild(attribution_el)
- }
-
const license_info = VariationLicenseCatalog.get_license_info(variation.license)
const license_chip = document.createElement('span')
license_chip.className = 'variation-license-chip'
license_chip.textContent = variation.license
details.appendChild(license_chip)
+ // build the tooltip as DOM nodes so the author name is never parsed as HTML
+ const tooltip_content = document.createElement('div')
+ if (variation.attribution !== 'None') {
+ const author_el = document.createElement('div')
+ author_el.className = 'variation-tooltip-author'
+ author_el.textContent = `Author: ${variation.attribution}`
+ tooltip_content.appendChild(author_el)
+ }
+ const license_el = document.createElement('div')
+ license_el.textContent = `${variation.license}: ${license_info.description}`
+ tooltip_content.appendChild(license_el)
+
tippy(license_chip, {
- content: `${variation.license}: ${license_info.description}`,
+ content: tooltip_content,
theme: 'mesh2motion',
placement: 'right'
})
diff --git a/src/marketing/marketing.css b/src/marketing/marketing.css
index a621bf4..b2c9b75 100644
--- a/src/marketing/marketing.css
+++ b/src/marketing/marketing.css
@@ -1,6 +1,6 @@
/* Explore page left sidebar: skeleton buttons on top, model variations below */
body.explore-page {
- --explore-sidebar-width: 12.5rem;
+ --explore-sidebar-width: 10.5rem;
}
.model-selection-section {
@@ -130,7 +130,7 @@ button.active-button {
filter: none !important; /* avoid inverting image like we do for icons in light mode */
}
-/* credit (left) and license (right) overlaid on the bottom of the thumbnail */
+/* license chip overlaid on the bottom-right of the thumbnail */
.variation-details {
position: absolute;
left: 0.6rem;
@@ -145,16 +145,9 @@ button.active-button {
pointer-events: none; /* clicks fall through to the card; license chip re-enables for its tooltip */
}
-.variation-attribution {
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- padding: 0.1rem 0.4rem;
- border-radius: 4px;
- font-size: 80%;
- color: #fff;
- background: rgba(0, 0, 0, 0.55);
+.variation-tooltip-author {
+ font-weight: 600;
+ margin-bottom: 0.2rem;
}
.variation-license-chip {