Overhaul the entire element system

Now the Element trait is designed to be wrapped in a Lifecycle enum that gets placed inside an ElementBox. This allows the framework to store data on behalf of the Element implementation, such as sizes, bounds, and also implementation-specific LayoutState and PaintState types. This makes it easier to reason about which data is available in each Element method.
This commit is contained in:
Nathan Sobo 2021-03-21 20:54:23 -06:00
parent 046fe3fff9
commit 119aa452b6
27 changed files with 931 additions and 642 deletions

View file

@ -2,7 +2,7 @@ use crate::{
color::ColorU,
fonts::{FontCache, FontId, GlyphId},
geometry::rect::RectF,
scene::Scene,
PaintContext,
};
use core_foundation::{
attributed_string::CFMutableAttributedString,
@ -188,11 +188,9 @@ impl Line {
pub fn paint(
&self,
_origin: Vector2F,
_viewport_rect: RectF,
_bounds: RectF,
_colors: &[(Range<usize>, ColorU)],
_scene: Scene,
_font_cache: &FontCache,
_ctx: &mut PaintContext,
) {
// canvas.set_font_size(self.font_size);
// let mut colors = colors.iter().peekable();