mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Match rotate ops.
Per bug 1322189 we really should. I've copied the setup we have already for translate / scale, but we should really clean this up a bit more I'd think. In any case, probably skew should be matched as well... Bug: 1464615 Reviewed-by: hiro MozReview-Commit-ID: Jky5k8HVfuH
This commit is contained in:
parent
01f805af9f
commit
2e500d70ef
3 changed files with 46 additions and 1 deletions
|
@ -151,6 +151,27 @@ impl TransformOperation {
|
|||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert to a Rotate3D.
|
||||
///
|
||||
/// Must be called on a Rotate function.
|
||||
pub fn to_rotate_3d(&self) -> Self {
|
||||
match *self {
|
||||
generic::TransformOperation::Rotate3D(..) => self.clone(),
|
||||
generic::TransformOperation::RotateZ(ref angle) |
|
||||
generic::TransformOperation::Rotate(ref angle) => {
|
||||
generic::TransformOperation::Rotate3D(0., 0., 1., angle.clone())
|
||||
}
|
||||
generic::TransformOperation::RotateX(ref angle) => {
|
||||
generic::TransformOperation::Rotate3D(1., 0., 0., angle.clone())
|
||||
}
|
||||
generic::TransformOperation::RotateY(ref angle) => {
|
||||
generic::TransformOperation::Rotate3D(0., 1., 0., angle.clone())
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert to a Scale3D.
|
||||
///
|
||||
/// Must be called on a Scale function
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue