Skip to content

Commit 1998e28

Browse files
committed
fixed some bugs with a bottom tool panel.
1 parent cac5eea commit 1998e28

File tree

6 files changed

+16
-22
lines changed

6 files changed

+16
-22
lines changed

resources/ui/css/custom_ids.bss

64 Bytes
Binary file not shown.

resources/ui/css/custom_ids.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
-fx-effect: -fx-material-shadow-panel;;
99
}
1010

11+
#EditorBarComponentOffset {
12+
-fx-min-height: 34px;
13+
}
14+
1115
#EditorBarComponentTitleLabel {
1216
-fx-padding: 0 0 0 20;
1317
}

src/com/ss/editor/ui/builder/EditorFXSceneBuilder.java

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
import com.ss.editor.ui.css.CSSIds;
1616
import com.ss.editor.ui.event.EventRedirector;
1717
import com.ss.editor.ui.scene.EditorFXScene;
18-
import javafx.application.Platform;
1918
import javafx.collections.ObservableList;
20-
import javafx.geometry.Insets;
2119
import javafx.scene.Group;
2220
import javafx.scene.canvas.Canvas;
21+
import javafx.scene.layout.Pane;
2322
import javafx.scene.layout.StackPane;
23+
import javafx.scene.layout.VBox;
2424
import javafx.stage.Stage;
2525
import org.jetbrains.annotations.NotNull;
2626
import rlib.ui.util.FXUtils;
@@ -92,6 +92,7 @@ private static void build(@NotNull final EditorFXScene scene, @NotNull final Sta
9292

9393
final GlobalLeftToolSplitPane leftSplitContainer = new GlobalLeftToolSplitPane(scene);
9494
leftSplitContainer.setId(CSSIds.MAIN_SPLIT_PANEL);
95+
leftSplitContainer.prefHeightProperty().bind(container.heightProperty());
9596

9697
final GlobalBottomToolSplitPane bottomSplitContainer = new GlobalBottomToolSplitPane(scene);
9798
bottomSplitContainer.setId(CSSIds.MAIN_SPLIT_PANEL);
@@ -105,29 +106,17 @@ private static void build(@NotNull final EditorFXScene scene, @NotNull final Sta
105106
leftSplitContainer.initFor(globalLeftToolComponent, bottomSplitContainer);
106107
bottomSplitContainer.initFor(globalBottomToolComponent, editorAreaComponent);
107108

108-
FXUtils.addToPane(leftSplitContainer, container);
109+
final Pane editorBarOffset = new Pane();
110+
editorBarOffset.setId(CSSIds.EDITOR_BAR_COMPONENT_OFFSET);
111+
112+
FXUtils.addToPane(new VBox(editorBarOffset, leftSplitContainer), container);
109113
FXUtils.addToPane(barComponent, container);
110114

111115
barComponent.createDrawer(container, stage);
112116
barComponent.toFront();
113117

118+
FXUtils.bindFixedWidth(editorBarOffset, container.widthProperty());
114119
FXUtils.bindFixedWidth(leftSplitContainer, container.widthProperty());
115120
FXUtils.bindFixedWidth(barComponent, container.widthProperty());
116-
117-
barComponent.heightProperty().addListener((observable, oldValue, newValue) ->
118-
updateLayout(container, leftSplitContainer, newValue));
119-
}
120-
121-
private static void updateLayout(@NotNull final StackPane container,
122-
@NotNull final GlobalLeftToolSplitPane leftSplitContainer,
123-
@NotNull final Number newValue) {
124-
125-
StackPane.setMargin(leftSplitContainer, new Insets(newValue.doubleValue(), 0, 0, 0));
126-
FXUtils.bindFixedHeight(leftSplitContainer, container.heightProperty().subtract(newValue.doubleValue()).add(2));
127-
128-
Platform.runLater(() -> {
129-
container.requestLayout();
130-
Platform.runLater(container::requestLayout);
131-
});
132121
}
133122
}

src/com/ss/editor/ui/component/split/pane/GlobalBottomToolSplitPane.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected void addElements(final @NotNull TabToolComponent toolComponent, final
2626
}
2727

2828
@Override
29-
protected void addWidthListener(@NotNull final TabToolComponent toolComponent) {
29+
protected void addListeners(@NotNull final TabToolComponent toolComponent) {
3030
toolComponent.heightProperty().addListener((observable, oldValue, newValue) -> handleToolChanged(newValue));
3131
}
3232

src/com/ss/editor/ui/component/split/pane/TabToolSplitPane.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ public C getConfig() {
107107
public void initFor(@NotNull final TabToolComponent toolComponent, @NotNull final Node other) {
108108
this.toolComponent = toolComponent;
109109
addElements(toolComponent, other);
110-
addWidthListener(toolComponent);
110+
addListeners(toolComponent);
111111
bindToScene();
112112
update();
113113
}
114114

115115
/**
116116
* Add with listener to handle width changes.
117117
*/
118-
protected void addWidthListener(@NotNull final TabToolComponent toolComponent) {
118+
protected void addListeners(@NotNull final TabToolComponent toolComponent) {
119119
toolComponent.widthProperty()
120120
.addListener((observable, oldValue, newValue) -> handleToolChanged(newValue));
121121
}

src/com/ss/editor/ui/css/CSSIds.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public interface CSSIds {
1010
String ROOT = "Root";
1111

1212
String EDITOR_BAR_COMPONENT = "EditorBarComponent";
13+
String EDITOR_BAR_COMPONENT_OFFSET = "EditorBarComponentOffset";
1314
String EDITOR_BAR_COMPONENT_TITLE_LABEL = "EditorBarComponentTitleLabel";
1415
String EDITOR_BAR_COMPONENT_MENU_BUTTON = "EditorBarComponentMenuButton";
1516
String EDITOR_BAR_COMPONENT_FULLSCREEN_BUTTON = "EditorBarComponentFullscreenButton";

0 commit comments

Comments
 (0)