Skip to content

Commit

Permalink
Edit-mode: Fix mini-widgets selecting bug
Browse files Browse the repository at this point in the history
Signed-off-by: Arturo Manzoli <[email protected]>
  • Loading branch information
ArturoManzoli authored and rafaellehmkuhl committed Jan 16, 2025
1 parent 9db9628 commit 5284a67
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/components/EditMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@
id="mini-widget-card"
:ref="(el) => (miniWidgetContainers[miniWidget.component] = el as HTMLElement)"
:key="miniWidget.hash"
class="flex flex-col items-center w-full justify-between rounded-md bg-[#273842] hover:brightness-125 h-[90%] aspect-square cursor-pointer elevation-4 overflow-clip"
class="flex flex-col items-center w-auto justify-between rounded-md bg-[#273842] hover:brightness-125 h-[90%] cursor-pointer elevation-4 overflow-visible"
:draggable="false"
>
<div />
Expand Down Expand Up @@ -1037,19 +1037,15 @@ const widgetMode = ref('Regular')
// Resize mini widgets so they fit the layout when the widget mode is set to mini widgets
const miniWidgetContainers = ref<Record<string, HTMLElement>>({})
watch(widgetMode, () => {
if (widgetMode.value !== 'Mini') return
nextTick(() => {
Object.values(miniWidgetContainers.value).forEach((element) => {
if (element.scrollWidth > element.clientWidth) {
let scale = 1
while (element.scrollWidth > element.clientWidth) {
scale -= 0.01
const actualElement = element.children[1] as HTMLElement
actualElement.style.scale = `${scale}`
}
}
})
watch(widgetMode, async (newValue: string): Promise<void> => {
if (newValue !== 'Mini') return
await nextTick()
Object.values(miniWidgetContainers.value).forEach((element: HTMLElement) => {
if (element.scrollWidth > element.clientWidth) {
const ratio = element.clientWidth / element.scrollWidth
const actualElement = element.children[1] as HTMLElement
actualElement.style.transform = `scale(${ratio})`
}
})
})
Expand Down

0 comments on commit 5284a67

Please sign in to comment.