Merge pull request #6307 from Android-X13/fix-issue-6263

Fix/improve clickable areas of toggle buttons
This commit is contained in:
Christoph Atteneder 2022-08-17 13:32:58 +02:00 committed by GitHub
commit ad921294d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 17 deletions

View file

@ -177,28 +177,29 @@ public abstract class ChartView<T extends ChartViewModel<? extends ChartDataMode
// Put all together
VBox timelineNavigationBox = new VBox();
double paddingLeft = 15;
double paddingTop = 0;
double paddingRight = 89;
double paddingLeft = 15;
// Y-axis width depends on data so we register a listener to get correct value
yAxisWidthListener = (observable, oldValue, newValue) -> {
double width = newValue.doubleValue();
if (width > 0) {
double rightPadding = width + 14;
VBox.setMargin(timeIntervalBox, new Insets(0, rightPadding, 0, paddingLeft));
VBox.setMargin(timelineNavigation, new Insets(0, rightPadding, 0, paddingLeft));
VBox.setMargin(timelineLabels, new Insets(0, rightPadding, 0, paddingLeft));
VBox.setMargin(timeIntervalBox, new Insets(paddingTop, rightPadding, 0, paddingLeft));
VBox.setMargin(timelineNavigation, new Insets(paddingTop, rightPadding, 0, paddingLeft));
VBox.setMargin(timelineLabels, new Insets(paddingTop, rightPadding, 0, paddingLeft));
VBox.setMargin(legendBox1, new Insets(10, rightPadding, 0, paddingLeft));
if (legendBox2 != null) {
VBox.setMargin(legendBox2, new Insets(-20, rightPadding, 0, paddingLeft));
VBox.setMargin(legendBox2, new Insets(paddingTop, rightPadding, 0, paddingLeft));
}
if (legendBox3 != null) {
VBox.setMargin(legendBox3, new Insets(-20, rightPadding, 0, paddingLeft));
VBox.setMargin(legendBox3, new Insets(paddingTop, rightPadding, 0, paddingLeft));
}
if (legendBox4 != null) {
VBox.setMargin(legendBox4, new Insets(-20, rightPadding, 0, paddingLeft));
VBox.setMargin(legendBox4, new Insets(paddingTop, rightPadding, 0, paddingLeft));
}
if (legendBox5 != null) {
VBox.setMargin(legendBox5, new Insets(-20, rightPadding, 0, paddingLeft));
VBox.setMargin(legendBox5, new Insets(paddingTop, rightPadding, 0, paddingLeft));
}
if (model.getDividerPositions()[0] == 0 && model.getDividerPositions()[1] == 1) {
@ -207,25 +208,25 @@ public abstract class ChartView<T extends ChartViewModel<? extends ChartDataMode
}
};
VBox.setMargin(timeIntervalBox, new Insets(0, paddingRight, 0, paddingLeft));
VBox.setMargin(timelineNavigation, new Insets(0, paddingRight, 0, paddingLeft));
VBox.setMargin(timelineLabels, new Insets(0, paddingRight, 0, paddingLeft));
VBox.setMargin(legendBox1, new Insets(0, paddingRight, 0, paddingLeft));
VBox.setMargin(timeIntervalBox, new Insets(paddingTop, paddingRight, 0, paddingLeft));
VBox.setMargin(timelineNavigation, new Insets(paddingTop, paddingRight, 0, paddingLeft));
VBox.setMargin(timelineLabels, new Insets(paddingTop, paddingRight, 0, paddingLeft));
VBox.setMargin(legendBox1, new Insets(paddingTop, paddingRight, 0, paddingLeft));
timelineNavigationBox.getChildren().addAll(timelineNavigation, timelineLabels, legendBox1);
if (legendBox2 != null) {
VBox.setMargin(legendBox2, new Insets(-20, paddingRight, 0, paddingLeft));
VBox.setMargin(legendBox2, new Insets(paddingTop, paddingRight, 0, paddingLeft));
timelineNavigationBox.getChildren().add(legendBox2);
}
if (legendBox3 != null) {
VBox.setMargin(legendBox3, new Insets(-20, paddingRight, 0, paddingLeft));
VBox.setMargin(legendBox3, new Insets(paddingTop, paddingRight, 0, paddingLeft));
timelineNavigationBox.getChildren().add(legendBox3);
}
if (legendBox4 != null) {
VBox.setMargin(legendBox4, new Insets(-20, paddingRight, 0, paddingLeft));
VBox.setMargin(legendBox4, new Insets(paddingTop, paddingRight, 0, paddingLeft));
timelineNavigationBox.getChildren().add(legendBox4);
}
if (legendBox5 != null) {
VBox.setMargin(legendBox5, new Insets(-20, paddingRight, 0, paddingLeft));
VBox.setMargin(legendBox5, new Insets(paddingTop, paddingRight, 0, paddingLeft));
timelineNavigationBox.getChildren().add(legendBox5);
}
root.getChildren().addAll(timeIntervalBox, chart, timelineNavigationBox);
@ -407,6 +408,7 @@ public abstract class ChartView<T extends ChartViewModel<? extends ChartDataMode
toggle.setText(seriesId);
toggle.setId("charts-legend-toggle" + seriesIndexMap.get(seriesId));
toggle.setSelected(false);
toggle.setPadding(new Insets(0,0,0,10));
maybeAddToolTip(toggle, series);
hBox.getChildren().add(toggle);
});

View file

@ -218,9 +218,10 @@ public class OpenOffersView extends ActivatableViewAndModel<VBox, OpenOffersView
return row;
});
selectToggleButton.setPadding(new Insets(0, 90, -20, 0));
selectToggleButton.setPadding(new Insets(0, 0, -20, 0));
selectToggleButton.setText(Res.get("shared.enabled"));
selectToggleButton.setDisable(true);
HBox.setMargin(selectToggleButton, new Insets(0, 90, 0, 0));
numItems.setId("num-offers");
numItems.setPadding(new Insets(-5, 0, 0, 10));