autocommit 2022-04-20 17:28:17 CEST
This commit is contained in:
parent
ab3c2e44f4
commit
1227ede560
9 changed files with 137 additions and 25 deletions
|
|
@ -25,7 +25,7 @@ use {
|
|||
},
|
||||
state::State,
|
||||
theme::Color,
|
||||
tree::{ContainerNode, DisplayNode, FloatNode, OutputNode, WorkspaceNode},
|
||||
tree::{ContainerNode, DisplayNode, FloatNode, OutputNode, PlaceholderNode, WorkspaceNode},
|
||||
utils::rc_eq::rc_eq,
|
||||
},
|
||||
std::{ops::Deref, rc::Rc, slice},
|
||||
|
|
@ -168,6 +168,20 @@ impl Renderer<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn render_placeholder(&mut self, placeholder: &PlaceholderNode, x: i32, y: i32) {
|
||||
let pos = placeholder.position();
|
||||
self.fill_boxes(
|
||||
std::slice::from_ref(&pos.at_point(x, y)),
|
||||
&Color::from_rgba(20, 20, 20, 255),
|
||||
);
|
||||
if let Some(tex) = placeholder.texture() {
|
||||
let x = x + (pos.width() - tex.width()) / 2;
|
||||
let y = y + (pos.height() - tex.height()) / 2;
|
||||
log::info!("render at {}x{}", x, y);
|
||||
self.render_texture(&tex, x, y, &ARGB8888);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render_container(&mut self, container: &ContainerNode, x: i32, y: i32) {
|
||||
{
|
||||
let rd = container.render_data.borrow_mut();
|
||||
|
|
|
|||
|
|
@ -12,4 +12,8 @@ impl Texture {
|
|||
pub fn width(&self) -> i32 {
|
||||
self.gl.width
|
||||
}
|
||||
|
||||
pub fn height(&self) -> i32 {
|
||||
self.gl.height
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue