diff --git a/apps/stage-tamagotchi/src/renderer/pages/chat-floating.vue b/apps/stage-tamagotchi/src/renderer/pages/chat-floating.vue index 2151edd43b..3baf65e3c4 100644 --- a/apps/stage-tamagotchi/src/renderer/pages/chat-floating.vue +++ b/apps/stage-tamagotchi/src/renderer/pages/chat-floating.vue @@ -8,7 +8,7 @@ import { ChatSessionsDrawer } from '@proj-airi/stage-ui/components' import { useDanmakuFeedExpiry } from '@proj-airi/stage-ui/composables/use-danmaku-feed-expiry' import { useAiriCardStore } from '@proj-airi/stage-ui/stores/modules/airi-card' import { useSettings } from '@proj-airi/stage-ui/stores/settings' -import { refDebounced, useEventListener, useFocusWithin, useLocalStorage, useMutationObserver, usePreferredReducedMotion } from '@vueuse/core' +import { refDebounced, useElementSize, useEventListener, useFocusWithin, useLocalStorage, useMutationObserver, usePreferredReducedMotion } from '@vueuse/core' import { animate, createSpring } from 'animejs' import { storeToRefs } from 'pinia' import { computed, nextTick, onMounted, onScopeDispose, shallowRef, useTemplateRef, watch } from 'vue' @@ -142,12 +142,23 @@ useMutationObserver(dockZone, () => { const dockOpen = computed(() => !verticalDock.value || cursorNearDock.value || cursorNearDockLately.value || dockFocused.value || dockMenuOpen.value) const dockElement = useTemplateRef('dock') + +/** The padding of the zone along a dock that stands up, in pixels. It matches the `py-4` of the zone. */ +const DOCK_ZONE_PADDING = 16 +// A dock that stands up centers on the dock alone. The island below it only makes the zone longer, so the dock does +// not move when the island buds off or goes back. +const { height: dockHeight } = useElementSize(dockElement, undefined, { box: 'border-box' }) +const verticalDockZoneStyle = computed(() => ({ transform: `translateY(${-(DOCK_ZONE_PADDING + dockHeight.value / 2)}px)` })) /** - * The bar of a closed dock: 3px wide and 56px tall, at the middle of the dock, on its side of the window edge. + * The bar of a closed dock: 8px wide and 56px tall, at the middle of the dock, on its side of the window edge. * The dock stands 10px from the edge, just past the hover scrollbar, so the bar sits between the scrollbar and the messages. */ -const DOCK_BAR = { width: 3, height: 56, edgeInset: 0 } -const DOCK_OPEN_CLIP = 'inset(0px 0px 0px 0px round 999px)' +const DOCK_BAR = { width: 8, height: 56, edgeInset: 0 } +/** + * The clip of an open dock. It reaches 4px past the dock, so the focus ring of a button is not cut. The ring is 2px + * wide and 2px from the button, and the button is 2px inside the dock. + */ +const DOCK_OPEN_CLIP = 'inset(-4px -4px -4px -4px round 999px)' /** The clip that leaves only the bar of the dock. */ function dockBarClip(dock: HTMLElement) { @@ -463,8 +474,9 @@ function moveByKeyboard(delta: WindowDelta) {