summaryrefslogtreecommitdiff
path: root/enigma-swing
diff options
context:
space:
mode:
authorGravatar 2xsaiko2021-03-25 14:08:23 +0100
committerGravatar GitHub2021-03-25 14:08:23 +0100
commit7fd4903f14458733a4cb7f1e554303c42c2f0de9 (patch)
tree9d4c2bbdf3a4b1673a106232db039787f1fa4f58 /enigma-swing
parentBump version (diff)
parentWIP full record support (diff)
downloadenigma-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.java10
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 }