- added iso sheet for tech draw
This commit is contained in:
@@ -54,8 +54,9 @@ from fluency.technical_drawing import (
|
||||
)
|
||||
|
||||
# Sheet layout constants.
|
||||
_A3_MM_W = 420.0
|
||||
_A3_MM_H = 297.0
|
||||
# Sheet layout constants (A4 landscape, ISO 5457 template).
|
||||
_A4_MM_W = 297.0
|
||||
_A4_MM_H = 210.0
|
||||
|
||||
|
||||
# ── 2D geometry helpers (view-plane model coordinates) ────────────────────
|
||||
@@ -202,7 +203,7 @@ class DrawingCanvas(QWidget):
|
||||
|
||||
def _sheet_rect(self) -> QRectF:
|
||||
"""Sheet rect in device coordinates (zoom/pan applied)."""
|
||||
aspect = _A3_MM_W / _A3_MM_H
|
||||
aspect = _A4_MM_W / _A4_MM_H
|
||||
w = self.width()
|
||||
h = self.height()
|
||||
|
||||
@@ -220,18 +221,18 @@ class DrawingCanvas(QWidget):
|
||||
def to_sheet(self, pos: QPointF) -> Tuple[float, float]:
|
||||
"""Convert a device pixel position to sheet mm coordinates."""
|
||||
rect = self._sheet_rect()
|
||||
scale = rect.width() / _A3_MM_W
|
||||
scale = rect.width() / _A4_MM_W
|
||||
if scale <= 0:
|
||||
return (0.0, 0.0)
|
||||
return (
|
||||
(pos.x() - rect.x()) / scale,
|
||||
_A3_MM_H - (pos.y() - rect.y()) / scale,
|
||||
_A4_MM_H - (pos.y() - rect.y()) / scale,
|
||||
)
|
||||
|
||||
def _pick_tolerance_mm(self) -> float:
|
||||
"""Pick radius in sheet mm (about 6 device pixels)."""
|
||||
rect = self._sheet_rect()
|
||||
scale = rect.width() / _A3_MM_W
|
||||
scale = rect.width() / _A4_MM_W
|
||||
return 6.0 / scale if scale > 0 else 6.0
|
||||
|
||||
def _sheet_to_model(
|
||||
|
||||
Reference in New Issue
Block a user