fix: 对齐家具插画和模板占地
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
27d4a8fb8e
commit
137de8bc52
|
|
@ -248,7 +248,7 @@
|
||||||
zone: ["开放区域", "zone", 27, 25],
|
zone: ["开放区域", "zone", 27, 25],
|
||||||
sofa: ["沙发", "furniture", 25, 13], wardrobe: ["衣柜", "furniture", 30, 19],
|
sofa: ["沙发", "furniture", 25, 13], wardrobe: ["衣柜", "furniture", 30, 19],
|
||||||
cabinet: ["电视柜", "furniture", 40, 14], shelf: ["书架", "furniture", 20, 26],
|
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],
|
rack: ["层架", "furniture", 24, 20],
|
||||||
box: ["收纳箱", "furniture", 16, 20], table: ["边几", "furniture", 18, 19],
|
box: ["收纳箱", "furniture", 16, 20], table: ["边几", "furniture", 18, 19],
|
||||||
generic: ["其他", "zone", 20, 20]
|
generic: ["其他", "zone", 20, 20]
|
||||||
|
|
@ -338,11 +338,17 @@
|
||||||
[62,23,21,36,"sageLight",4],[87,23,21,36,"sageLight",4]]
|
[62,23,21,36,"sageLight",4],[87,23,21,36,"sageLight",4]]
|
||||||
};
|
};
|
||||||
function illustration(mold) {
|
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");
|
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");
|
const pen = drawing.getContext("2d");
|
||||||
pen.scale(2,2); pen.strokeStyle = "#594e50"; pen.lineWidth = 1.5;
|
pen.scale(2,2); pen.translate(-left,-top);
|
||||||
silhouettes[mold].forEach(([x,y,w,h,color,radius]) => {
|
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.beginPath(); pen.roundRect(x,y,w,h,radius);
|
||||||
pen.fillStyle = palette[color]; pen.fill(); pen.stroke();
|
pen.fillStyle = palette[color]; pen.fill(); pen.stroke();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue