Skip to content

Commit

Permalink
Fix split tab layout on resize
Browse files Browse the repository at this point in the history
  • Loading branch information
crschnick committed Nov 25, 2024
1 parent dc9b40a commit 933bfb9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
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;
Expand Down Expand Up @@ -192,15 +194,17 @@ private StackComp createSplitStack(SimpleDoubleProperty rightSplit, BrowserSessi
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,11 @@ private Tab createTab(TabPane tabs, BrowserSessionTab tabModel) {
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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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.*;
Expand All @@ -8,6 +9,7 @@
import io.xpipe.core.util.SecretValue;

import lombok.Value;
import org.apache.commons.io.FileUtils;

import java.io.IOException;
import java.nio.file.Files;
Expand Down Expand Up @@ -35,7 +37,7 @@ public void launch(LaunchConfiguration configuration) throws Exception {
.executeSimpleCommand(CommandBuilder.of().add(executable).addFile(file.toString()));
ThreadHelper.runFailableAsync(() -> {
ThreadHelper.sleep(1000);
Files.delete(file);
FileUtils.deleteQuietly(file.toFile());
});
}

Expand Down

0 comments on commit 933bfb9

Please sign in to comment.