refactor: open search from titlebar command
This commit is contained in:
@@ -33,16 +33,9 @@ export function calculateSearchOverlayLayout(
|
||||
const mobile = viewportWidth < MOBILE_BREAKPOINT;
|
||||
const margin = mobile ? MOBILE_MARGIN : DESKTOP_MARGIN;
|
||||
const width = Math.max(1, Math.min(DESKTOP_PANEL_WIDTH, viewportWidth - margin * 2));
|
||||
const centeredLeft = anchor.left + anchor.width / 2 - width / 2;
|
||||
const left = mobile
|
||||
? margin
|
||||
: clamp(centeredLeft, margin, Math.max(margin, viewportWidth - width - margin));
|
||||
const inputWidth = mobile
|
||||
? width
|
||||
: Math.min(Math.max(1, anchor.width), width);
|
||||
const inputOffset = mobile
|
||||
? 0
|
||||
: clamp(anchor.left - left, 0, Math.max(0, width - inputWidth));
|
||||
const left = Math.max(margin, (viewportWidth - width) / 2);
|
||||
const inputWidth = width;
|
||||
const inputOffset = 0;
|
||||
const top = Math.max(0, anchor.top);
|
||||
const inputHeight = Math.max(1, anchor.height);
|
||||
const availableResultsHeight = viewportHeight - top - inputHeight - RESULTS_GAP - margin;
|
||||
@@ -89,7 +82,3 @@ function normalizePath(value: string): string {
|
||||
const normalized = `/${String(value || "").trim().replace(/^\/+|\/+$/g, "")}`;
|
||||
return normalized === "/" ? normalized : normalized.replace(/\/+$/g, "");
|
||||
}
|
||||
|
||||
function clamp(value: number, minimum: number, maximum: number): number {
|
||||
return Math.min(Math.max(value, minimum), maximum);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user