Remove code to round newSize on resize (#34543)
This never actually fixed the issue of the call elements being blurry due to fractional pixels. But it also causes other issues like the max/min width of the left panel never being persisted in settings.
This commit is contained in:
@@ -147,19 +147,4 @@ describe("LeftPanelResizerViewModel", () => {
|
|||||||
vm.onLeftPanelResized(50);
|
vm.onLeftPanelResized(50);
|
||||||
expect(mockHandle.resize).not.toHaveBeenCalled();
|
expect(mockHandle.resize).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should resize to nearest whole number", () => {
|
|
||||||
const vm = new ResizerViewModel(CallStore.instance);
|
|
||||||
const mockHandle = {
|
|
||||||
resize: vi.fn(),
|
|
||||||
getSize: vi.fn().mockReturnValue(0),
|
|
||||||
} as unknown as PanelImperativeHandle;
|
|
||||||
vm.setPanelHandle(mockHandle);
|
|
||||||
|
|
||||||
// Initial call is ignored
|
|
||||||
vm.onLeftPanelResized(70);
|
|
||||||
// This should be processed
|
|
||||||
vm.onLeftPanelResized(25.515);
|
|
||||||
expect(mockHandle.resize).toHaveBeenLastCalledWith("26%");
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -99,12 +99,6 @@ export class ResizerViewModel
|
|||||||
|
|
||||||
this.autoCollapse.onLeftPanelResized();
|
this.autoCollapse.onLeftPanelResized();
|
||||||
|
|
||||||
// We don't want the panels to have fractional widths as that can cause blurry UI elements.
|
|
||||||
if (!Number.isInteger(newSize)) {
|
|
||||||
this.panelHandle?.resize(`${Math.round(newSize)}%`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const isCollapsed = newSize === 0;
|
const isCollapsed = newSize === 0;
|
||||||
// Store the size if the panel isn't collapsed.
|
// Store the size if the panel isn't collapsed.
|
||||||
if (!isCollapsed) {
|
if (!isCollapsed) {
|
||||||
|
|||||||
Reference in New Issue
Block a user