Fix viewport
argument in PaneGrid
draw calls
This commit is contained in:
parent
a5fddf9ee6
commit
f52f8c1337
@ -45,6 +45,7 @@ where
|
|||||||
layout: Layout<'_>,
|
layout: Layout<'_>,
|
||||||
style_sheet: &<Self as pane_grid::Renderer>::Style,
|
style_sheet: &<Self as pane_grid::Renderer>::Style,
|
||||||
cursor_position: Point,
|
cursor_position: Point,
|
||||||
|
viewport: &Rectangle,
|
||||||
) -> Self::Output {
|
) -> Self::Output {
|
||||||
let pane_cursor_position = if dragging.is_some() {
|
let pane_cursor_position = if dragging.is_some() {
|
||||||
// TODO: Remove once cursor availability is encoded in the type
|
// TODO: Remove once cursor availability is encoded in the type
|
||||||
@ -62,8 +63,13 @@ where
|
|||||||
.zip(layout.children())
|
.zip(layout.children())
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(i, ((id, pane), layout))| {
|
.map(|(i, ((id, pane), layout))| {
|
||||||
let (primitive, new_mouse_interaction) =
|
let (primitive, new_mouse_interaction) = pane.draw(
|
||||||
pane.draw(self, defaults, layout, pane_cursor_position);
|
self,
|
||||||
|
defaults,
|
||||||
|
layout,
|
||||||
|
pane_cursor_position,
|
||||||
|
viewport,
|
||||||
|
);
|
||||||
|
|
||||||
if new_mouse_interaction > mouse_interaction {
|
if new_mouse_interaction > mouse_interaction {
|
||||||
mouse_interaction = new_mouse_interaction;
|
mouse_interaction = new_mouse_interaction;
|
||||||
@ -180,12 +186,13 @@ where
|
|||||||
title_bar: Option<(&TitleBar<'_, Message, Self>, Layout<'_>)>,
|
title_bar: Option<(&TitleBar<'_, Message, Self>, Layout<'_>)>,
|
||||||
body: (&Element<'_, Message, Self>, Layout<'_>),
|
body: (&Element<'_, Message, Self>, Layout<'_>),
|
||||||
cursor_position: Point,
|
cursor_position: Point,
|
||||||
|
viewport: &Rectangle,
|
||||||
) -> Self::Output {
|
) -> Self::Output {
|
||||||
let style = style_sheet.style();
|
let style = style_sheet.style();
|
||||||
let (body, body_layout) = body;
|
let (body, body_layout) = body;
|
||||||
|
|
||||||
let (body_primitive, body_interaction) =
|
let (body_primitive, body_interaction) =
|
||||||
body.draw(self, defaults, body_layout, cursor_position, &bounds);
|
body.draw(self, defaults, body_layout, cursor_position, viewport);
|
||||||
|
|
||||||
let background = crate::widget::container::background(bounds, &style);
|
let background = crate::widget::container::background(bounds, &style);
|
||||||
|
|
||||||
@ -199,6 +206,7 @@ where
|
|||||||
defaults,
|
defaults,
|
||||||
title_bar_layout,
|
title_bar_layout,
|
||||||
cursor_position,
|
cursor_position,
|
||||||
|
viewport,
|
||||||
show_controls,
|
show_controls,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -240,6 +248,7 @@ where
|
|||||||
content: (&Element<'_, Message, Self>, Layout<'_>),
|
content: (&Element<'_, Message, Self>, Layout<'_>),
|
||||||
controls: Option<(&Element<'_, Message, Self>, Layout<'_>)>,
|
controls: Option<(&Element<'_, Message, Self>, Layout<'_>)>,
|
||||||
cursor_position: Point,
|
cursor_position: Point,
|
||||||
|
viewport: &Rectangle,
|
||||||
) -> Self::Output {
|
) -> Self::Output {
|
||||||
let style = style_sheet.style();
|
let style = style_sheet.style();
|
||||||
let (title_content, title_layout) = content;
|
let (title_content, title_layout) = content;
|
||||||
@ -257,7 +266,7 @@ where
|
|||||||
&defaults,
|
&defaults,
|
||||||
title_layout,
|
title_layout,
|
||||||
cursor_position,
|
cursor_position,
|
||||||
&bounds,
|
viewport,
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Some((controls, controls_layout)) = controls {
|
if let Some((controls, controls_layout)) = controls {
|
||||||
@ -266,7 +275,7 @@ where
|
|||||||
&defaults,
|
&defaults,
|
||||||
controls_layout,
|
controls_layout,
|
||||||
cursor_position,
|
cursor_position,
|
||||||
&bounds,
|
viewport,
|
||||||
);
|
);
|
||||||
|
|
||||||
(
|
(
|
||||||
|
@ -257,6 +257,7 @@ impl pane_grid::Renderer for Null {
|
|||||||
_layout: Layout<'_>,
|
_layout: Layout<'_>,
|
||||||
_style: &<Self as pane_grid::Renderer>::Style,
|
_style: &<Self as pane_grid::Renderer>::Style,
|
||||||
_cursor_position: Point,
|
_cursor_position: Point,
|
||||||
|
_viewport: &Rectangle,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,6 +272,7 @@ impl pane_grid::Renderer for Null {
|
|||||||
)>,
|
)>,
|
||||||
_body: (&Element<'_, Message, Self>, Layout<'_>),
|
_body: (&Element<'_, Message, Self>, Layout<'_>),
|
||||||
_cursor_position: Point,
|
_cursor_position: Point,
|
||||||
|
_viewport: &Rectangle,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,6 +284,7 @@ impl pane_grid::Renderer for Null {
|
|||||||
_content: (&Element<'_, Message, Self>, Layout<'_>),
|
_content: (&Element<'_, Message, Self>, Layout<'_>),
|
||||||
_controls: Option<(&Element<'_, Message, Self>, Layout<'_>)>,
|
_controls: Option<(&Element<'_, Message, Self>, Layout<'_>)>,
|
||||||
_cursor_position: Point,
|
_cursor_position: Point,
|
||||||
|
_viewport: &Rectangle,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@ where
|
|||||||
defaults: &Renderer::Defaults,
|
defaults: &Renderer::Defaults,
|
||||||
layout: Layout<'_>,
|
layout: Layout<'_>,
|
||||||
cursor_position: Point,
|
cursor_position: Point,
|
||||||
_viewport: &Rectangle,
|
viewport: &Rectangle,
|
||||||
) -> Renderer::Output {
|
) -> Renderer::Output {
|
||||||
let picked_split = self
|
let picked_split = self
|
||||||
.state
|
.state
|
||||||
@ -537,6 +537,7 @@ where
|
|||||||
layout,
|
layout,
|
||||||
&self.style,
|
&self.style,
|
||||||
cursor_position,
|
cursor_position,
|
||||||
|
viewport,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,6 +595,7 @@ pub trait Renderer: crate::Renderer + container::Renderer + Sized {
|
|||||||
layout: Layout<'_>,
|
layout: Layout<'_>,
|
||||||
style: &<Self as self::Renderer>::Style,
|
style: &<Self as self::Renderer>::Style,
|
||||||
cursor_position: Point,
|
cursor_position: Point,
|
||||||
|
viewport: &Rectangle,
|
||||||
) -> Self::Output;
|
) -> Self::Output;
|
||||||
|
|
||||||
/// Draws a [`Pane`].
|
/// Draws a [`Pane`].
|
||||||
@ -611,6 +613,7 @@ pub trait Renderer: crate::Renderer + container::Renderer + Sized {
|
|||||||
title_bar: Option<(&TitleBar<'_, Message, Self>, Layout<'_>)>,
|
title_bar: Option<(&TitleBar<'_, Message, Self>, Layout<'_>)>,
|
||||||
body: (&Element<'_, Message, Self>, Layout<'_>),
|
body: (&Element<'_, Message, Self>, Layout<'_>),
|
||||||
cursor_position: Point,
|
cursor_position: Point,
|
||||||
|
viewport: &Rectangle,
|
||||||
) -> Self::Output;
|
) -> Self::Output;
|
||||||
|
|
||||||
/// Draws a [`TitleBar`].
|
/// Draws a [`TitleBar`].
|
||||||
@ -629,6 +632,7 @@ pub trait Renderer: crate::Renderer + container::Renderer + Sized {
|
|||||||
content: (&Element<'_, Message, Self>, Layout<'_>),
|
content: (&Element<'_, Message, Self>, Layout<'_>),
|
||||||
controls: Option<(&Element<'_, Message, Self>, Layout<'_>)>,
|
controls: Option<(&Element<'_, Message, Self>, Layout<'_>)>,
|
||||||
cursor_position: Point,
|
cursor_position: Point,
|
||||||
|
viewport: &Rectangle,
|
||||||
) -> Self::Output;
|
) -> Self::Output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use crate::event::{self, Event};
|
|||||||
use crate::layout;
|
use crate::layout;
|
||||||
use crate::overlay;
|
use crate::overlay;
|
||||||
use crate::pane_grid::{self, TitleBar};
|
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`].
|
/// The content of a [`Pane`].
|
||||||
///
|
///
|
||||||
@ -60,6 +60,7 @@ where
|
|||||||
defaults: &Renderer::Defaults,
|
defaults: &Renderer::Defaults,
|
||||||
layout: Layout<'_>,
|
layout: Layout<'_>,
|
||||||
cursor_position: Point,
|
cursor_position: Point,
|
||||||
|
viewport: &Rectangle,
|
||||||
) -> Renderer::Output {
|
) -> Renderer::Output {
|
||||||
if let Some(title_bar) = &self.title_bar {
|
if let Some(title_bar) = &self.title_bar {
|
||||||
let mut children = layout.children();
|
let mut children = layout.children();
|
||||||
@ -73,6 +74,7 @@ where
|
|||||||
Some((title_bar, title_bar_layout)),
|
Some((title_bar, title_bar_layout)),
|
||||||
(&self.body, body_layout),
|
(&self.body, body_layout),
|
||||||
cursor_position,
|
cursor_position,
|
||||||
|
viewport,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
renderer.draw_pane(
|
renderer.draw_pane(
|
||||||
@ -82,6 +84,7 @@ where
|
|||||||
None,
|
None,
|
||||||
(&self.body, layout),
|
(&self.body, layout),
|
||||||
cursor_position,
|
cursor_position,
|
||||||
|
viewport,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ use crate::container;
|
|||||||
use crate::event::{self, Event};
|
use crate::event::{self, Event};
|
||||||
use crate::layout;
|
use crate::layout;
|
||||||
use crate::pane_grid;
|
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`].
|
/// The title bar of a [`Pane`].
|
||||||
///
|
///
|
||||||
@ -85,6 +85,7 @@ where
|
|||||||
defaults: &Renderer::Defaults,
|
defaults: &Renderer::Defaults,
|
||||||
layout: Layout<'_>,
|
layout: Layout<'_>,
|
||||||
cursor_position: Point,
|
cursor_position: Point,
|
||||||
|
viewport: &Rectangle,
|
||||||
show_controls: bool,
|
show_controls: bool,
|
||||||
) -> Renderer::Output {
|
) -> Renderer::Output {
|
||||||
let mut children = layout.children();
|
let mut children = layout.children();
|
||||||
@ -112,6 +113,7 @@ where
|
|||||||
(&self.content, title_layout),
|
(&self.content, title_layout),
|
||||||
controls,
|
controls,
|
||||||
cursor_position,
|
cursor_position,
|
||||||
|
viewport,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user