fix window snap issue

This commit is contained in:
Boof2015
2026-04-23 01:19:08 -04:00
parent d9e12375f5
commit c5997e0a79
3 changed files with 52 additions and 2 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
import { useLayoutEffect, useMemo, useRef, type CSSProperties, type JSX } from 'react'
import { buildAnalyzerGridTemplateColumns } from '../analyzerLayout'
import { resolveMainWindowSettingsPanelHeight } from '../mainWindowSettings'
import ScopeSettingsSection from './ScopeSettingsSection'
import { useSettingsStore } from '../stores/settingsStore'
@@ -31,7 +32,7 @@ export default function SettingsPanel({ onHeightChange }: SettingsPanelProps): J
const reportHeight = (): void => {
cancelAnimationFrame(frameId)
frameId = requestAnimationFrame(() => {
onHeightChange(Math.ceil(panelElement.scrollHeight))
onHeightChange(resolveMainWindowSettingsPanelHeight(panelElement, scopeTrackRef.current))
})
}
+20
View File
@@ -1,3 +1,23 @@
function parseCssPixels(value: string): number {
const parsed = Number.parseFloat(value)
return Number.isFinite(parsed) ? parsed : 0
}
export function resolveMainWindowSettingsPanelHeight(
panelElement: HTMLElement,
contentElement: HTMLElement | null,
): number {
if (!contentElement) {
return Math.ceil(panelElement.scrollHeight)
}
const panelStyle = getComputedStyle(panelElement)
const verticalPadding = parseCssPixels(panelStyle.paddingTop)
+ parseCssPixels(panelStyle.paddingBottom)
return Math.ceil(contentElement.scrollHeight + verticalPadding)
}
export function resolveMainWindowSettingsHeight(
settingsOpen: boolean,
settingsPanelHeight: number,