import { Minus, CornersOut, Hand, Plus } from "@phosphor-icons/react";
import { commandIds } from "@commands/ids";
import type { AppStore } from "@editor/store";
import type { ViewportState } from "@editor/state";
export type BottomControlsAction = "pan" | "zoom";
export type BottomControlsIslandProps = {
viewport: ViewportState;
visible: boolean;
action: BottomControlsAction;
dispatch: AppStore["dispatch"];
};
export function BottomControlsIsland({ viewport, visible, action, dispatch }: BottomControlsIslandProps) {
const zoomPercent = Math.round(viewport.zoom * 100);
const x = Math.round(viewport.center.x);
const y = Math.round(viewport.center.y);
return (
);
}
function PanControls({ x, y }: { x: number; y: number }) {
return (
);
}
function ZoomControls({ zoom, zoomPercent, dispatch }: { zoom: number; zoomPercent: number; dispatch: AppStore["dispatch"] }) {
return (
<>
{zoomPercent}%
>
);
}
function Divider() {
return ;
}
function labelClass() {
return "text-white/60";
}
function valueClass() {
return "min-w-10 text-center text-white";
}
function iconSlotClass() {
return "grid size-7 place-items-center rounded-full text-white/80";
}
function buttonClass() {
return `${iconSlotClass()} transition hover:bg-white/10 hover:text-white focus:outline-none focus-visible:outline-none`;
}