Added support for relative positioning of gradient fills. Addressed some PR feedback.
This commit is contained in:
parent
f9a6efcaa0
commit
12a87c54eb
8 changed files with 182 additions and 54 deletions
|
|
@ -28,7 +28,7 @@ pub use stroke::{LineCap, LineDash, LineJoin, Stroke};
|
|||
pub use text::Text;
|
||||
|
||||
use crate::{Backend, Primitive, Renderer};
|
||||
pub use crate::gradient::Gradient;
|
||||
pub use crate::gradient::{Gradient, Position, Location};
|
||||
|
||||
use iced_native::layout::{self, Layout};
|
||||
use iced_native::mouse;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use lyon::geom::euclid::Vector2D;
|
||||
use lyon::geom::euclid::Point2D;
|
||||
use std::borrow::Cow;
|
||||
|
||||
use iced_native::{Point, Rectangle, Size, Vector};
|
||||
|
|
@ -38,11 +38,11 @@ pub(crate) struct Transform {
|
|||
|
||||
impl Transform {
|
||||
/// Transforms the given [Point] by the transformation matrix.
|
||||
pub(crate) fn apply_to(&self, mut point: Point) -> Point {
|
||||
pub(crate) fn transform_point(&self, mut point: Point) -> Point {
|
||||
let transformed =
|
||||
self.raw.transform_vector(Vector2D::new(point.x, point.y));
|
||||
point.x = transformed.x + self.raw.m31;
|
||||
point.y = transformed.y + self.raw.m32;
|
||||
self.raw.transform_point(Point2D::new(point.x, point.y));
|
||||
point.x = transformed.x;
|
||||
point.y = transformed.y;
|
||||
point
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue