From e4eda35d0292536759efabe662c64d61a11f1826 Mon Sep 17 00:00:00 2001 From: 0xboobface <0xboobface@gmail.com> Date: Mon, 8 Oct 2018 13:50:22 +0200 Subject: [PATCH] Hide resolution tag, when mouse is hovering over ThumbCell This is done, because the resolution tag might obscure the channel description --- src/main/java/ctbrec/ui/ThumbCell.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/ctbrec/ui/ThumbCell.java b/src/main/java/ctbrec/ui/ThumbCell.java index 2fe04130..d6a7913d 100644 --- a/src/main/java/ctbrec/ui/ThumbCell.java +++ b/src/main/java/ctbrec/ui/ThumbCell.java @@ -75,6 +75,7 @@ public class ThumbCell extends StackPane { private HttpClient client; private ObservableList thumbCellList; + private boolean mouseHovering = false; public ThumbCell(ThumbOverviewTab parent, Model model, Recorder recorder, HttpClient client) { this.thumbCellList = parent.grid.getChildren(); @@ -156,12 +157,22 @@ public class ThumbCell extends StackPane { getChildren().add(selectionOverlay); setOnMouseEntered((e) -> { + mouseHovering = true; new ParallelTransition(changeColor(nameBackground, colorNormal, colorHighlight), changeColor(name, colorHighlight, colorNormal)).playFromStart(); new ParallelTransition(changeOpacity(topicBackground, 0.7), changeOpacity(topic, 0.7)).playFromStart(); + if(Config.getInstance().getSettings().determineResolution) { + resolutionBackground.setVisible(false); + resolutionTag.setVisible(false); + } }); setOnMouseExited((e) -> { + mouseHovering = false; new ParallelTransition(changeColor(nameBackground, colorHighlight, colorNormal), changeColor(name, colorNormal, colorHighlight)).playFromStart(); new ParallelTransition(changeOpacity(topicBackground, 0), changeOpacity(topic, 0)).playFromStart(); + if(Config.getInstance().getSettings().determineResolution) { + resolutionBackground.setVisible(true); + resolutionTag.setVisible(true); + } }); setThumbWidth(width); @@ -235,8 +246,10 @@ public class ThumbCell extends StackPane { final Paint c = resolutionBackgroundColor; Platform.runLater(() -> { resolutionTag.setText(resText); - resolutionTag.setVisible(true); - resolutionBackground.setVisible(true); + if(!mouseHovering) { + resolutionTag.setVisible(true); + resolutionBackground.setVisible(true); + } resolutionBackground.setWidth(resolutionTag.getBoundsInLocal().getWidth() + 4); resolutionBackground.setFill(c); });