chore: keep split positions when zooming (#26942)

This commit is contained in:
Pavel Feldman 2023-09-08 12:30:08 -07:00 committed by GitHub
parent e6d9b2a818
commit 8ba8c9385d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,11 +46,11 @@ export const SplitView: React.FC<SplitViewProps> = ({
let size: number; let size: number;
if (orientation === 'vertical') { if (orientation === 'vertical') {
size = vSize; size = vSize / window.devicePixelRatio;
if (measure && measure.height < vSize) if (measure && measure.height < vSize)
size = measure.height - 10; size = measure.height - 10;
} else { } else {
size = hSize; size = hSize / window.devicePixelRatio;
if (measure && measure.width < hSize) if (measure && measure.width < hSize)
size = measure.width - 10; size = measure.width - 10;
} }
@ -90,9 +90,9 @@ export const SplitView: React.FC<SplitViewProps> = ({
const rect = splitView.getBoundingClientRect(); const rect = splitView.getBoundingClientRect();
const size = Math.min(Math.max(minSidebarSize, newSize), (orientation === 'vertical' ? rect.height : rect.width) - minSidebarSize); const size = Math.min(Math.max(minSidebarSize, newSize), (orientation === 'vertical' ? rect.height : rect.width) - minSidebarSize);
if (orientation === 'vertical') if (orientation === 'vertical')
setVSize(size); setVSize(size * window.devicePixelRatio);
else else
setHSize(size); setHSize(size * window.devicePixelRatio);
} }
}} }}
></div> } ></div> }