diff --git a/src/main/java/eu/hansolo/tilesfx/Tile.java b/src/main/java/eu/hansolo/tilesfx/Tile.java index c2ef21b7..e8f49184 100644 --- a/src/main/java/eu/hansolo/tilesfx/Tile.java +++ b/src/main/java/eu/hansolo/tilesfx/Tile.java @@ -1378,7 +1378,9 @@ public DoubleProperty thresholdProperty() { threshold = new DoublePropertyBase(_threshold) { @Override protected void invalidated() { final double THRESHOLD = get(); - if (THRESHOLD < getMinValue() || THRESHOLD > getMaxValue()) set(clamp(getMinValue(), getMaxValue(), THRESHOLD)); + if (!isBound() && (THRESHOLD < getMinValue() || THRESHOLD > getMaxValue())) { + set(clamp(getMinValue(), getMaxValue(), THRESHOLD)); + } fireTileEvent(RESIZE_EVENT); } @Override public Object getBean() { return Tile.this; } diff --git a/src/test/java/eu/hansolo/tilesfx/TilesFXTest.java b/src/test/java/eu/hansolo/tilesfx/TilesFXTest.java index 280fb785..3414f151 100644 --- a/src/test/java/eu/hansolo/tilesfx/TilesFXTest.java +++ b/src/test/java/eu/hansolo/tilesfx/TilesFXTest.java @@ -20,6 +20,8 @@ import eu.hansolo.tilesfx.Tile.SkinType; import javafx.animation.AnimationTimer; import javafx.application.Application; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.SimpleDoubleProperty; import javafx.collections.ObservableList; import javafx.event.EventType; import javafx.scene.Node; @@ -46,6 +48,8 @@ public class TilesFXTest extends Application { private AnimationTimer timer; @Override public void init() { + DoubleProperty testTresholdProperty = new SimpleDoubleProperty(0); + tile = TileBuilder.create() .skinType(SkinType.GAUGE) .prefSize(400, 400) @@ -65,6 +69,7 @@ public class TilesFXTest extends Application { tile.showNotifyRegion(true); tile.showInfoRegion(true); + tile.thresholdProperty().bind(testTresholdProperty); /* tile = TileBuilder.create() @@ -82,6 +87,7 @@ public class TilesFXTest extends Application { @Override public void handle(final long now) { if (now > lastTimerCall + 1_000_000_000l) { tile.setValue(RND.nextDouble() * 25 + 5); + testTresholdProperty.set(RND.nextDouble() * 100); lastTimerCall = now; } }