fix: positions stats for linear elements (#3331)

This commit is contained in:
David Luzar 2021-03-26 21:56:27 +01:00 committed by GitHub
parent 10a23a10a5
commit b081a09962
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,31 +120,17 @@ export const Stats = (props: {
<>
<tr>
<td>{"x"}</td>
<td>
{Math.round(
selectedElements.length === 1
? selectedElements[0].x
: selectedBoundingBox[0],
)}
</td>
<td>{Math.round(selectedBoundingBox[0])}</td>
</tr>
<tr>
<td>{"y"}</td>
<td>
{Math.round(
selectedElements.length === 1
? selectedElements[0].y
: selectedBoundingBox[1],
)}
</td>
<td>{Math.round(selectedBoundingBox[1])}</td>
</tr>
<tr>
<td>{t("stats.width")}</td>
<td>
{Math.round(
selectedElements.length === 1
? selectedElements[0].width
: selectedBoundingBox[2] - selectedBoundingBox[0],
selectedBoundingBox[2] - selectedBoundingBox[0],
)}
</td>
</tr>
@ -152,9 +138,7 @@ export const Stats = (props: {
<td>{t("stats.height")}</td>
<td>
{Math.round(
selectedElements.length === 1
? selectedElements[0].height
: selectedBoundingBox[3] - selectedBoundingBox[1],
selectedBoundingBox[3] - selectedBoundingBox[1],
)}
</td>
</tr>