Fix split tab layout on resize

This commit is contained in:
crschnick
2024-11-25 15:17:52 +00:00
parent dc9b40acda
commit 933bfb9ae2
3 changed files with 14 additions and 3 deletions
@@ -24,8 +24,10 @@ import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.geometry.Insets;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Background;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import java.util.HashMap;
@@ -192,15 +194,17 @@ public class BrowserFullSessionComp extends SimpleComp {
struc.get().getChildren().add(r);
struc.get().setMinWidth(rightSplit.get());
struc.get().setMaxWidth(rightSplit.get());
struc.get().setPrefWidth(rightSplit.get());
struc.get().setMaxWidth(rightSplit.get());
struc.get().getParent().requestLayout();
});
});
rightSplit.addListener((observable, oldValue, newValue) -> {
struc.get().setMinWidth(newValue.doubleValue());
struc.get().setMaxWidth(newValue.doubleValue());
struc.get().setPrefWidth(newValue.doubleValue());
struc.get().setMaxWidth(newValue.doubleValue());
struc.get().getParent().requestLayout();
});
AnchorPane.setBottomAnchor(struc.get(), 0.0);
@@ -445,6 +445,11 @@ public class BrowserSessionTabsComp extends SimpleComp {
if (tabModel.isCloseable()) {
split.getItems().add(empty);
}
tabs.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
if (tabModel.isCloseable() && newValue == tab) {
rightPadding.setValue(empty.getWidth());
}
});
model.getEffectiveRightTab().subscribe(browserSessionTab -> {
PlatformThread.runLaterIfNeeded(() -> {
if (browserSessionTab != null && split.getItems().size() > 1) {
@@ -1,5 +1,6 @@
package io.xpipe.app.prefs;
import com.vladsch.flexmark.util.misc.FileUtil;
import io.xpipe.app.ext.PrefsChoiceValue;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.util.*;
@@ -8,6 +9,7 @@ import io.xpipe.core.process.OsType;
import io.xpipe.core.util.SecretValue;
import lombok.Value;
import org.apache.commons.io.FileUtils;
import java.io.IOException;
import java.nio.file.Files;
@@ -35,7 +37,7 @@ public interface ExternalRdpClientType extends PrefsChoiceValue {
.executeSimpleCommand(CommandBuilder.of().add(executable).addFile(file.toString()));
ThreadHelper.runFailableAsync(() -> {
ThreadHelper.sleep(1000);
Files.delete(file);
FileUtils.deleteQuietly(file.toFile());
});
}