mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 16:04:21 +00:00
Tiling compositors ignore a client's minimum size, so a tile narrower than 800 px laid the webview out at 800 px and scaled it down. The minimum is now 400 px on every platform. At that width the welcome page header and action tiles wrap, the title bar's run and VCS widgets ellipsize instead of covering the toolbar, dialog footers wrap, and below 560 px the left and right tool windows collapse (their stripe buttons stay, the saved layout is unchanged, a wider window brings them back). Closes #3046 Co-authored-by: TaylorBurke <TaylorBurke@users.noreply.github.com>
26 lines
1.2 KiB
TypeScript
26 lines
1.2 KiB
TypeScript
/**
|
|
* In a window too narrow for the side tool windows (a tile on a tiling compositor), the left and
|
|
* right areas collapse so the editor keeps the width. Their stripe buttons stay; the saved layout
|
|
* is untouched, and a wider window puts them back. Keep the breakpoint in step with the
|
|
* `max-width: 560px` queries in Welcome.module.css and TitleBar.module.css.
|
|
*/
|
|
import { collapseSidesForNarrowWindow, restoreSidesAfterNarrowWindow, useToolWindowLayout } from "./toolwindows/store";
|
|
|
|
export const NARROW_WINDOW_QUERY = "(max-width: 560px)";
|
|
|
|
export function installNarrowWindow(): () => void {
|
|
if (typeof window.matchMedia !== "function") return () => {};
|
|
const query = window.matchMedia(NARROW_WINDOW_QUERY);
|
|
const apply = () => (query.matches ? collapseSidesForNarrowWindow() : restoreSidesAfterNarrowWindow());
|
|
query.addEventListener("change", apply);
|
|
// A project's layout loads afresh each time it opens, the same project again included.
|
|
const unsubscribe = useToolWindowLayout.subscribe((s, prev) => {
|
|
if (s.layoutLoads !== prev.layoutLoads && query.matches) collapseSidesForNarrowWindow();
|
|
});
|
|
apply();
|
|
return () => {
|
|
query.removeEventListener("change", apply);
|
|
unsubscribe();
|
|
};
|
|
}
|