commit
5b2c71a708
@ -54,8 +54,7 @@ impl<'a> Editor<'a> {
|
|||||||
|
|
||||||
if start > 0 {
|
if start > 0 {
|
||||||
self.cursor.move_left(self.value);
|
self.cursor.move_left(self.value);
|
||||||
|
self.value.remove(start - 1);
|
||||||
let _ = self.value.remove(start - 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,7 +69,7 @@ impl<'a> Editor<'a> {
|
|||||||
let end = self.cursor.end(self.value);
|
let end = self.cursor.end(self.value);
|
||||||
|
|
||||||
if end < self.value.len() {
|
if end < self.value.len() {
|
||||||
let _ = self.value.remove(end);
|
self.value.remove(end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,8 +103,8 @@ impl Renderer {
|
|||||||
layers.push(Layer::new(Rectangle {
|
layers.push(Layer::new(Rectangle {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: u32::from(width),
|
width,
|
||||||
height: u32::from(height),
|
height,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
self.draw_primitive(Vector::new(0.0, 0.0), primitive, &mut layers);
|
self.draw_primitive(Vector::new(0.0, 0.0), primitive, &mut layers);
|
||||||
@ -356,7 +356,7 @@ impl Renderer {
|
|||||||
) {
|
) {
|
||||||
let bounds = layer.bounds * scale_factor;
|
let bounds = layer.bounds * scale_factor;
|
||||||
|
|
||||||
if layer.meshes.len() > 0 {
|
if !layer.meshes.is_empty() {
|
||||||
let scaled = transformation
|
let scaled = transformation
|
||||||
* Transformation::scale(scale_factor, scale_factor);
|
* Transformation::scale(scale_factor, scale_factor);
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ impl Renderer {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if layer.quads.len() > 0 {
|
if !layer.quads.is_empty() {
|
||||||
self.quad_pipeline.draw(
|
self.quad_pipeline.draw(
|
||||||
device,
|
device,
|
||||||
encoder,
|
encoder,
|
||||||
@ -386,7 +386,7 @@ impl Renderer {
|
|||||||
|
|
||||||
#[cfg(any(feature = "image", feature = "svg"))]
|
#[cfg(any(feature = "image", feature = "svg"))]
|
||||||
{
|
{
|
||||||
if layer.images.len() > 0 {
|
if !layer.images.is_empty() {
|
||||||
let scaled = transformation
|
let scaled = transformation
|
||||||
* Transformation::scale(scale_factor, scale_factor);
|
* Transformation::scale(scale_factor, scale_factor);
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ impl Renderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if layer.text.len() > 0 {
|
if !layer.text.is_empty() {
|
||||||
for text in layer.text.iter() {
|
for text in layer.text.iter() {
|
||||||
// Target physical coordinates directly to avoid blurry text
|
// Target physical coordinates directly to avoid blurry text
|
||||||
let text = wgpu_glyph::Section {
|
let text = wgpu_glyph::Section {
|
||||||
|
@ -10,7 +10,7 @@ impl iced_native::button::Renderer for Renderer {
|
|||||||
|
|
||||||
fn draw<Message>(
|
fn draw<Message>(
|
||||||
&mut self,
|
&mut self,
|
||||||
defaults: &Defaults,
|
_defaults: &Defaults,
|
||||||
bounds: Rectangle,
|
bounds: Rectangle,
|
||||||
cursor_position: Point,
|
cursor_position: Point,
|
||||||
is_disabled: bool,
|
is_disabled: bool,
|
||||||
@ -39,7 +39,6 @@ impl iced_native::button::Renderer for Renderer {
|
|||||||
text: defaults::Text {
|
text: defaults::Text {
|
||||||
color: styling.text_color,
|
color: styling.text_color,
|
||||||
},
|
},
|
||||||
..*defaults
|
|
||||||
},
|
},
|
||||||
content_layout,
|
content_layout,
|
||||||
cursor_position,
|
cursor_position,
|
||||||
|
@ -38,7 +38,7 @@ impl checkbox::Renderer for Renderer {
|
|||||||
content: crate::text::CHECKMARK_ICON.to_string(),
|
content: crate::text::CHECKMARK_ICON.to_string(),
|
||||||
font: crate::text::BUILTIN_ICONS,
|
font: crate::text::BUILTIN_ICONS,
|
||||||
size: bounds.height * 0.7,
|
size: bounds.height * 0.7,
|
||||||
bounds: bounds,
|
bounds,
|
||||||
color: style.checkmark_color,
|
color: style.checkmark_color,
|
||||||
horizontal_alignment: HorizontalAlignment::Center,
|
horizontal_alignment: HorizontalAlignment::Center,
|
||||||
vertical_alignment: VerticalAlignment::Center,
|
vertical_alignment: VerticalAlignment::Center,
|
||||||
|
@ -19,7 +19,6 @@ impl iced_native::container::Renderer for Renderer {
|
|||||||
text: defaults::Text {
|
text: defaults::Text {
|
||||||
color: style.text_color.unwrap_or(defaults.text.color),
|
color: style.text_color.unwrap_or(defaults.text.color),
|
||||||
},
|
},
|
||||||
..*defaults
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let (content, mouse_cursor) =
|
let (content, mouse_cursor) =
|
||||||
|
@ -106,8 +106,7 @@ impl text_input::Renderer for Renderer {
|
|||||||
style_sheet.placeholder_color()
|
style_sheet.placeholder_color()
|
||||||
} else {
|
} else {
|
||||||
style_sheet.value_color()
|
style_sheet.value_color()
|
||||||
}
|
},
|
||||||
.into(),
|
|
||||||
font,
|
font,
|
||||||
bounds: Rectangle {
|
bounds: Rectangle {
|
||||||
width: f32::INFINITY,
|
width: f32::INFINITY,
|
||||||
|
@ -45,7 +45,7 @@ pub enum Antialiasing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Antialiasing {
|
impl Antialiasing {
|
||||||
pub(crate) fn sample_count(&self) -> u32 {
|
pub(crate) fn sample_count(self) -> u32 {
|
||||||
match self {
|
match self {
|
||||||
Antialiasing::MSAAx2 => 2,
|
Antialiasing::MSAAx2 => 2,
|
||||||
Antialiasing::MSAAx4 => 4,
|
Antialiasing::MSAAx4 => 4,
|
||||||
|
@ -49,6 +49,6 @@ impl AsRef<[f32; 16]> for Transformation {
|
|||||||
|
|
||||||
impl From<Transformation> for [f32; 16] {
|
impl From<Transformation> for [f32; 16] {
|
||||||
fn from(t: Transformation) -> [f32; 16] {
|
fn from(t: Transformation) -> [f32; 16] {
|
||||||
t.as_ref().clone()
|
*t.as_ref()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ impl Blit {
|
|||||||
format,
|
format,
|
||||||
pipeline,
|
pipeline,
|
||||||
constants: constant_bind_group,
|
constants: constant_bind_group,
|
||||||
texture_layout: texture_layout,
|
texture_layout,
|
||||||
sample_count: antialiasing.sample_count(),
|
sample_count: antialiasing.sample_count(),
|
||||||
targets: None,
|
targets: None,
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ pub trait Application: Sized {
|
|||||||
Runtime::new(executor, Proxy::new(event_loop.create_proxy()))
|
Runtime::new(executor, Proxy::new(event_loop.create_proxy()))
|
||||||
};
|
};
|
||||||
|
|
||||||
let (mut application, init_command) = runtime.enter(|| Self::new());
|
let (mut application, init_command) = runtime.enter(Self::new);
|
||||||
runtime.spawn(init_command);
|
runtime.spawn(init_command);
|
||||||
|
|
||||||
let subscription = application.subscription();
|
let subscription = application.subscription();
|
||||||
|
Loading…
Reference in New Issue
Block a user