Skip to content

Commit c52fdd7

Browse files
authored
preview: attempting a header change to optimize usability (#6720)
changed the interaction for header view both library and properties can be shown anytime and selection is is a toggle button at any time suggestions: goes hand in hand with the selection mode likely requires settings for toggle or single select. attempting a header change to optimize usability TODO: make dragging from library automatically into edit mode the toggle that existed is the same as toggling a button - whcih can sit next to the closed library and properties. properties should be editable while selection is active so those should be openable / visible whether in edit mode or not. STILL TODO: - make dragging from library automatically into edit mode - add settings to either single select 'inspect' button or toggle on off - change display of active icon OR add icon for toggled mode for clearer display than blue icon for inspect
1 parent d40e28a commit c52fdd7

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

tools/lsp/ui/main.slint

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { PropertyView } from "./views/property-view.slint";
1616

1717
export { Api }
1818

19+
1920
export component PreviewUi inherits Window {
2021
property <length> border: 20px;
2122
property <ComponentItem> visible-component: {
@@ -25,8 +26,9 @@ export component PreviewUi inherits Window {
2526
is-user-defined: false,
2627
is-currently-shown: false,
2728
};
28-
property <bool> show-left-sidebar: true;
29-
property <bool> show-right-sidebar: true;
29+
property <bool> show-left-sidebar;
30+
property <bool> show-right-sidebar;
31+
3032

3133
title: "Slint Live-Preview";
3234
icon: @image-url("assets/slint-logo-small-light.png");
@@ -63,20 +65,22 @@ export component PreviewUi inherits Window {
6365
Api.style-changed();
6466
}
6567

66-
Button {
68+
edit:=Button {
6769
icon: Icons.inspect;
68-
colorize-icon: true;
70+
colorize-icon: preview.select-mode ? false : true;
6971
checkable: true;
7072
checked <=> preview.select-mode;
7173
enabled: !preview.design-mode;
7274
visible: !preview.design-mode;
75+
primary: preview.select-mode;
7376
}
7477
}
7578

79+
7680
HorizontalLayout {
7781
spacing: EditorSpaceSettings.default-spacing;
7882

79-
if Api.design-mode && root.show-left-sidebar: LibraryView {
83+
if root.show-left-sidebar: LibraryView {
8084
known-components: Api.known-components;
8185
preview-area-position-x: preview.preview-area-position-x;
8286
preview-area-position-y: preview.preview-area-position-y;
@@ -101,7 +105,7 @@ export component PreviewUi inherits Window {
101105
visible-component <=> root.visible-component;
102106
}
103107

104-
if Api.design-mode && root.show-right-sidebar: PropertyView { }
108+
if root.show-right-sidebar: PropertyView { }
105109
}
106110

107111
StatusLine { }

tools/lsp/ui/views/header-view.slint

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ export component HeaderView {
4747
spacing: EditorSpaceSettings.default-spacing;
4848

4949
HorizontalLayout {
50+
visible: false;
5051
spacing: EditorSpaceSettings.default-spacing / 2;
51-
horizontal-stretch: 0;
52-
53-
@children
52+
horizontal-stretch: 1;
5453

5554
BodyText {
5655
text: @tr("Interact");
5756
}
5857

5958
interaction-switch := Switch {
59+
checked: true;
6060
toggled => {
6161
root.edit-mode-toggled();
6262
}
@@ -66,14 +66,14 @@ export component HeaderView {
6666
text: @tr("Edit");
6767
}
6868
}
69+
@children
6970

7071
left-panel-button := Button {
7172
horizontal-stretch: 0;
7273

7374
checkable: true;
7475
icon: self.checked ? Icons.sidebar-left : Icons.sidebar-left-off;
7576
colorize-icon: true;
76-
visible:root.edit-mode;
7777
}
7878

7979
right-panel-button := Button {
@@ -82,7 +82,7 @@ export component HeaderView {
8282
checkable: true;
8383
icon: self.checked ? Icons.sidebar-right : Icons.sidebar-right-off;
8484
colorize-icon: true;
85-
visible: root.edit-mode;
85+
// visible: root.edit-mode;
8686
}
8787
}
8888

0 commit comments

Comments
 (0)