From f35c9f25f03976e058e892662454b1143fd172cd Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 7 Mar 2020 22:27:02 +0100 Subject: Rename `canvas::TextNode` to `canvas::Text` --- wgpu/src/widget/canvas.rs | 2 +- wgpu/src/widget/canvas/frame.rs | 10 +++++----- wgpu/src/widget/canvas/text.rs | 8 +++++--- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'wgpu/src/widget') diff --git a/wgpu/src/widget/canvas.rs b/wgpu/src/widget/canvas.rs index 7d0c5bf3..9741ee9d 100644 --- a/wgpu/src/widget/canvas.rs +++ b/wgpu/src/widget/canvas.rs @@ -28,7 +28,7 @@ pub use frame::Frame; pub use layer::Layer; pub use path::Path; pub use stroke::{LineCap, LineJoin, Stroke}; -pub use text::TextNode; +pub use text::Text; /// A widget capable of drawing 2D graphics. /// diff --git a/wgpu/src/widget/canvas/frame.rs b/wgpu/src/widget/canvas/frame.rs index cdb9d0e1..44a8d9aa 100644 --- a/wgpu/src/widget/canvas/frame.rs +++ b/wgpu/src/widget/canvas/frame.rs @@ -1,7 +1,7 @@ use iced_native::{Point, Size, Vector}; use crate::{ - canvas::{Fill, Path, Stroke, TextNode}, + canvas::{Fill, Path, Stroke, Text}, triangle, Primitive, }; @@ -16,7 +16,7 @@ pub struct Frame { height: f32, buffers: lyon::tessellation::VertexBuffers, transforms: Transforms, - texts: Vec, + texts: Vec, } #[derive(Debug)] @@ -158,11 +158,11 @@ impl Frame { let _ = result.expect("Stroke path"); } - /// Draws the text of the given [`TextNode`] on the [`Frame`] + /// Draws the text of the given [`Text`] on the [`Frame`] /// - /// [`TextNode`]: struct.TextNode.html + /// [`Text`]: struct.Text.html /// [`Frame`]: struct.Frame.html - pub fn text(&mut self, text: TextNode) { + pub fn text(&mut self, text: Text) { self.texts.push(text); } diff --git a/wgpu/src/widget/canvas/text.rs b/wgpu/src/widget/canvas/text.rs index 5f6abe58..241f8503 100644 --- a/wgpu/src/widget/canvas/text.rs +++ b/wgpu/src/widget/canvas/text.rs @@ -1,8 +1,10 @@ -use iced_native::{Color, Font, HorizontalAlignment, Rectangle, VerticalAlignment}; +use iced_native::{ + Color, Font, HorizontalAlignment, Rectangle, VerticalAlignment, +}; -/// A text node to be drawn to a canvas +/// A bunch of text that can be drawn to a canvas #[derive(Debug, Clone)] -pub struct TextNode { +pub struct Text { /// The contents of the text pub content: String, /// The bounds of the text -- cgit