diff --git a/docs/ui/ios/location-layout.html b/docs/ui/ios/location-layout.html index 49c5cf9..0ee949b 100644 --- a/docs/ui/ios/location-layout.html +++ b/docs/ui/ios/location-layout.html @@ -248,7 +248,7 @@ zone: ["开放区域", "zone", 27, 25], sofa: ["沙发", "furniture", 25, 13], wardrobe: ["衣柜", "furniture", 30, 19], cabinet: ["电视柜", "furniture", 40, 14], shelf: ["书架", "furniture", 20, 26], - bed: ["床", "furniture", 29, 36], desk: ["桌子", "furniture", 32, 19], + bed: ["床", "furniture", 22, 36], desk: ["桌子", "furniture", 32, 19], rack: ["层架", "furniture", 24, 20], box: ["收纳箱", "furniture", 16, 20], table: ["边几", "furniture", 18, 19], generic: ["其他", "zone", 20, 20] @@ -338,11 +338,17 @@ [62,23,21,36,"sageLight",4],[87,23,21,36,"sageLight",4]] }; function illustration(mold) { + const pieces = silhouettes[mold]; + const left = Math.min(...pieces.map(([x]) => x)) - 2; + const top = Math.min(...pieces.map(([,y]) => y)) - 2; + const right = Math.max(...pieces.map(([x,,w]) => x + w)) + 2; + const bottom = Math.max(...pieces.map(([,y,,h]) => y + h)) + 2; const drawing = document.createElement("canvas"); - drawing.width = 240; drawing.height = 160; + drawing.width = (right - left) * 2; drawing.height = (bottom - top) * 2; const pen = drawing.getContext("2d"); - pen.scale(2,2); pen.strokeStyle = "#594e50"; pen.lineWidth = 1.5; - silhouettes[mold].forEach(([x,y,w,h,color,radius]) => { + pen.scale(2,2); pen.translate(-left,-top); + pen.strokeStyle = "#594e50"; pen.lineWidth = 1.5; + pieces.forEach(([x,y,w,h,color,radius]) => { pen.beginPath(); pen.roundRect(x,y,w,h,radius); pen.fillStyle = palette[color]; pen.fill(); pen.stroke(); });