diff --git a/bundles/org.openhab.ui.basic/src/main/java/org/openhab/ui/basic/internal/render/SliderRenderer.java b/bundles/org.openhab.ui.basic/src/main/java/org/openhab/ui/basic/internal/render/SliderRenderer.java index 8f8d02cadb..08347c5ca5 100644 --- a/bundles/org.openhab.ui.basic/src/main/java/org/openhab/ui/basic/internal/render/SliderRenderer.java +++ b/bundles/org.openhab.ui.basic/src/main/java/org/openhab/ui/basic/internal/render/SliderRenderer.java @@ -83,6 +83,7 @@ public EList renderWidget(Widget w, StringBuilder sb, String sitemap) th snippet = preprocessSnippet(snippet, w); snippet = snippet.replace("%frequency%", frequency); + snippet = snippet.replace("%release_only%", s.isReleaseOnly() ? "true" : "flase"); snippet = snippet.replace("%switch%", s.isSwitchEnabled() ? "1" : "0"); snippet = snippet.replace("%unit%", unit == null ? "" : unit); snippet = snippet.replace("%minValue%", minValueOf(s)); diff --git a/bundles/org.openhab.ui.basic/src/main/resources/snippets/slider.html b/bundles/org.openhab.ui.basic/src/main/resources/snippets/slider.html index db25da5fe7..ef90d856e9 100644 --- a/bundles/org.openhab.ui.basic/src/main/resources/snippets/slider.html +++ b/bundles/org.openhab.ui.basic/src/main/resources/snippets/slider.html @@ -21,7 +21,8 @@ data-icon-color="%icon_color%" > do nothing"); + } + } + + function onInput() { + if (_t.releaseOnly) { + return; + } + window.console.log("onInput " + _t.input.value); + _t.lastInputValue = _t.input.value; _t.debounceProxy.call(); } function onChangeStart() { + window.console.log("onChangeStart releaseOnly " + _t.releaseOnly + " sendFrequency " + _t.sendFrequency); if (unlockTimeout !== null) { clearTimeout(unlockTimeout); } _t.locked = true; - smarthome.changeListener.pause(); + _t.lastInputValue = null; + _t.lastEmittedValue = null; } function onChangeEnd() { - // mouseUp is fired earlier than the value is changed - // quite a dirty hack, but I don't see any other way - _t.debounceProxy.call(); - setTimeout(function() { - smarthome.changeListener.resume(); - }, 5); + window.console.log("onChangeEnd"); unlockTimeout = setTimeout(function() { _t.locked = false; }, 300); - _t.debounceProxy.finish(); } var @@ -2459,6 +2474,7 @@ [ _t.input, "mousedown", onChangeStart ], [ _t.input, "touchend", onChangeEnd ], [ _t.input, "mouseup", onChangeEnd ], + [ _t.input, "input", onInput ], [ _t.input, "change", onChange ] ];