Fix initialization of the range slider
This commit is contained in:
parent
90300473bc
commit
3382c7ff54
|
@ -25,7 +25,12 @@ public class RangeSliderBehavior<T extends Number> extends BehaviorBase<RangeSli
|
||||||
* The mouse position on track with 0.0 being beginning of track and 1.0 being the end
|
* The mouse position on track with 0.0 being beginning of track and 1.0 being the end
|
||||||
*/
|
*/
|
||||||
public void lowThumbDragged(double position) {
|
public void lowThumbDragged(double position) {
|
||||||
rangeSlider.setLow(getNewPosition(position));
|
T newPosition = getNewPosition(position);
|
||||||
|
T high = rangeSlider.getRange().getTicks().get(rangeSlider.getHigh().intValue());
|
||||||
|
if (newPosition.doubleValue() >= high.doubleValue()) {
|
||||||
|
newPosition = rangeSlider.getRange().getTicks().get(rangeSlider.getLow().intValue());
|
||||||
|
}
|
||||||
|
rangeSlider.setLow(newPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +38,12 @@ public class RangeSliderBehavior<T extends Number> extends BehaviorBase<RangeSli
|
||||||
* The mouse position on track with 0.0 being beginning of track and 1.0 being the end
|
* The mouse position on track with 0.0 being beginning of track and 1.0 being the end
|
||||||
*/
|
*/
|
||||||
public void highThumbDragged(double position) {
|
public void highThumbDragged(double position) {
|
||||||
rangeSlider.setHigh(getNewPosition(position));
|
T newPosition = getNewPosition(position);
|
||||||
|
T low = rangeSlider.getRange().getTicks().get(rangeSlider.getLow().intValue());
|
||||||
|
if (newPosition.doubleValue() <= low.doubleValue()) {
|
||||||
|
newPosition = rangeSlider.getRange().getTicks().get(rangeSlider.getHigh().intValue());
|
||||||
|
}
|
||||||
|
rangeSlider.setHigh(newPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -359,8 +359,10 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
resolutionRange.prefWidthProperty().bind(directoryStructure.widthProperty());
|
resolutionRange.prefWidthProperty().bind(directoryStructure.widthProperty());
|
||||||
resolutionRange.setShowTickMarks(true);
|
resolutionRange.setShowTickMarks(true);
|
||||||
resolutionRange.setShowTickLabels(true);
|
resolutionRange.setShowTickLabels(true);
|
||||||
resolutionRange.setLow(labels.indexOf(Config.getInstance().getSettings().minimumResolution));
|
int lowValue = getRangeSliderValue(values, labels, Config.getInstance().getSettings().minimumResolution);
|
||||||
resolutionRange.setHigh(labels.indexOf(Config.getInstance().getSettings().maximumResolution));
|
resolutionRange.setLow(lowValue >= 0 ? lowValue : values.get(0));
|
||||||
|
int highValue = getRangeSliderValue(values, labels, Config.getInstance().getSettings().maximumResolution);
|
||||||
|
resolutionRange.setHigh(highValue >= 0 ? highValue : values.get(values.size() - 1));
|
||||||
layout.add(resolutionRange, 1, row++);
|
layout.add(resolutionRange, 1, row++);
|
||||||
GridPane.setMargin(l, new Insets(0, 0, 0, 0));
|
GridPane.setMargin(l, new Insets(0, 0, 0, 0));
|
||||||
GridPane.setColumnSpan(resolutionRange, 3);
|
GridPane.setColumnSpan(resolutionRange, 3);
|
||||||
|
@ -546,6 +548,16 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
return locations;
|
return locations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getRangeSliderValue(List<Integer> values, List<Integer> labels, int value) {
|
||||||
|
for (int i = 0; i < labels.size(); i++) {
|
||||||
|
int label = labels.get(i).intValue();
|
||||||
|
if(label == value) {
|
||||||
|
return values.get(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
private Node createIgnoreListPanel() {
|
private Node createIgnoreListPanel() {
|
||||||
GridPane layout = createGridLayout();
|
GridPane layout = createGridLayout();
|
||||||
Button editIgnoreList = new Button("Edit");
|
Button editIgnoreList = new Button("Edit");
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class Settings {
|
||||||
public boolean livePreviews = false;
|
public boolean livePreviews = false;
|
||||||
public boolean localRecording = true;
|
public boolean localRecording = true;
|
||||||
public int minimumResolution = 0;
|
public int minimumResolution = 0;
|
||||||
public int maximumResolution = 8160;
|
public int maximumResolution = 8640;
|
||||||
public int maximumResolutionPlayer = 0;
|
public int maximumResolutionPlayer = 0;
|
||||||
public String mediaPlayer = "/usr/bin/mpv";
|
public String mediaPlayer = "/usr/bin/mpv";
|
||||||
public String mediaPlayerParams = "";
|
public String mediaPlayerParams = "";
|
||||||
|
|
Loading…
Reference in New Issue