Merge pull request #771 from hecrj/fix/tooltip-layering
Reposition `Tooltip` inside `viewport` bounds
This commit is contained in:
commit
939fcfe9db
6 changed files with 88 additions and 44 deletions
|
|
@ -3,7 +3,7 @@ use crate::event::{self, Event};
|
|||
use crate::layout;
|
||||
use crate::overlay;
|
||||
use crate::pane_grid::{self, TitleBar};
|
||||
use crate::{Clipboard, Element, Hasher, Layout, Point, Size};
|
||||
use crate::{Clipboard, Element, Hasher, Layout, Point, Rectangle, Size};
|
||||
|
||||
/// The content of a [`Pane`].
|
||||
///
|
||||
|
|
@ -60,6 +60,7 @@ where
|
|||
defaults: &Renderer::Defaults,
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
viewport: &Rectangle,
|
||||
) -> Renderer::Output {
|
||||
if let Some(title_bar) = &self.title_bar {
|
||||
let mut children = layout.children();
|
||||
|
|
@ -73,6 +74,7 @@ where
|
|||
Some((title_bar, title_bar_layout)),
|
||||
(&self.body, body_layout),
|
||||
cursor_position,
|
||||
viewport,
|
||||
)
|
||||
} else {
|
||||
renderer.draw_pane(
|
||||
|
|
@ -82,6 +84,7 @@ where
|
|||
None,
|
||||
(&self.body, layout),
|
||||
cursor_position,
|
||||
viewport,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use crate::container;
|
|||
use crate::event::{self, Event};
|
||||
use crate::layout;
|
||||
use crate::pane_grid;
|
||||
use crate::{Clipboard, Element, Hasher, Layout, Point, Size};
|
||||
use crate::{Clipboard, Element, Hasher, Layout, Point, Rectangle, Size};
|
||||
|
||||
/// The title bar of a [`Pane`].
|
||||
///
|
||||
|
|
@ -85,6 +85,7 @@ where
|
|||
defaults: &Renderer::Defaults,
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
viewport: &Rectangle,
|
||||
show_controls: bool,
|
||||
) -> Renderer::Output {
|
||||
let mut children = layout.children();
|
||||
|
|
@ -112,6 +113,7 @@ where
|
|||
(&self.content, title_layout),
|
||||
controls,
|
||||
cursor_position,
|
||||
viewport,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue