Skip to content

Commit

Permalink
don't show redundant model previews (#949)
Browse files Browse the repository at this point in the history
for #944
  • Loading branch information
mcmonkey4eva authored and huchenlei committed Sep 25, 2024
1 parent 1bc78a7 commit 35579e6
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/components/sidebar/tabs/modelLibrary/ModelTreeLeaf.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</template>
</TreeExplorerTreeNode>

<teleport v-if="isHovered" to="#model-library-model-preview-container">
<teleport v-if="showPreview" to="#model-library-model-preview-container">
<div class="model-lib-model-preview" :style="modelPreviewStyle">
<ModelPreview ref="previewRef" :modelDef="modelDef"></ModelPreview>
</div>
Expand Down Expand Up @@ -82,6 +82,21 @@ const handleModelHover = async () => {
const container = ref<HTMLElement | null>(null)
const modelContentElement = ref<HTMLElement | null>(null)
const isHovered = ref(false)
const showPreview = computed(() => {
return (
isHovered.value &&
modelDef.value &&
!modelDef.value.is_fake_object &&
modelDef.value.has_loaded_metadata &&
(modelDef.value.author ||
modelDef.value.description ||
modelDef.value.usage_hint ||
modelDef.value.trigger_phrase ||
modelDef.value.image)
)
})
const handleMouseEnter = async () => {
if (modelDef.value.is_fake_object) {
return
Expand Down

0 comments on commit 35579e6

Please sign in to comment.