feat(view): show transform measurements

This commit is contained in:
syntaxbullet
2026-07-03 16:08:45 +02:00
parent 166310ace0
commit ff5bb43382
3 changed files with 40 additions and 3 deletions

View File

@@ -0,0 +1,28 @@
import { BoundingBox } from "@phosphor-icons/react";
import type { Rect } from "@core/geometry";
import { BottomControlDivider } from "./Divider";
import { bottomControlIconSlotClass, bottomControlLabelClass, bottomControlValueClass } from "./styles";
export type TransformControlsProps = {
bounds: Rect;
};
export function TransformControls({ bounds }: TransformControlsProps) {
return (
<div className="flex w-full items-center justify-center gap-2 tabular-nums">
<span className={bottomControlIconSlotClass()}>
<BoundingBox size={16} weight="regular" />
</span>
<BottomControlDivider />
<span className={bottomControlLabelClass()}>X</span>
<span className={bottomControlValueClass()}>{Math.round(bounds.x)}</span>
<span className={bottomControlLabelClass()}>Y</span>
<span className={bottomControlValueClass()}>{Math.round(bounds.y)}</span>
<BottomControlDivider />
<span className={bottomControlLabelClass()}>W</span>
<span className={bottomControlValueClass()}>{Math.round(bounds.w)}</span>
<span className={bottomControlLabelClass()}>H</span>
<span className={bottomControlValueClass()}>{Math.round(bounds.h)}</span>
</div>
);
}