Avoid resize flicker by passing to aspect ratio to the constructor
This commit is contained in:
parent
9e68876022
commit
0e71729fb9
|
@ -105,11 +105,12 @@ public class ThumbCell extends StackPane {
|
|||
.build(CacheLoader.from(ThumbCell::getStreamResolution));
|
||||
private ThumbOverviewTab parent;
|
||||
|
||||
public ThumbCell(ThumbOverviewTab parent, Model model, Recorder recorder) {
|
||||
public ThumbCell(ThumbOverviewTab parent, Model model, Recorder recorder, double aspectRatio) {
|
||||
this.parent = parent;
|
||||
this.thumbCellList = parent.grid.getChildren();
|
||||
this.model = model;
|
||||
this.recorder = recorder;
|
||||
this.imgAspectRatio = aspectRatio;
|
||||
recording = recorder.isTracked(model);
|
||||
model.setSuspended(recorder.isSuspended(model));
|
||||
this.setStyle("-fx-background-color: -fx-base");
|
||||
|
|
|
@ -382,8 +382,6 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
|
|||
if(!found) {
|
||||
ThumbCell newCell = createThumbCell(model, recorder);
|
||||
newCell.setIndex(index);
|
||||
newCell.setImageAspectRatio(imageAspectRatio);
|
||||
newCell.preserveAspectRatioProperty().bind(preserveAspectRatio);
|
||||
positionChangedOrNew.add(newCell);
|
||||
}
|
||||
index++;
|
||||
|
@ -414,7 +412,9 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
|
|||
}
|
||||
|
||||
ThumbCell createThumbCell(Model model, Recorder recorder) {
|
||||
ThumbCell newCell = new ThumbCell(this, model, recorder);
|
||||
ThumbCell newCell = new ThumbCell(this, model, recorder, imageAspectRatio);
|
||||
newCell.setImageAspectRatio(imageAspectRatio);
|
||||
newCell.preserveAspectRatioProperty().bind(preserveAspectRatio);
|
||||
newCell.addEventHandler(ContextMenuEvent.CONTEXT_MENU_REQUESTED, event -> {
|
||||
suspendUpdates(true);
|
||||
popup = createContextMenu(newCell);
|
||||
|
|
Loading…
Reference in New Issue