From 7d2e4ec3208e2f0160f0ab712024b83744b857e7 Mon Sep 17 00:00:00 2001 From: Mirco Kroon <23699979+mircokroon@users.noreply.github.com> Date: Mon, 6 May 2024 20:17:30 +0200 Subject: [PATCH] Minor overview image issues --- src/main/java/gui/ZoomBehaviour.java | 2 +- src/main/java/gui/images/RegionImage.java | 9 +++++---- src/main/java/gui/images/RegionImageHandler.java | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/gui/ZoomBehaviour.java b/src/main/java/gui/ZoomBehaviour.java index 405b7fe..5adddf1 100644 --- a/src/main/java/gui/ZoomBehaviour.java +++ b/src/main/java/gui/ZoomBehaviour.java @@ -6,7 +6,7 @@ public interface ZoomBehaviour { double initialBlocksPerPixel = 1.0; - double maxBlocksPerPixel = 64; + double maxBlocksPerPixel = 256; double minBlocksPerPixel = 1.0 / 16.0; double zoomInMultiplier = 2; diff --git a/src/main/java/gui/images/RegionImage.java b/src/main/java/gui/images/RegionImage.java index cad558d..b218fb4 100644 --- a/src/main/java/gui/images/RegionImage.java +++ b/src/main/java/gui/images/RegionImage.java @@ -94,7 +94,7 @@ public static RegionImage of(Path directoryPath, Coordinate2D coordinate) { WritableImage image = loadFromFile(directoryPath, coordinate, MIN_SIZE); return new RegionImage(image, directoryPath, coordinate); - } catch (IOException e) { + } catch (Exception e) { return new RegionImage(directoryPath, coordinate); } } @@ -201,8 +201,8 @@ public Image getImage() { } public void drawChunk(Coordinate2D local, Image chunkImage) { - lastUpdated = System.currentTimeMillis(); - saved = false; + this.lastUpdated = System.currentTimeMillis(); + this.saved = false; if (targetSize < SIZE || currentSize < SIZE) { targetSize = SIZE; @@ -233,7 +233,6 @@ public void save() throws IOException { if (saved) { return; } - saved = true; File f = getFile(path, NORMAL_PREFIX, coordinates); BufferedImage img = SwingFXUtils.fromFXImage(image, null); @@ -242,6 +241,8 @@ public void save() throws IOException { img = resize(img, MIN_SIZE); f = getFile(path, SMALL_PREFIX, coordinates); ImageIO.write(img, "png", f); + + saved = true; } public static File getFile(Path p, String prefix, Coordinate2D coords) { diff --git a/src/main/java/gui/images/RegionImageHandler.java b/src/main/java/gui/images/RegionImageHandler.java index 65a0f52..273f700 100644 --- a/src/main/java/gui/images/RegionImageHandler.java +++ b/src/main/java/gui/images/RegionImageHandler.java @@ -154,7 +154,7 @@ private void loadFromFile() { new Thread(() -> attemptQuiet(() -> { // walk one of the modes, check for the others if we find one Files.walk(dimensionPath(this.activeDimension, ImageMode.NORMAL), 1) - .limit(3200) + .limit(32000) .forEach(image -> attempt(() -> loadFromFile(regions, this.activeDimension, image))); })).start(); }