third commit
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Group, Rect } from "react-konva";
|
||||
import type { FurnitureType } from "../types";
|
||||
import type { Shape } from "../types";
|
||||
|
||||
export type Outline = "normal" | "selected" | "valid" | "invalid";
|
||||
|
||||
@@ -11,7 +11,7 @@ const STROKE: Record<Outline, string> = {
|
||||
};
|
||||
|
||||
interface Props {
|
||||
type: FurnitureType;
|
||||
shape: Shape;
|
||||
width: number; // meters
|
||||
height: number;
|
||||
pxPerM: number;
|
||||
@@ -20,13 +20,13 @@ interface Props {
|
||||
}
|
||||
|
||||
/** Top-down shape drawn at local (0,0). Position is set by the parent Group. */
|
||||
export function FurnitureShape({ type, width, height, pxPerM, outline, opacity = 1 }: Props) {
|
||||
export function FurnitureShape({ shape, width, height, pxPerM, outline, opacity = 1 }: Props) {
|
||||
const w = width * pxPerM;
|
||||
const h = height * pxPerM;
|
||||
const stroke = STROKE[outline];
|
||||
const strokeWidth = outline === "normal" ? 1.5 : 3;
|
||||
|
||||
if (type === "screen") {
|
||||
if (shape === "screen") {
|
||||
const inset = Math.min(3, h / 4);
|
||||
return (
|
||||
<Group opacity={opacity}>
|
||||
@@ -35,7 +35,7 @@ export function FurnitureShape({ type, width, height, pxPerM, outline, opacity =
|
||||
</Group>
|
||||
);
|
||||
}
|
||||
if (type === "table") {
|
||||
if (shape === "table") {
|
||||
return (
|
||||
<Group opacity={opacity}>
|
||||
<Rect width={w} height={h} fill="#d9b382" stroke={stroke} strokeWidth={strokeWidth} cornerRadius={3} />
|
||||
|
||||
Reference in New Issue
Block a user