Skip to content

Commit

Permalink
Upgrade Gradle to 8.12
Browse files Browse the repository at this point in the history
Also improve image resizing's initial size.
  • Loading branch information
zapek committed Dec 30, 2024
1 parent 69035be commit 4c76322
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ plugins {

// To upgrade Gradle, change the version here, refresh, then run the 'build setup/wrapper' task
wrapper {
gradleVersion = '8.11.1'
gradleVersion = '8.12'
}

// This gives a git-like version for git builds but a proper version
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,24 @@ public ContentImage(Image image, Region parent)

node.setImage(image);
node.setOnContextMenuRequested(event -> contextMenu.show(node, event.getScreenX(), event.getScreenY()));
node.setOnMouseClicked(ContentImage::view);

if (parent != null)
{
syncImageWidth(node, parent.getWidth());
parent.widthProperty().addListener((observable, oldValue, newValue) -> {
node.setFitWidth(newValue.doubleValue() - 24); // 12 margins
syncImageWidth(node, newValue.doubleValue());
});

node.setPreserveRatio(true);
node.setOnMouseClicked(ContentImage::view);
}
}

private static void syncImageWidth(ImageView imageView, double width)
{
imageView.setFitWidth(width - 24); // margins of 12 on each side
}

@Override
public Node getNode()
{
Expand Down

0 comments on commit 4c76322

Please sign in to comment.