diff options
| author | 2021-03-25 14:08:23 +0100 | |
|---|---|---|
| committer | 2021-03-25 14:08:23 +0100 | |
| commit | 7fd4903f14458733a4cb7f1e554303c42c2f0de9 (patch) | |
| tree | 9d4c2bbdf3a4b1673a106232db039787f1fa4f58 /enigma-swing | |
| parent | Bump version (diff) | |
| parent | WIP full record support (diff) | |
| download | enigma-7fd4903f14458733a4cb7f1e554303c42c2f0de9.tar.gz enigma-7fd4903f14458733a4cb7f1e554303c42c2f0de9.tar.xz enigma-7fd4903f14458733a4cb7f1e554303c42c2f0de9.zip | |
Merge pull request #361 from modmuss50/records
Record support
Diffstat (limited to 'enigma-swing')
| -rw-r--r-- | enigma-swing/src/main/java/cuchaz/enigma/gui/config/UiConfig.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/config/UiConfig.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/config/UiConfig.java index bab50df1..e4adadf1 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/config/UiConfig.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/config/UiConfig.java | |||
| @@ -272,7 +272,15 @@ public final class UiConfig { | |||
| 272 | OptionalInt x = section.getInt(String.format("X %s", screenSize.width)); | 272 | OptionalInt x = section.getInt(String.format("X %s", screenSize.width)); |
| 273 | OptionalInt y = section.getInt(String.format("Y %s", screenSize.height)); | 273 | OptionalInt y = section.getInt(String.format("Y %s", screenSize.height)); |
| 274 | if (x.isPresent() && y.isPresent()) { | 274 | if (x.isPresent() && y.isPresent()) { |
| 275 | return new Point(x.getAsInt(), y.getAsInt()); | 275 | int ix = x.getAsInt(); |
| 276 | int iy = y.getAsInt(); | ||
| 277 | |||
| 278 | // Ensure that the position is on the screen. | ||
| 279 | if (ix < 0 || iy < 0 || ix > screenSize.width || iy > screenSize.height) { | ||
| 280 | return fallback; | ||
| 281 | } | ||
| 282 | |||
| 283 | return new Point(ix, iy); | ||
| 276 | } else { | 284 | } else { |
| 277 | return fallback; | 285 | return fallback; |
| 278 | } | 286 | } |