Fix board size precision

This commit is contained in:
2025-09-27 18:27:53 +08:00
parent 1ae3b9ff77
commit 2735957340
3 changed files with 9 additions and 3 deletions

View File

@@ -251,6 +251,7 @@
class="w-16 p-1 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm"
id="BoardWidth"
type="number"
step="0.01"
value="10"
/>
<span class="text-gray-700">CM × 宽(y)</span>
@@ -258,6 +259,7 @@
class="w-16 p-1 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm"
id="BoardHeight"
type="number"
step="0.01"
value="10"
/>
<span class="text-gray-700">CM数量</span>
@@ -1532,8 +1534,8 @@
const BBox = await eda.pcb_Primitive.getPrimitivesBBox([selectedPrimitives[0].getState_PrimitiveId()]);
const boardHeight = eda.sys_Unit.milToMm(BBox.maxY - BBox.minY - 10) / 10;
const boardWidth = eda.sys_Unit.milToMm(BBox.maxX - BBox.minX - 10) / 10;
document.getElementById('BoardHeight').value = boardHeight;
document.getElementById('BoardWidth').value = boardWidth;
document.getElementById('BoardHeight').value = boardHeight.toFixed(2);
document.getElementById('BoardWidth').value = boardWidth.toFixed(2);
eda.sys_Message.showToastMessage('已自动识别板子大小', 'success');
} else {
eda.sys_Message.showToastMessage('所选图元非板框', 'error');