ui: fix min/max width detection
This commit is contained in:
parent
b827c717db
commit
a57b7e7aec
2 changed files with 5 additions and 8 deletions
|
@ -12,7 +12,6 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
use std::cmp::min;
|
|
||||||
use std::sync::RwLock;
|
use std::sync::RwLock;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
|
||||||
|
@ -194,8 +193,8 @@ impl Modal {
|
||||||
|
|
||||||
// Setup width of modal content.
|
// Setup width of modal content.
|
||||||
let side_insets = View::get_left_inset() + View::get_right_inset();
|
let side_insets = View::get_left_inset() + View::get_right_inset();
|
||||||
let available_width = (ui.available_width() - (side_insets + Self::DEFAULT_MARGIN)) as i64;
|
let available_width = ui.available_width() - (side_insets + Self::DEFAULT_MARGIN);
|
||||||
let width = min(available_width, Self::DEFAULT_WIDTH as i64) as f32;
|
let width = f32::min(available_width, Self::DEFAULT_WIDTH);
|
||||||
|
|
||||||
// Show main content Window at given position.
|
// Show main content Window at given position.
|
||||||
let (content_align, content_offset) = self.modal_position();
|
let (content_align, content_offset) = self.modal_position();
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
use std::cmp::{max, min};
|
|
||||||
|
|
||||||
use egui::{Align, Align2, Layout, Margin, RichText, Rounding, ScrollArea, TextStyle, Widget};
|
use egui::{Align, Align2, Layout, Margin, RichText, Rounding, ScrollArea, TextStyle, Widget};
|
||||||
use egui_extras::{Size, StripBuilder};
|
use egui_extras::{Size, StripBuilder};
|
||||||
|
|
||||||
|
@ -244,7 +242,7 @@ impl WalletsContent {
|
||||||
let mut rect = ui.available_rect_before_wrap();
|
let mut rect = ui.available_rect_before_wrap();
|
||||||
let mut width = ui.available_width();
|
let mut width = ui.available_width();
|
||||||
if !dual_panel {
|
if !dual_panel {
|
||||||
width = min(width as i64, (Root::SIDE_PANEL_WIDTH * 1.3) as i64) as f32
|
width = f32::min(width, (Root::SIDE_PANEL_WIDTH * 1.3))
|
||||||
}
|
}
|
||||||
if width == 0.0 {
|
if width == 0.0 {
|
||||||
return;
|
return;
|
||||||
|
@ -505,8 +503,8 @@ impl WalletsContent {
|
||||||
ui.available_width() - Root::SIDE_PANEL_WIDTH
|
ui.available_width() - Root::SIDE_PANEL_WIDTH
|
||||||
};
|
};
|
||||||
if dual_panel {
|
if dual_panel {
|
||||||
let min_width = (Root::SIDE_PANEL_WIDTH + View::get_right_inset()) as i64;
|
let min_width = Root::SIDE_PANEL_WIDTH + View::get_right_inset();
|
||||||
max(min_width, available_width as i64) as f32
|
f32::max(min_width, available_width)
|
||||||
} else {
|
} else {
|
||||||
if is_wallet_showing {
|
if is_wallet_showing {
|
||||||
ui.available_width()
|
ui.available_width()
|
||||||
|
|
Loading…
Reference in a new issue