forked from j62/ctbrec
Improve support for big fonts
This commit is contained in:
parent
8517b7e8ad
commit
1e9867cc88
|
@ -62,7 +62,6 @@ import javafx.scene.shape.Circle;
|
||||||
import javafx.scene.shape.Polygon;
|
import javafx.scene.shape.Polygon;
|
||||||
import javafx.scene.shape.Rectangle;
|
import javafx.scene.shape.Rectangle;
|
||||||
import javafx.scene.shape.Shape;
|
import javafx.scene.shape.Shape;
|
||||||
import javafx.scene.text.Font;
|
|
||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
import javafx.scene.text.TextAlignment;
|
import javafx.scene.text.TextAlignment;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
|
@ -139,11 +138,6 @@ public class ThumbCell extends StackPane {
|
||||||
iv.setPreserveRatio(true);
|
iv.setPreserveRatio(true);
|
||||||
getChildren().add(iv);
|
getChildren().add(iv);
|
||||||
|
|
||||||
nameBackground = new Rectangle();
|
|
||||||
nameBackground.setFill(recording ? colorRecording : colorNormal);
|
|
||||||
nameBackground.setOpacity(.7);
|
|
||||||
StackPane.setAlignment(nameBackground, Pos.BOTTOM_CENTER);
|
|
||||||
getChildren().add(nameBackground);
|
|
||||||
|
|
||||||
topicBackground = new Rectangle();
|
topicBackground = new Rectangle();
|
||||||
topicBackground.setFill(Color.BLACK);
|
topicBackground.setFill(Color.BLACK);
|
||||||
|
@ -160,13 +154,6 @@ public class ThumbCell extends StackPane {
|
||||||
StackPane.setMargin(resolutionBackground, new Insets(2));
|
StackPane.setMargin(resolutionBackground, new Insets(2));
|
||||||
getChildren().add(resolutionBackground);
|
getChildren().add(resolutionBackground);
|
||||||
|
|
||||||
name = new Text(model.getDisplayName());
|
|
||||||
name.setFill(Color.WHITE);
|
|
||||||
name.setFont(new Font("Sansserif", 16));
|
|
||||||
name.setTextAlignment(TextAlignment.CENTER);
|
|
||||||
name.prefHeight(25);
|
|
||||||
StackPane.setAlignment(name, Pos.BOTTOM_CENTER);
|
|
||||||
getChildren().add(name);
|
|
||||||
|
|
||||||
topic = new Text();
|
topic = new Text();
|
||||||
String txt = recording ? " " : "";
|
String txt = recording ? " " : "";
|
||||||
|
@ -174,7 +161,6 @@ public class ThumbCell extends StackPane {
|
||||||
topic.setText(txt);
|
topic.setText(txt);
|
||||||
|
|
||||||
topic.setFill(Color.WHITE);
|
topic.setFill(Color.WHITE);
|
||||||
topic.setFont(new Font("Sansserif", 13));
|
|
||||||
topic.setTextAlignment(TextAlignment.LEFT);
|
topic.setTextAlignment(TextAlignment.LEFT);
|
||||||
topic.setOpacity(0);
|
topic.setOpacity(0);
|
||||||
var margin = 4;
|
var margin = 4;
|
||||||
|
@ -182,6 +168,19 @@ public class ThumbCell extends StackPane {
|
||||||
StackPane.setAlignment(topic, Pos.TOP_CENTER);
|
StackPane.setAlignment(topic, Pos.TOP_CENTER);
|
||||||
getChildren().add(topic);
|
getChildren().add(topic);
|
||||||
|
|
||||||
|
nameBackground = new Rectangle();
|
||||||
|
nameBackground.setFill(recording ? colorRecording : colorNormal);
|
||||||
|
nameBackground.setOpacity(.7);
|
||||||
|
StackPane.setAlignment(nameBackground, Pos.BOTTOM_CENTER);
|
||||||
|
getChildren().add(nameBackground);
|
||||||
|
|
||||||
|
name = new Text(model.getDisplayName());
|
||||||
|
name.setFill(Color.WHITE);
|
||||||
|
name.setTextAlignment(TextAlignment.CENTER);
|
||||||
|
name.prefHeight(25);
|
||||||
|
StackPane.setAlignment(name, Pos.BOTTOM_CENTER);
|
||||||
|
getChildren().add(name);
|
||||||
|
|
||||||
resolutionTag = new Text();
|
resolutionTag = new Text();
|
||||||
resolutionTag.setFill(Color.WHITE);
|
resolutionTag.setFill(Color.WHITE);
|
||||||
resolutionTag.setVisible(false);
|
resolutionTag.setVisible(false);
|
||||||
|
@ -229,6 +228,7 @@ public class ThumbCell extends StackPane {
|
||||||
Color normal = recording ? colorRecording : colorNormal;
|
Color normal = recording ? colorRecording : colorNormal;
|
||||||
new ParallelTransition(changeColor(nameBackground, normal, colorHighlight), changeColor(name, colorHighlight, normal)).playFromStart();
|
new ParallelTransition(changeColor(nameBackground, normal, colorHighlight), changeColor(name, colorHighlight, normal)).playFromStart();
|
||||||
new ParallelTransition(changeOpacity(topicBackground, 0.7), changeOpacity(topic, 0.7)).playFromStart();
|
new ParallelTransition(changeOpacity(topicBackground, 0.7), changeOpacity(topic, 0.7)).playFromStart();
|
||||||
|
new ParallelTransition(changeOpacity(nameBackground, 1), changeOpacity(name, 1)).playFromStart();
|
||||||
if (Config.getInstance().getSettings().determineResolution) {
|
if (Config.getInstance().getSettings().determineResolution) {
|
||||||
resolutionBackground.setVisible(false);
|
resolutionBackground.setVisible(false);
|
||||||
resolutionTag.setVisible(false);
|
resolutionTag.setVisible(false);
|
||||||
|
@ -239,6 +239,7 @@ public class ThumbCell extends StackPane {
|
||||||
Color normal = recording ? colorRecording : colorNormal;
|
Color normal = recording ? colorRecording : colorNormal;
|
||||||
new ParallelTransition(changeColor(nameBackground, colorHighlight, normal), changeColor(name, normal, colorHighlight)).playFromStart();
|
new ParallelTransition(changeColor(nameBackground, colorHighlight, normal), changeColor(name, normal, colorHighlight)).playFromStart();
|
||||||
new ParallelTransition(changeOpacity(topicBackground, 0), changeOpacity(topic, 0)).playFromStart();
|
new ParallelTransition(changeOpacity(topicBackground, 0), changeOpacity(topic, 0)).playFromStart();
|
||||||
|
new ParallelTransition(changeOpacity(nameBackground, 0.7), changeOpacity(name, 0.7)).playFromStart();
|
||||||
if (Config.getInstance().getSettings().determineResolution && !resolutionTag.getText().isEmpty()) {
|
if (Config.getInstance().getSettings().determineResolution && !resolutionTag.getText().isEmpty()) {
|
||||||
resolutionBackground.setVisible(true);
|
resolutionBackground.setVisible(true);
|
||||||
resolutionTag.setVisible(true);
|
resolutionTag.setVisible(true);
|
||||||
|
@ -398,7 +399,7 @@ public class ThumbCell extends StackPane {
|
||||||
resolutionTag.setVisible(true);
|
resolutionTag.setVisible(true);
|
||||||
resolutionBackground.setVisible(true);
|
resolutionBackground.setVisible(true);
|
||||||
}
|
}
|
||||||
resolutionBackground.setWidth(resolutionTag.getBoundsInLocal().getWidth() + 4);
|
resolutionBackground.setWidth(resolutionTag.getLayoutBounds().getWidth() + 4);
|
||||||
resolutionBackground.setFill(c);
|
resolutionBackground.setFill(c);
|
||||||
if (!Objects.equals(oldText, text)) {
|
if (!Objects.equals(oldText, text)) {
|
||||||
parent.filter();
|
parent.filter();
|
||||||
|
@ -706,7 +707,7 @@ public class ThumbCell extends StackPane {
|
||||||
setMinSize(w, h);
|
setMinSize(w, h);
|
||||||
setPrefSize(w, h);
|
setPrefSize(w, h);
|
||||||
nameBackground.setWidth(w);
|
nameBackground.setWidth(w);
|
||||||
nameBackground.setHeight(20);
|
nameBackground.setHeight(25);
|
||||||
topicBackground.setWidth(w);
|
topicBackground.setWidth(w);
|
||||||
topicBackground.setHeight(h - nameBackground.getHeight());
|
topicBackground.setHeight(h - nameBackground.getHeight());
|
||||||
topic.prefHeight(getHeight() - 25);
|
topic.prefHeight(getHeight() - 25);
|
||||||
|
@ -756,4 +757,11 @@ public class ThumbCell extends StackPane {
|
||||||
BOOKMARKED,
|
BOOKMARKED,
|
||||||
NOT
|
NOT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void layoutChildren() {
|
||||||
|
super.layoutChildren();
|
||||||
|
nameBackground.setHeight(name.getLayoutBounds().getHeight());
|
||||||
|
resolutionBackground.setHeight(resolutionTag.getLayoutBounds().getHeight());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,6 +155,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
|
||||||
var searchInput = new SearchBox();
|
var searchInput = new SearchBox();
|
||||||
searchInput.setPromptText("Search Model");
|
searchInput.setPromptText("Search Model");
|
||||||
searchInput.prefWidth(200);
|
searchInput.prefWidth(200);
|
||||||
|
searchInput.prefHeightProperty().bind(filterInput.heightProperty());
|
||||||
searchInput.textProperty().addListener(search());
|
searchInput.textProperty().addListener(search());
|
||||||
searchInput.addEventHandler(KeyEvent.KEY_PRESSED, evt -> {
|
searchInput.addEventHandler(KeyEvent.KEY_PRESSED, evt -> {
|
||||||
if (evt.getCode() == KeyCode.ESCAPE) {
|
if (evt.getCode() == KeyCode.ESCAPE) {
|
||||||
|
|
Loading…
Reference in New Issue