second commit
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { Group, Rect } from "react-konva";
|
||||
import type { FurnitureType } from "../types";
|
||||
|
||||
export type Outline = "normal" | "valid" | "invalid";
|
||||
export type Outline = "normal" | "selected" | "valid" | "invalid";
|
||||
|
||||
const STROKE: Record<Outline, string> = {
|
||||
normal: "#3b3b3b",
|
||||
selected: "#1c7ed6",
|
||||
valid: "#2f9e44",
|
||||
invalid: "#e03131",
|
||||
};
|
||||
@@ -25,6 +26,15 @@ export function FurnitureShape({ type, width, height, pxPerM, outline, opacity =
|
||||
const stroke = STROKE[outline];
|
||||
const strokeWidth = outline === "normal" ? 1.5 : 3;
|
||||
|
||||
if (type === "screen") {
|
||||
const inset = Math.min(3, h / 4);
|
||||
return (
|
||||
<Group opacity={opacity}>
|
||||
<Rect width={w} height={h} fill="#2d3748" stroke={stroke} strokeWidth={strokeWidth} cornerRadius={2} />
|
||||
<Rect x={inset} y={inset} width={Math.max(0, w - inset * 2)} height={Math.max(0, h - inset * 2)} fill="#63b3ed" listening={false} />
|
||||
</Group>
|
||||
);
|
||||
}
|
||||
if (type === "table") {
|
||||
return (
|
||||
<Group opacity={opacity}>
|
||||
|
||||
Reference in New Issue
Block a user