diff options
Diffstat (limited to 'test-client/tiles.ts')
| -rw-r--r-- | test-client/tiles.ts | 37 | 
1 files changed, 34 insertions, 3 deletions
| diff --git a/test-client/tiles.ts b/test-client/tiles.ts index 5eee2b32..5a6769ed 100644 --- a/test-client/tiles.ts +++ b/test-client/tiles.ts @@ -7,8 +7,39 @@ function base(fill: string, stroke?: string, stroke_width?: number): Component {          c.lineWidth = stroke_width ?? 0.05          c.lineJoin = "miter"          c.lineCap = "square" -        c.fillRect(-0.5, -0.5, 1, 1) -        if (stroke) c.strokeRect(-0.5 + c.lineWidth / 2, -0.5 + c.lineWidth / 2, 1 - c.lineWidth, 1 - c.lineWidth) +        c.fillRect( +            -0.5, +            -0.5, +            1, +            1 +        ) +        if (stroke) c.strokeRect( +            -0.5 + c.lineWidth / 2, +            -0.5 + c.lineWidth / 2, +            1 - c.lineWidth, +            1 - c.lineWidth +        ) +    } +} +function rect(inset: number, fill: string, stroke?: string, stroke_width?: number): Component { +    return c => { +        c.fillStyle = fill; +        c.strokeStyle = stroke ?? "black"; +        c.lineWidth = stroke_width ?? 0.05 +        c.lineJoin = "round" +        c.lineCap = "round" +        c.fillRect( +            -0.5 + inset, +            -0.5 + inset, +            1 - inset * 2, +            1 - inset * 2 +        ) +        if (stroke) c.strokeRect( +            -0.5 + inset, +            -0.5 + inset, +            1 - inset * 2, +            1 - inset * 2 +        )      }  }  function circle(radius: number, fill: string, stroke?: string, stroke_width?: number): Component { @@ -93,7 +124,7 @@ export const TILES: { [key: string]: Component[] } = {      "chair": [...floor, circle(0.45, "rgb(136, 83, 41)")],      "wall": [base("rgb(0, 14, 56)")],      "window": [base("rgb(233, 233, 233)")], -    "watercooler": [...floor, circle(0.4, "rgb(64, 226, 207)")], +    "cuttingboard": [...counter, rect(0.3, "rgb(158, 236, 68)", "rgb(158, 236, 68)", 0.2)],      "trash": [...floor, circle(0.4, "rgb(20, 20, 20)"), cross(0.3, "rgb(90, 36, 36)")],      "sink": [base("rgb(131, 129, 161)", "rgb(177, 174, 226)", 0.2)],      "oven": [base("rgb(241, 97, 61)", "rgb(109, 84, 84)", 0.3)], | 
