add svg scaling for imperial when detected
This commit is contained in:
parent
c2aab585d1
commit
d93474d2fa
2 changed files with 7 additions and 4 deletions
|
|
@ -24,8 +24,9 @@ function parse(text, opt = { soup: true }) {
|
||||||
const paths = data.paths;
|
const paths = data.paths;
|
||||||
const xmlat = data.xml.attributes;
|
const xmlat = data.xml.attributes;
|
||||||
const polys = fromSoup ? [] : undefined;
|
const polys = fromSoup ? [] : undefined;
|
||||||
const depth = opt.depth || xmlat['data-km-extrude']
|
const scale = xmlat.width?.value.endsWith('in') ? 25.4 : 1;
|
||||||
|| xmlat['extrude']
|
const depth = opt.depth || xmlat['data-km-extrude']?.value
|
||||||
|
|| xmlat['extrude']?.value
|
||||||
|| {value: 5};
|
|| {value: 5};
|
||||||
|
|
||||||
for (let i = 0; i < paths.length; i++) {
|
for (let i = 0; i < paths.length; i++) {
|
||||||
|
|
@ -43,6 +44,9 @@ function parse(text, opt = { soup: true }) {
|
||||||
if (type === 'polyline') poly.setOpen(true);
|
if (type === 'polyline') poly.setOpen(true);
|
||||||
poly._svg = { width, miter };
|
poly._svg = { width, miter };
|
||||||
polys.push(poly);
|
polys.push(poly);
|
||||||
|
if (scale !== 1) {
|
||||||
|
poly.scale({ x: scale, y: scale, z: 1 });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -543,8 +543,7 @@ button:hover {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tools i, .tools svg {
|
.tools i {
|
||||||
aspect-ratio: 1;
|
|
||||||
padding: 9px;
|
padding: 9px;
|
||||||
border-bottom: 1px solid var(--border);
|
border-bottom: 1px solid var(--border);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue