implement text support in canvas widget

This commit is contained in:
Artur Sapek 2020-03-05 22:05:05 -07:00 committed by Artur Sapek
parent 29219500b7
commit 1bb8555691
5 changed files with 80 additions and 31 deletions

View file

@ -20,6 +20,7 @@ mod drawable;
mod fill;
mod frame;
mod stroke;
mod text;
pub use drawable::Drawable;
pub use fill::Fill;
@ -27,6 +28,7 @@ pub use frame::Frame;
pub use layer::Layer;
pub use path::Path;
pub use stroke::{LineCap, LineJoin, Stroke};
pub use text::TextNode;
/// A widget capable of drawing 2D graphics.
///
@ -121,10 +123,7 @@ impl<'a, Message> Widget<Message, Renderer> for Canvas<'a> {
primitives: self
.layers
.iter()
.map(|layer| Primitive::Mesh2D {
origin,
buffers: layer.draw(size),
})
.map(|layer| layer.draw(origin, size))
.collect(),
},
MouseCursor::Idle,