Commit 1efa8e5
committed
Fix: Improve measurement text rendering and use global EPSILON
This commit addresses your feedback on measurement text rendering:
1. Text Offset:
- I modified `screenCanvas.drawController.ts` to set `textBaseline = 'middle'`
when drawing text. This ensures text is vertically centered on its anchor point.
- I adjusted `MeasurementEntity.ts` to calculate the text label's offset
by adding half the text height (`MEASUREMENT_FONT_SIZE / 2`) to the
`MEASUREMENT_LABEL_OFFSET`. This provides a consistent gap between the
measurement line and the bounding box of the text, preventing overlap
when text orientation is flipped.
2. Global EPSILON:
- I updated `MeasurementEntity.ts` to use the global `EPSILON` constant
from `src/App.consts.ts` for floating-point comparisons in the
text orientation logic, replacing a locally defined epsilon.
These changes ensure correct text appearance (no overlap) and maintainability (use of global constant). The original fix for text orientation (ensuring readability from bottom/right) remains in place.
This addresses part of the feedback for issue #17.1 parent 0987239 commit 1efa8e5
File tree
2 files changed
+7
-4
lines changed- src
- drawControllers
- entities
2 files changed
+7
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| 373 | + | |
373 | 374 | | |
374 | 375 | | |
375 | 376 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| 100 | + | |
| 101 | + | |
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
102 | | - | |
| 105 | + | |
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
| |||
201 | 204 | | |
202 | 205 | | |
203 | 206 | | |
204 | | - | |
205 | 207 | | |
206 | 208 | | |
207 | | - | |
208 | | - | |
| 209 | + | |
| 210 | + | |
209 | 211 | | |
210 | 212 | | |
211 | 213 | | |
| |||
0 commit comments