Skip to content

Commit

Permalink
Make tooltips have a 400ms delay instead of default 1000ms
Browse files Browse the repository at this point in the history
Fix #118
  • Loading branch information
jpmonettas committed Jan 15, 2024
1 parent b494741 commit 2f05b47
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

### Changes

- Make tooltips have a 400ms delay instead of default 1000ms

### Bugs fixed

## 3.9.1 (12-01-2024)
Expand Down
11 changes: 8 additions & 3 deletions src-dbg/flow_storm/debugger/ui/utils.clj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
[javafx.beans.value ObservableValue]
[javafx.scene Node]
[javafx.scene.layout HBox Priority VBox Region]
[javafx.util Duration]
[java.util.function Predicate]
[org.kordamp.ikonli.javafx FontIcon]
[javafx.collections FXCollections ObservableList]
Expand Down Expand Up @@ -127,6 +128,10 @@
(defn icon [^String icon-name]
(FontIcon. icon-name))

(defn- tool-tip [text]
(doto (Tooltip. text)
(.setShowDelay (Duration. 400))))

(defn button [& {:keys [label classes on-click disable tooltip]}]
(let [b (Button. label)]

Expand All @@ -140,15 +145,15 @@
(when disable
(.setDisable b true))

(when tooltip (.setTooltip b (Tooltip. tooltip)))
(when tooltip (.setTooltip b (tool-tip tooltip)))

b))

(defn icon-button [& {:keys [icon-name classes on-click disable tooltip]}]
(let [b (doto (Button.)
(.setGraphic (FontIcon. icon-name)))]

(when tooltip (.setTooltip b (Tooltip. tooltip)))
(when tooltip (.setTooltip b (tool-tip tooltip)))
(when on-click
(.setOnAction b (event-handler [_] (on-click))))

Expand Down Expand Up @@ -291,7 +296,7 @@
(when on-selection-changed
(.setOnSelectionChanged t on-selection-changed))

(when tooltip (.setTooltip t (Tooltip. tooltip)))
(when tooltip (.setTooltip t (tool-tip tooltip)))

t))

Expand Down

0 comments on commit 2f05b47

Please sign in to comment.