ui: optimize panel width calculation
This commit is contained in:
parent
e9fa5a140a
commit
3635b7abe6
1 changed files with 9 additions and 13 deletions
|
@ -96,14 +96,12 @@ impl WalletCreation {
|
||||||
ui.vertical_centered(|ui| {
|
ui.vertical_centered(|ui| {
|
||||||
ui.vertical_centered(|ui| {
|
ui.vertical_centered(|ui| {
|
||||||
// Setup content width.
|
// Setup content width.
|
||||||
let mut rect = ui.available_rect_before_wrap();
|
let available_width = ui.available_width();
|
||||||
let mut width = f32::min(
|
if available_width == 0.0 {
|
||||||
ui.available_width(),
|
|
||||||
Root::SIDE_PANEL_WIDTH * 2.0
|
|
||||||
);
|
|
||||||
if width == 0.0 {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let mut rect = ui.available_rect_before_wrap();
|
||||||
|
let width = f32::min(available_width, Root::SIDE_PANEL_WIDTH * 2.0);
|
||||||
rect.set_width(width);
|
rect.set_width(width);
|
||||||
|
|
||||||
// Draw step control content.
|
// Draw step control content.
|
||||||
|
@ -140,14 +138,12 @@ impl WalletCreation {
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
ui.vertical_centered(|ui| {
|
ui.vertical_centered(|ui| {
|
||||||
// Setup content width.
|
// Setup content width.
|
||||||
let mut rect = ui.available_rect_before_wrap();
|
let available_width = ui.available_width();
|
||||||
let mut width = f32::min(
|
if available_width == 0.0 {
|
||||||
ui.available_width(),
|
|
||||||
Root::SIDE_PANEL_WIDTH * 2.0
|
|
||||||
);
|
|
||||||
if width == 0.0 {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let mut rect = ui.available_rect_before_wrap();
|
||||||
|
let width = f32::min(available_width, Root::SIDE_PANEL_WIDTH * 2.0);
|
||||||
rect.set_width(width);
|
rect.set_width(width);
|
||||||
|
|
||||||
// Draw step content.
|
// Draw step content.
|
||||||
|
@ -267,7 +263,7 @@ impl WalletCreation {
|
||||||
match step {
|
match step {
|
||||||
Step::EnterMnemonic => self.mnemonic_setup.ui(ui, frame, cb),
|
Step::EnterMnemonic => self.mnemonic_setup.ui(ui, frame, cb),
|
||||||
Step::ConfirmMnemonic => self.mnemonic_setup.confirm_ui(ui, frame, cb),
|
Step::ConfirmMnemonic => self.mnemonic_setup.confirm_ui(ui, frame, cb),
|
||||||
Step::SetupConnection => self.network_setup.ui(ui, frame, cb)
|
Step::SetupConnection => self.network_setup.create_ui(ui, frame, cb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue