fix(calendar): use full available calendar viewport height on desktop
This commit is contained in:
@@ -2310,6 +2310,10 @@ onBeforeUnmount(() => {
|
|||||||
clearInterval(lifecycleClock);
|
clearInterval(lifecycleClock);
|
||||||
lifecycleClock = null;
|
lifecycleClock = null;
|
||||||
}
|
}
|
||||||
|
if (calendarViewportResizeObserver) {
|
||||||
|
calendarViewportResizeObserver.disconnect();
|
||||||
|
calendarViewportResizeObserver = null;
|
||||||
|
}
|
||||||
clearCalendarZoomPrime();
|
clearCalendarZoomPrime();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2360,16 +2364,29 @@ type CalendarRect = { left: number; top: number; width: number; height: number }
|
|||||||
const calendarContentWrapRef = ref<HTMLElement | null>(null);
|
const calendarContentWrapRef = ref<HTMLElement | null>(null);
|
||||||
const calendarContentScrollRef = ref<HTMLElement | null>(null);
|
const calendarContentScrollRef = ref<HTMLElement | null>(null);
|
||||||
const calendarSceneRef = ref<HTMLElement | null>(null);
|
const calendarSceneRef = ref<HTMLElement | null>(null);
|
||||||
|
const calendarViewportHeight = ref(0);
|
||||||
const calendarHoveredMonthIndex = ref<number | null>(null);
|
const calendarHoveredMonthIndex = ref<number | null>(null);
|
||||||
const calendarHoveredWeekStartKey = ref("");
|
const calendarHoveredWeekStartKey = ref("");
|
||||||
const calendarHoveredDayKey = ref("");
|
const calendarHoveredDayKey = ref("");
|
||||||
|
let calendarViewportResizeObserver: ResizeObserver | null = null;
|
||||||
|
|
||||||
function setCalendarContentWrapRef(element: HTMLElement | null) {
|
function setCalendarContentWrapRef(element: HTMLElement | null) {
|
||||||
calendarContentWrapRef.value = element;
|
calendarContentWrapRef.value = element;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCalendarContentScrollRef(element: HTMLElement | null) {
|
function setCalendarContentScrollRef(element: HTMLElement | null) {
|
||||||
|
if (calendarViewportResizeObserver) {
|
||||||
|
calendarViewportResizeObserver.disconnect();
|
||||||
|
calendarViewportResizeObserver = null;
|
||||||
|
}
|
||||||
calendarContentScrollRef.value = element;
|
calendarContentScrollRef.value = element;
|
||||||
|
if (element && typeof ResizeObserver !== "undefined") {
|
||||||
|
calendarViewportResizeObserver = new ResizeObserver(() => {
|
||||||
|
calendarViewportHeight.value = Math.max(0, Math.round(element.clientHeight));
|
||||||
|
});
|
||||||
|
calendarViewportResizeObserver.observe(element);
|
||||||
|
calendarViewportHeight.value = Math.max(0, Math.round(element.clientHeight));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCalendarSceneRef(element: HTMLElement | null) {
|
function setCalendarSceneRef(element: HTMLElement | null) {
|
||||||
@@ -4765,6 +4782,7 @@ async function decideFeedCard(card: FeedCard, decision: "accepted" | "rejected")
|
|||||||
:set-calendar-content-scroll-ref="setCalendarContentScrollRef"
|
:set-calendar-content-scroll-ref="setCalendarContentScrollRef"
|
||||||
:on-calendar-hierarchy-wheel="onCalendarHierarchyWheel"
|
:on-calendar-hierarchy-wheel="onCalendarHierarchyWheel"
|
||||||
:set-calendar-scene-ref="setCalendarSceneRef"
|
:set-calendar-scene-ref="setCalendarSceneRef"
|
||||||
|
:calendar-viewport-height="calendarViewportHeight"
|
||||||
:normalized-calendar-view="normalizedCalendarView"
|
:normalized-calendar-view="normalizedCalendarView"
|
||||||
:calendar-scene-transform-style="calendarSceneTransformStyle"
|
:calendar-scene-transform-style="calendarSceneTransformStyle"
|
||||||
:on-calendar-scene-mouse-leave="onCalendarSceneMouseLeave"
|
:on-calendar-scene-mouse-leave="onCalendarSceneMouseLeave"
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ defineProps<{
|
|||||||
setCalendarContentScrollRef: (element: HTMLDivElement | null) => void;
|
setCalendarContentScrollRef: (element: HTMLDivElement | null) => void;
|
||||||
onCalendarHierarchyWheel: (event: WheelEvent) => void;
|
onCalendarHierarchyWheel: (event: WheelEvent) => void;
|
||||||
setCalendarSceneRef: (element: HTMLDivElement | null) => void;
|
setCalendarSceneRef: (element: HTMLDivElement | null) => void;
|
||||||
|
calendarViewportHeight: number;
|
||||||
normalizedCalendarView: string;
|
normalizedCalendarView: string;
|
||||||
calendarSceneTransformStyle: Record<string, string>;
|
calendarSceneTransformStyle: Record<string, string>;
|
||||||
onCalendarSceneMouseLeave: () => void;
|
onCalendarSceneMouseLeave: () => void;
|
||||||
@@ -182,7 +183,12 @@ defineProps<{
|
|||||||
calendarHoveredMonthIndex === item.monthIndex ? 'calendar-hover-target' : '',
|
calendarHoveredMonthIndex === item.monthIndex ? 'calendar-hover-target' : '',
|
||||||
calendarZoomPrimeToken === calendarPrimeMonthToken(item.monthIndex) ? 'calendar-zoom-prime-active' : '',
|
calendarZoomPrimeToken === calendarPrimeMonthToken(item.monthIndex) ? 'calendar-zoom-prime-active' : '',
|
||||||
]"
|
]"
|
||||||
:style="calendarPrimeStyle(calendarPrimeMonthToken(item.monthIndex))"
|
:style="{
|
||||||
|
...calendarPrimeStyle(calendarPrimeMonthToken(item.monthIndex)),
|
||||||
|
...(calendarView !== 'year' && item.monthIndex === calendarCursorMonth && calendarViewportHeight > 0
|
||||||
|
? { minHeight: `${Math.max(420, calendarViewportHeight)}px` }
|
||||||
|
: {}),
|
||||||
|
}"
|
||||||
:data-calendar-month-index="item.monthIndex"
|
:data-calendar-month-index="item.monthIndex"
|
||||||
@mouseenter="setCalendarHoveredMonthIndex(item.monthIndex)"
|
@mouseenter="setCalendarHoveredMonthIndex(item.monthIndex)"
|
||||||
@click="calendarView === 'year' ? zoomToMonth(item.monthIndex) : undefined"
|
@click="calendarView === 'year' ? zoomToMonth(item.monthIndex) : undefined"
|
||||||
|
|||||||
Reference in New Issue
Block a user