Skip to content

Commit

Permalink
Minor overview image issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mircokroon committed May 6, 2024
1 parent 85d20ab commit 7d2e4ec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/java/gui/ZoomBehaviour.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/gui/images/RegionImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gui/images/RegionImageHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 7d2e4ec

Please sign in to comment.