From 65eb218d3d7ba52b2869a586a1480eeb3c8f84e4 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 21 Nov 2019 13:47:20 +0100 Subject: Move widgets from `core` to `native` and `web` Also made fields private and improved `Renderer` traits. --- wgpu/src/renderer.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'wgpu/src/renderer.rs') diff --git a/wgpu/src/renderer.rs b/wgpu/src/renderer.rs index 52764248..4199eee5 100644 --- a/wgpu/src/renderer.rs +++ b/wgpu/src/renderer.rs @@ -1,7 +1,7 @@ use crate::{quad, text, Image, Primitive, Quad, Transformation}; use iced_native::{ - renderer::Debugger, renderer::Windowed, Background, Color, Layout, - MouseCursor, Point, Rectangle, Vector, Widget, + renderer::{Debugger, Windowed}, + Background, Color, Layout, MouseCursor, Point, Rectangle, Vector, Widget, }; use wgpu::{ @@ -152,21 +152,21 @@ impl Renderer { vertical_alignment, } => { let x = match horizontal_alignment { - iced_native::text::HorizontalAlignment::Left => bounds.x, - iced_native::text::HorizontalAlignment::Center => { + iced_native::HorizontalAlignment::Left => bounds.x, + iced_native::HorizontalAlignment::Center => { bounds.x + bounds.width / 2.0 } - iced_native::text::HorizontalAlignment::Right => { + iced_native::HorizontalAlignment::Right => { bounds.x + bounds.width } }; let y = match vertical_alignment { - iced_native::text::VerticalAlignment::Top => bounds.y, - iced_native::text::VerticalAlignment::Center => { + iced_native::VerticalAlignment::Top => bounds.y, + iced_native::VerticalAlignment::Center => { bounds.y + bounds.height / 2.0 } - iced_native::text::VerticalAlignment::Bottom => { + iced_native::VerticalAlignment::Bottom => { bounds.y + bounds.height } }; @@ -183,24 +183,24 @@ impl Renderer { font_id: self.text_pipeline.find_font(*font), layout: wgpu_glyph::Layout::default() .h_align(match horizontal_alignment { - iced_native::text::HorizontalAlignment::Left => { + iced_native::HorizontalAlignment::Left => { wgpu_glyph::HorizontalAlign::Left } - iced_native::text::HorizontalAlignment::Center => { + iced_native::HorizontalAlignment::Center => { wgpu_glyph::HorizontalAlign::Center } - iced_native::text::HorizontalAlignment::Right => { + iced_native::HorizontalAlignment::Right => { wgpu_glyph::HorizontalAlign::Right } }) .v_align(match vertical_alignment { - iced_native::text::VerticalAlignment::Top => { + iced_native::VerticalAlignment::Top => { wgpu_glyph::VerticalAlign::Top } - iced_native::text::VerticalAlignment::Center => { + iced_native::VerticalAlignment::Center => { wgpu_glyph::VerticalAlign::Center } - iced_native::text::VerticalAlignment::Bottom => { + iced_native::VerticalAlignment::Bottom => { wgpu_glyph::VerticalAlign::Bottom } }), -- cgit