Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Enhanced Ground Software
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
Skyward Enhanced Ground Software
Commits
20f18cb0
Commit
20f18cb0
authored
4 months ago
by
Federico Lolli
Browse files
Options
Downloads
Patches
Plain Diff
WIP
parent
50714b8f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ui/panes/default.rs
+55
-0
55 additions, 0 deletions
src/ui/panes/default.rs
with
55 additions
and
0 deletions
src/ui/panes/default.rs
+
55
−
0
View file @
20f18cb0
use
super
::
PaneBehavior
;
use
super
::
PaneBehavior
;
use
egui
::{
Align
,
Align2
,
Area
,
Color32
,
Frame
,
Label
,
Layout
,
Order
,
UiKind
};
use
serde
::{
Deserialize
,
Serialize
};
use
serde
::{
Deserialize
,
Serialize
};
use
tracing
::
debug
;
use
tracing
::
debug
;
...
@@ -38,6 +39,60 @@ impl PaneBehavior for DefaultPane {
...
@@ -38,6 +39,60 @@ impl PaneBehavior for DefaultPane {
if
ui
.button
(
"Widget Gallery"
)
.clicked
()
{
if
ui
.button
(
"Widget Gallery"
)
.clicked
()
{
response
.set_action
(
PaneAction
::
ReplaceThroughGallery
(
Some
(
tile_id
)));
response
.set_action
(
PaneAction
::
ReplaceThroughGallery
(
Some
(
tile_id
)));
}
}
let
response
=
ui
.button
(
"Open popup"
);
let
popup_id
=
ui
.make_persistent_id
(
"my_unique_id"
);
if
response
.clicked
()
{
ui
.memory_mut
(|
mem
|
mem
.toggle_popup
(
popup_id
));
}
if
ui
.memory
(|
mem
|
mem
.is_popup_open
(
popup_id
))
{
let
frame
=
Frame
::
popup
(
ui
.style
())
.fill
(
Color32
::
DARK_RED
);
let
mut
pos
=
ui
.ctx
()
.screen_rect
()
.right_top
();
pos
.x
-=
15.0
;
pos
.y
+=
15.0
;
let
align
=
Align2
::
RIGHT_TOP
;
let
response
=
Area
::
new
(
popup_id
)
.kind
(
UiKind
::
Popup
)
.order
(
Order
::
Foreground
)
.fixed_pos
(
pos
)
.default_width
(
100.0
)
.pivot
(
align
)
.show
(
ui
.ctx
(),
|
ui
|
{
frame
.show
(
ui
,
|
ui
|
{
ui
.with_layout
(
Layout
::
top_down_justified
(
Align
::
LEFT
),
|
ui
|
{
ui
.set_min_width
(
100.0
);
ui
.style_mut
()
.visuals.override_text_color
=
Some
(
Color32
::
WHITE
);
ui
.label
(
"Popup content"
);
})
.inner
})
.inner
});
}
// let popup_id = ui.make_persistent_id("my_unique_id");
// if response.clicked() {
// ui.memory_mut(|mem| mem.toggle_popup(popup_id));
// }
// let below = egui::AboveOrBelow::Above;
// let close_on_click_outside = egui::popup::PopupCloseBehavior::IgnoreClicks;
// egui::popup::popup_above_or_below_widget(
// ui,
// popup_id,
// &response,
// below,
// close_on_click_outside,
// |ui| {
// ui.set_min_width(200.0); // if you want to control the size
// ui.label("Some more info, or things you can select:");
// ui.label("…");
// },
// );
})
})
.response
.response
});
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment