You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2022/06/20 15:12:40 UTC

[sis] 02/03: Add a margin when rendering the map.

This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit c99e4ca07d24e2eb260e4d3a4a0b4ccc3e61b72e
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Mon Jun 20 11:04:34 2022 +0200

    Add a margin when rendering the map.
---
 .../src/main/java/org/apache/sis/gui/map/MapCanvas.java       |  2 +-
 .../src/main/java/org/apache/sis/gui/map/MapCanvasAWT.java    | 11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvas.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvas.java
index 455062f2b4..e02938ca57 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvas.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvas.java
@@ -138,7 +138,7 @@ public abstract class MapCanvas extends PlanarCanvas {
      * Size in pixels of a scroll or translation event. This value should be close to the
      * {@linkplain ScrollEvent#getDeltaY() delta of a scroll event done with mouse wheel}.
      */
-    private static final double SCROLL_EVENT_SIZE = 40;
+    static final double SCROLL_EVENT_SIZE = 40;
 
     /**
      * The zoom factor to apply on scroll event. A value of 0.1 means that a zoom of 10%
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvasAWT.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvasAWT.java
index 5ad205d46c..926d4be804 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvasAWT.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvasAWT.java
@@ -52,7 +52,7 @@ import org.apache.sis.internal.coverage.j2d.ColorModelFactory;
  * controls by the user.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.3
  * @since   1.1
  * @module
  */
@@ -76,10 +76,15 @@ public abstract class MapCanvasAWT extends MapCanvas {
      */
     private static final String WARNING_TEXT = "\u26A0";
 
+    /**
+     * Default value of {@link #imageMargin}.
+     */
+    private static final Insets DEFAULT_MARGIN = new Insets(SCROLL_EVENT_SIZE);
+
     /**
      * Number of additional pixels to paint on each sides of the image, outside the viewing area.
      * Computing a larger image reduces the black borders that user sees during translations or
-     * during zoom out before the new image is repainted. The default value is {@code null}.
+     * during zoom out before the new image is repainted.
      */
     public final ObjectProperty<Insets> imageMargin;
 
@@ -148,7 +153,7 @@ public abstract class MapCanvasAWT extends MapCanvas {
      */
     public MapCanvasAWT(final Locale locale) {
         super(locale);
-        imageMargin = new SimpleObjectProperty<>(this, "imageMargin");
+        imageMargin = new SimpleObjectProperty<>(this, "imageMargin", DEFAULT_MARGIN);
         image = new ImageView();
         image.setPreserveRatio(true);
         floatingPane.getChildren().add(image);