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/09/19 15:46:17 UTC
[sis] 02/03: Avoid excesive amount of "mouse cursor changed" events.
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 b7e9022f414d8a7a22a1295cc50b26ef65b501b3
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sat Sep 17 20:16:58 2022 +0200
Avoid excesive amount of "mouse cursor changed" events.
---
.../main/java/org/apache/sis/gui/map/MapCanvas.java | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 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 e02938ca57..41dfe18c8d 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
@@ -163,7 +163,7 @@ public abstract class MapCanvas extends PlanarCanvas {
* @see #requestRepaint()
* @see Delayed
*/
- private static final long REPAINT_DELAY = 500;
+ private static final long REPAINT_DELAY = 200;
/**
* Number of nanoseconds to wait before to set mouse cursor shape to {@link Cursor#WAIT} during rendering.
@@ -171,7 +171,7 @@ public abstract class MapCanvas extends PlanarCanvas {
*
* @see #renderingStartTime
*/
- private static final long WAIT_CURSOR_DELAY = (1000 - REPAINT_DELAY) * NANOS_PER_MILLISECOND;
+ private static final long WAIT_CURSOR_DELAY = (500 - REPAINT_DELAY) * NANOS_PER_MILLISECOND;
/**
* The pane showing the map and any other JavaFX nodes to scale and translate together with the map.
@@ -1410,8 +1410,8 @@ public abstract class MapCanvas extends PlanarCanvas {
}
/**
- * The action to execute if rendering appear to be slow. If the rendering did not completed
- * after about one second, the mouse cursor shaped will be set to the wait cursor. We do not
+ * The action to execute if rendering appears to be slow. If the rendering did not completed
+ * after about one second, the mouse cursor shape will be set to the wait cursor. We do not
* do this change immediately because the mouse cursor changes become disturbing if applied
* continuously for a series of fast renderings.
*/
@@ -1442,17 +1442,19 @@ public abstract class MapCanvas extends PlanarCanvas {
/**
* Invoked in JavaFX thread {@link #WAIT_CURSOR_DELAY} nanoseconds after a rendering started.
* If the same rendering is still under progress, the mouse cursor is set to {@link Cursor#WAIT}.
- * If a different rendering is in progress, do not set the cursor because the GUI is fast enough
- * but schedule a new {@link CursorChange} in case the next rendering is slow.
+ * If a different rendering is in progress, do not set the cursor because the GUI was fast enough
+ * for the rendering just done but scheduled a new {@link CursorChange} in case the next rendering
+ * will be slow.
*/
private void setWaitCursor(final long startTime) {
isCursorChangeScheduled = false;
if (renderingInProgress != null) {
if (startTime == renderingStartTime) {
floatingPane.setCursor(Cursor.WAIT);
+ } else {
+ DelayedExecutor.schedule(new CursorChange());
+ isCursorChangeScheduled = true;
}
- DelayedExecutor.schedule(new CursorChange());
- isCursorChangeScheduled = true;
}
}