1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-11-13 05:07:24 +03:00

Convert degrees to radians when parsing SVG element transform

This commit is contained in:
shipinev 2016-11-30 17:59:58 +07:00
parent 82ad598c76
commit 1d0cdc8093

View File

@ -235,10 +235,10 @@ open class SVGParser {
case "rotate":
if let angle = Double(values[0]) {
if values.count == 1 {
finalTransform = transform.rotate(angle: angle)
finalTransform = transform.rotate(angle: degreesToRadians(angle))
} else if values.count == 3 {
if let x = Double(values[1]), let y = Double(values[2]) {
finalTransform = transform.move(dx: x, dy: y).rotate(angle: angle).move(dx: -x, dy: -y)
finalTransform = transform.move(dx: x, dy: y).rotate(angle: degreesToRadians(angle)).move(dx: -x, dy: -y)
}
}
}
@ -1219,4 +1219,9 @@ open class SVGParser {
}
return .none
}
fileprivate func degreesToRadians(_ degrees: Double) -> Double {
return degrees * .pi / 180
}
}