Skip to content

Commit

Permalink
LSP preview: disable selection handle when not in experimental mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ogoffart committed Feb 20, 2024
1 parent a0eed4e commit a53c4c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/lsp/ui/draw-area.slint
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export struct Selection {

component SelectionFrame {
in property <Selection> selection;
in property <bool> experimental: false;

x: root.selection.x;
y: root.selection.y;
Expand All @@ -32,14 +33,14 @@ component SelectionFrame {

callback update-geometry(/* x */ length, /* y */ length, /* width */ length, /* height */ length);

if !selection.is-primary: Rectangle {
if !selection.is-primary || !experimental: Rectangle {
x: 0;
y: 0;
border-color: root.selection.border-color;
border-width: 1px;
}

if selection.is-primary: Resizer {
if selection.is-primary && experimental: Resizer {
is-moveable: true;
is-resizable: true;

Expand Down Expand Up @@ -76,6 +77,7 @@ export component DrawArea {
in property <[Selection]> selections;
in property <component-factory> preview-area;
in property <bool> design-mode;
in property <bool> experimental: false;

out property <bool> preview-visible: i-preview-area-container.has-component && !diagnostics.diagnostics-open;

Expand Down Expand Up @@ -199,6 +201,7 @@ export component DrawArea {

i-selection-display-area := Rectangle {
for s in root.selections: SelectionFrame {
experimental: root.experimental;
selection: s;
update-geometry(x, y, w, h) => {
root.selected-element-update-geometry(x, y, w, h);
Expand Down
1 change: 1 addition & 0 deletions tools/lsp/ui/main.slint
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export component PreviewUi inherits Window {
diagnostics <=> root.diagnostics;
preview-area <=> root.preview-area;
selections <=> root.selections;
experimental <=> root.experimental;

select-at(x, y, enter_component) => { root.select-at(x, y, enter_component); }
selected-element-update-geometry(x, y, w, h) => { root.selected-element-update-geometry(x, y, w, h); }
Expand Down

0 comments on commit a53c4c8

Please sign in to comment.