mirror of
https://github.com/exyte/Macaw.git
synced 2024-09-21 09:59:10 +03:00
Merge commit 'c78b3e9605d1e50fed488f98214cbaff8e3808f9' into task/svgViewBox
This commit is contained in:
commit
052003ade0
@ -14,6 +14,7 @@ disabled_rules:
|
|||||||
- strict_fileprivate
|
- strict_fileprivate
|
||||||
- sorted_imports
|
- sorted_imports
|
||||||
- identifier_name # Disabled due to a lot of one symbol identifiers
|
- identifier_name # Disabled due to a lot of one symbol identifiers
|
||||||
|
- let_var_whitespace
|
||||||
# Temporary disabled
|
# Temporary disabled
|
||||||
- explicit_type_interface
|
- explicit_type_interface
|
||||||
- line_length
|
- line_length
|
||||||
@ -66,7 +67,6 @@ opt_in_rules:
|
|||||||
- legacy_cggeometry_functions
|
- legacy_cggeometry_functions
|
||||||
- legacy_constant
|
- legacy_constant
|
||||||
- legacy_nsgeometry_functions
|
- legacy_nsgeometry_functions
|
||||||
- let_var_whitespace
|
|
||||||
- mark
|
- mark
|
||||||
- multiline_parameters
|
- multiline_parameters
|
||||||
- multiple_closures_with_trailing_closure
|
- multiple_closures_with_trailing_closure
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>IDEDidComputeMac32BitWarning</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@ -32,11 +32,11 @@ open class LinearGradient: Gradient {
|
|||||||
let mmax = 1 / max(abs(v[2]), abs(v[3]))
|
let mmax = 1 / max(abs(v[2]), abs(v[3]))
|
||||||
v[2] *= mmax
|
v[2] *= mmax
|
||||||
v[3] *= mmax
|
v[3] *= mmax
|
||||||
if (v[2] < 0) {
|
if v[2] < 0 {
|
||||||
v[0] = -v[2]
|
v[0] = -v[2]
|
||||||
v[2] = 0
|
v[2] = 0
|
||||||
}
|
}
|
||||||
if (v[3] < 0) {
|
if v[3] < 0 {
|
||||||
v[1] = -v[3]
|
v[1] = -v[3]
|
||||||
v[3] = 0
|
v[3] = 0
|
||||||
}
|
}
|
||||||
|
@ -367,7 +367,7 @@ class RenderUtils {
|
|||||||
|
|
||||||
// find arc center coordinates and points angles as per
|
// find arc center coordinates and points angles as per
|
||||||
// http://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter
|
// http://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter
|
||||||
if (_rx == 0 || _ry == 0) {
|
if _rx == 0 || _ry == 0 {
|
||||||
L(x, y: y)
|
L(x, y: y)
|
||||||
} else {
|
} else {
|
||||||
var rx = abs(_rx)
|
var rx = abs(_rx)
|
||||||
@ -376,7 +376,7 @@ class RenderUtils {
|
|||||||
let y1_ = -1 * sin(angle) * (x1 - x) / 2 + cos(angle) * (y1 - y) / 2
|
let y1_ = -1 * sin(angle) * (x1 - x) / 2 + cos(angle) * (y1 - y) / 2
|
||||||
|
|
||||||
let rCheck = (x1_ * x1_) / (rx * rx) + (y1_ * y1_) / (ry * ry)
|
let rCheck = (x1_ * x1_) / (rx * rx) + (y1_ * y1_) / (ry * ry)
|
||||||
if (rCheck > 1) {
|
if rCheck > 1 {
|
||||||
rx = sqrt(rCheck) * rx
|
rx = sqrt(rCheck) * rx
|
||||||
ry = sqrt(rCheck) * ry
|
ry = sqrt(rCheck) * ry
|
||||||
}
|
}
|
||||||
@ -395,14 +395,14 @@ class RenderUtils {
|
|||||||
let t1 = calcAngle(ux: 1, uy: 0, vx: (x1_ - cx_) / rx, vy: (y1_ - cy_) / ry)
|
let t1 = calcAngle(ux: 1, uy: 0, vx: (x1_ - cx_) / rx, vy: (y1_ - cy_) / ry)
|
||||||
var delta = calcAngle(ux: (x1_ - cx_) / rx, uy: (y1_ - cy_) / ry, vx: (-x1_ - cx_) / rx, vy: (-y1_ - cy_) / ry)
|
var delta = calcAngle(ux: (x1_ - cx_) / rx, uy: (y1_ - cy_) / ry, vx: (-x1_ - cx_) / rx, vy: (-y1_ - cy_) / ry)
|
||||||
let pi2 = Double.pi * 2
|
let pi2 = Double.pi * 2
|
||||||
if (delta > 0) {
|
if delta > 0 {
|
||||||
delta = delta.truncatingRemainder(dividingBy: pi2)
|
delta = delta.truncatingRemainder(dividingBy: pi2)
|
||||||
if (!sweep) {
|
if !sweep {
|
||||||
delta -= pi2
|
delta -= pi2
|
||||||
}
|
}
|
||||||
} else if (delta < 0) {
|
} else if delta < 0 {
|
||||||
delta = -1 * ((-1 * delta).truncatingRemainder(dividingBy: pi2))
|
delta = -1 * ((-1 * delta).truncatingRemainder(dividingBy: pi2))
|
||||||
if (sweep) {
|
if sweep {
|
||||||
delta += pi2
|
delta += pi2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -417,7 +417,7 @@ class RenderUtils {
|
|||||||
let end = extent + CGFloat(arcAngle)
|
let end = extent + CGFloat(arcAngle)
|
||||||
let cx = CGFloat(x + w / 2)
|
let cx = CGFloat(x + w / 2)
|
||||||
let cy = CGFloat(y + h / 2)
|
let cy = CGFloat(y + h / 2)
|
||||||
if (w == h && rotation == 0) {
|
if w == h && rotation == 0 {
|
||||||
bezierPath.addArc(withCenter: CGPoint(x: cx, y: cy), radius: CGFloat(w / 2), startAngle: extent, endAngle: end, clockwise: arcAngle >= 0)
|
bezierPath.addArc(withCenter: CGPoint(x: cx, y: cy), radius: CGFloat(w / 2), startAngle: extent, endAngle: end, clockwise: arcAngle >= 0)
|
||||||
} else {
|
} else {
|
||||||
let maxSize = CGFloat(max(w, h))
|
let maxSize = CGFloat(max(w, h))
|
||||||
|
@ -36,7 +36,7 @@ class ShapeRenderer: NodeRenderer {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shape.fill != nil || shape.stroke != nil) {
|
if shape.fill != nil || shape.stroke != nil {
|
||||||
setGeometry(shape.form, ctx: ctx.cgContext!)
|
setGeometry(shape.form, ctx: ctx.cgContext!)
|
||||||
drawPath(shape.fill, stroke: shape.stroke, ctx: ctx.cgContext!, opacity: opacity)
|
drawPath(shape.fill, stroke: shape.stroke, ctx: ctx.cgContext!, opacity: opacity)
|
||||||
}
|
}
|
||||||
|
@ -1328,7 +1328,7 @@ private class PathDataReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func read() -> [PathSegment] {
|
public func read() -> [PathSegment] {
|
||||||
let _ = readNext()
|
_ = readNext()
|
||||||
var segments = [PathSegment]()
|
var segments = [PathSegment]()
|
||||||
while let array = readSegments() {
|
while let array = readSegments() {
|
||||||
segments.append(contentsOf: array)
|
segments.append(contentsOf: array)
|
||||||
@ -1420,7 +1420,7 @@ private class PathDataReader {
|
|||||||
private func readSegmentType() -> PathSegmentType? {
|
private func readSegmentType() -> PathSegmentType? {
|
||||||
while(true) {
|
while(true) {
|
||||||
if let type = getPathSegmentType() {
|
if let type = getPathSegmentType() {
|
||||||
let _ = readNext()
|
_ = readNext()
|
||||||
return type
|
return type
|
||||||
}
|
}
|
||||||
if (readNext() == nil) {
|
if (readNext() == nil) {
|
||||||
|
Loading…
Reference in New Issue
Block a user