From 618034e6fac78adae573688835ee7eeef417cbff Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Thu, 6 Mar 2025 11:37:17 +0300 Subject: [PATCH] LOVE: scaling the floor (#8145) Signed-off-by: Alexander Platov --- packages/theme/styles/love.scss | 59 +++++++++++++++---- .../ui/src/components/AccordionItem.svelte | 3 +- .../src/components/Floor.svelte | 22 ++++++- .../src/components/FloorConfigure.svelte | 18 +++++- .../src/components/FloorGrid.svelte | 44 +++++++++++--- .../src/components/FloorPreview.svelte | 1 + .../src/components/FloorView.svelte | 4 +- .../src/components/ParticipantView.svelte | 10 ++-- .../src/components/RoomPreview.svelte | 1 - plugins/love-resources/src/stores.ts | 3 + plugins/love-resources/src/utils.ts | 24 +++++++- 11 files changed, 155 insertions(+), 34 deletions(-) diff --git a/packages/theme/styles/love.scss b/packages/theme/styles/love.scss index 8a251f76cc..cadb7b3bbb 100644 --- a/packages/theme/styles/love.scss +++ b/packages/theme/styles/love.scss @@ -39,6 +39,7 @@ & > span { color: var(--theme-caption-color); + transition: font-size .15s ease-in-out; cursor: default; } } @@ -46,12 +47,18 @@ overflow: hidden; width: 100%; height: 100%; - max-width: 90%; - max-height: 90%; - transition-property: max-width, max-height; - transition-duration: .15s; - transition-timing-function: ease-in-out; + min-width: .5rem; + min-height: .5rem; + max-width: 100%; + max-height: 100%; + aspect-ratio: 1; + transition: transform .15s ease-in-out; + transform: scale(.9); + .preview & { + min-width: .5rem; + min-height: .5rem; + } &.hovered:hover { background-color: transparent; @@ -64,8 +71,8 @@ &.hovered { background-color: var(--theme-popup-hover); } } - &:not(.preview)::before { top: calc(100% / var(--huly-floor-roomHeight) / 3 * -1.6); } - &.preview::before { + :not(.preview) &::before { top: calc(100% / var(--huly-floor-roomHeight) / 3 * -1.6); } + .preview &::before { top: calc(100% / var(--huly-floor-roomHeight) / 3 * -1); bottom: calc(100% / var(--huly-floor-roomHeight) / 3 * -1); left: calc(100% / var(--huly-floor-roomWidth) / 3 * -1); @@ -80,8 +87,7 @@ cursor: pointer; &:hover { - max-width: 100%; - max-height: 100%; + transform: scale(1); } } } @@ -95,8 +101,12 @@ .floorGrid-configureRoom { &__header { top: calc(100% / var(--huly-floor-roomHeight) / 3 * -1.6 + .75rem - 1px); - - & > .antiEditBox input { font-size: .8125rem; } + // transition: top .15s ease-in-out; + + & > .antiEditBox input { + font-size: .8125rem; + transition: font-size .15s ease-in-out; + } } &__field { width: 90%; @@ -139,6 +149,33 @@ } } +// Room conners and header +@container floorGridContainer (max-width: 800px) { + .floorGrid-room::before, + .floorGrid-configureRoom::before { border-radius: 0.75rem; } + .floorGrid-room .floorGrid-room__header { + top: calc(100% / var(--huly-floor-roomHeight) / 3 * -1.6 + .125rem + 1px); + span { font-size: .75rem; } + svg { width: 0.75rem; } + } + .floorGrid-configureRoom .floorGrid-configureRoom__header { + top: calc(100% / var(--huly-floor-roomHeight) / 3 * -1.6 + .25rem); + & > .antiEditBox input { font-size: .75rem; } + } +} +@container floorGridContainer (max-width: 600px) { + .floorGrid-room::before, + .floorGrid-configureRoom::before { border-radius: 0.5rem; } + .floorGrid-room .floorGrid-room__header { + top: calc(100% / var(--huly-floor-roomHeight) / 3 * -1.6 + .125rem); + span { font-size: .7rem; } + } + .floorGrid-configureRoom .floorGrid-configureRoom__header { + top: calc(100% / var(--huly-floor-roomHeight) / 3 * -1.6 + .125rem); + & > .antiEditBox input { font-size: .7rem; } + } +} + // Room @media only screen and (max-width: 1024px) { .room-container + .bar > .bar__left-panel button span { display: none; } diff --git a/packages/ui/src/components/AccordionItem.svelte b/packages/ui/src/components/AccordionItem.svelte index 750e0d0d1a..ad367b3987 100644 --- a/packages/ui/src/components/AccordionItem.svelte +++ b/packages/ui/src/components/AccordionItem.svelte @@ -41,6 +41,7 @@ export let categoryHeader: boolean = false export let hiddenHeader: boolean = false export let background: string | undefined = undefined + export let contentAlign: 'start' | 'center' | 'end' | 'stretch' = 'start' const dispatch = createEventDispatcher() @@ -125,7 +126,7 @@ -
+
diff --git a/plugins/love-resources/src/components/Floor.svelte b/plugins/love-resources/src/components/Floor.svelte index 8b3aeb8990..72b3cf146c 100644 --- a/plugins/love-resources/src/components/Floor.svelte +++ b/plugins/love-resources/src/components/Floor.svelte @@ -14,15 +14,25 @@ --> -{#if preview} +{#if !useResize}
@@ -46,9 +72,10 @@ dispatch('resize', { width: element.clientWidth, height: element.clientHeight }) }} class="floorGrid" - style:grid-template-columns={`repeat(${GRID_WIDTH + 2}, 1fr)`} + {style} + style:grid-template-columns={`repeat(${FULL_GW}, 1fr)`} style:grid-template-rows={rows ? `repeat(${rows}, 1fr)` : undefined} - style:max-width={`${(GRID_WIDTH + 2) * 4}rem`} + style:aspect-ratio={`${FULL_GW} / ${rows}`} style:margin-inline={marginInline} > @@ -59,12 +86,13 @@ .floorGrid { position: relative; display: grid; - grid-template-columns: repeat(17, 1fr); grid-auto-flow: row; grid-auto-rows: 1fr; place-items: stretch; - place-content: center; + place-content: start center; + flex-shrink: 0; gap: 0; width: 100%; + container: floorGridContainer / inline-size; } diff --git a/plugins/love-resources/src/components/FloorPreview.svelte b/plugins/love-resources/src/components/FloorPreview.svelte index 7e5372e1ac..39f979c2f4 100644 --- a/plugins/love-resources/src/components/FloorPreview.svelte +++ b/plugins/love-resources/src/components/FloorPreview.svelte @@ -107,6 +107,7 @@ {disabled} {kind} categoryHeader + contentAlign={'center'} on:select > diff --git a/plugins/love-resources/src/components/FloorView.svelte b/plugins/love-resources/src/components/FloorView.svelte index c75c55d28d..a7b19d2964 100644 --- a/plugins/love-resources/src/components/FloorView.svelte +++ b/plugins/love-resources/src/components/FloorView.svelte @@ -32,8 +32,8 @@ $: rows = calculateFloorSize(rooms) - 1 - - + + {#each rooms as room} {/each} diff --git a/plugins/love-resources/src/components/ParticipantView.svelte b/plugins/love-resources/src/components/ParticipantView.svelte index 88a4f77db9..df0b6d70f8 100644 --- a/plugins/love-resources/src/components/ParticipantView.svelte +++ b/plugins/love-resources/src/components/ParticipantView.svelte @@ -139,14 +139,14 @@ .label { position: absolute; - bottom: 0; + top: 0; left: 0; max-width: 100%; - padding: 0.25rem 0.5rem 0.5rem 1rem; + padding: 0.5rem 0.5rem 0.25rem 1rem; color: white; font-weight: 500; background-color: rgba(0, 0, 0, 0.3); - border-radius: 0 0.25rem 0 0.75rem; + border-radius: 0.75rem 0 0.25rem 0; display: flex; align-items: center; gap: 0.25rem; @@ -158,8 +158,8 @@ text-shadow: 0 0 0.25rem black; } &.filled { - padding: 0.25rem 1rem 0.5rem 1rem; - border-radius: 0 0 0.75rem 0.75rem; + padding: 0.5rem 1rem 0.25rem 1rem; + border-radius: 0.75rem 0.75rem 0 0; } } &.small .label { diff --git a/plugins/love-resources/src/components/RoomPreview.svelte b/plugins/love-resources/src/components/RoomPreview.svelte index d9b6f575f5..c0cf39e67e 100644 --- a/plugins/love-resources/src/components/RoomPreview.svelte +++ b/plugins/love-resources/src/components/RoomPreview.svelte @@ -144,7 +144,6 @@
([]) export const myOffice = derived(rooms, (val) => { @@ -141,3 +142,5 @@ onClient(() => { ) }) export const lockedRoom = writable('') + +export const loveUseMaxWidth = writable(getLoveUseMaxWidth()) diff --git a/plugins/love-resources/src/utils.ts b/plugins/love-resources/src/utils.ts index 038a3b8522..3d5befbf1f 100644 --- a/plugins/love-resources/src/utils.ts +++ b/plugins/love-resources/src/utils.ts @@ -86,7 +86,14 @@ import { get, writable } from 'svelte/store' import { sendMessage } from './broadcast' import RoomSettingsPopup from './components/RoomSettingsPopup.svelte' import love from './plugin' -import { $myPreferences, currentMeetingMinutes, currentRoom, myOffice, selectedRoomPlace } from './stores' +import { + $myPreferences, + currentMeetingMinutes, + currentRoom, + myOffice, + selectedRoomPlace, + loveUseMaxWidth +} from './stores' export const selectedCamId = 'selectedDevice_cam' export const selectedMicId = 'selectedDevice_mic' @@ -1158,3 +1165,18 @@ export async function getMeetingMinutesTitle ( return meeting?.title ?? '' } + +// Floor Scaling (Max Width) +const useMaxWidthKey = 'loveUseMaxWidth' +export const saveLoveUseMaxWidth = (useMaxWidth: boolean): void => { + if (useMaxWidth) localStorage.setItem(useMaxWidthKey, 'true') + else localStorage.removeItem(useMaxWidthKey) +} +export const getLoveUseMaxWidth = (): boolean => { + return localStorage.getItem(useMaxWidthKey) === 'true' +} +export const toggleLoveUseMaxWidth = (): void => { + const value = !get(loveUseMaxWidth) + loveUseMaxWidth.set(value) + saveLoveUseMaxWidth(value) +}