Skip to content

Commit 89a6876

Browse files
Only accept > 0 for width and height
1 parent 54cf94e commit 89a6876

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.1.2] - 2024-10-23
11+
12+
### Fixed
13+
14+
- Don't allow zero for width and height
15+
1016
## [1.1.1] - 2024-10-03
1117

1218
### Added
@@ -128,6 +134,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
128134
- Press and hold calibration corners to slow down movement
129135

130136
[unreleased]: https://github.com/Pattern-Projector/pattern-projector/compare/main...beta
137+
[1.1.2]: https://github.com/Pattern-Projector/pattern-projector/releases/tag/v1.1.2
131138
[1.1.1]: https://github.com/Pattern-Projector/pattern-projector/releases/tag/v1.1.1
132139
[1.1.0]: https://github.com/Pattern-Projector/pattern-projector/releases/tag/v1.1.0
133140
[1.0.2]: https://github.com/Pattern-Projector/pattern-projector/releases/tag/v1.0.2

app/[locale]/calibrate/page.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,18 @@ export default function Page() {
185185

186186
function handleHeightChange(e: ChangeEvent<HTMLInputElement>) {
187187
const h = removeNonDigits(e.target.value, height);
188-
setHeight(h);
189-
updateLocalSettings({ height: h });
188+
if (Number(h) > 0) {
189+
setHeight(h);
190+
updateLocalSettings({ height: h });
191+
}
190192
}
191193

192194
function handleWidthChange(e: ChangeEvent<HTMLInputElement>) {
193195
const w = removeNonDigits(e.target.value, width);
194-
setWidth(w);
195-
updateLocalSettings({ width: w });
196+
if (Number(w) > 0) {
197+
setWidth(w);
198+
updateLocalSettings({ width: w });
199+
}
196200
}
197201

198202
function handleFileChange(e: ChangeEvent<HTMLInputElement>): void {
@@ -304,10 +308,10 @@ export default function Page() {
304308
const localSettingString = localStorage.getItem("canvasSettings");
305309
if (localSettingString !== null) {
306310
const localSettings = JSON.parse(localSettingString);
307-
if (localSettings.height) {
311+
if (localSettings.height && Number(localSettings.height) > 0) {
308312
setHeight(localSettings.height);
309313
}
310-
if (localSettings.width) {
314+
if (localSettings.width && Number(localSettings.width) > 0) {
311315
setWidth(localSettings.width);
312316
}
313317
if (localSettings.unitOfMeasure) {

0 commit comments

Comments
 (0)