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