1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-09-17 16:07:44 +03:00

Node with gradient fill touch events fix

This commit is contained in:
Viktor Sukochev 2017-04-14 18:09:23 +07:00
parent ad312e0e51
commit df20a3be85

View File

@ -27,20 +27,26 @@ class ShapeRenderer: NodeRenderer {
}
override func doFindNodeAt(location: CGPoint, ctx: CGContext) -> Node? {
setGeometry(shape.form, ctx: ctx)
var drawingMode: CGPathDrawingMode? = nil
if let stroke = shape.stroke, let fill = shape.fill {
setGeometry(shape.form, ctx: ctx)
var drawingMode: CGPathDrawingMode? = nil
if let stroke = shape.stroke, let fill = shape.fill {
setStrokeAttributes(stroke, ctx: ctx)
setFill(fill, ctx: ctx, opacity: 1.0)
drawingMode = .fillStroke
} else if let stroke = shape.stroke {
if let _ = fill as? Gradient {
setFill(Color.black, ctx: ctx, opacity: 1.0)
drawingMode = .fill
} else {
setFill(fill, ctx: ctx, opacity: 1.0)
drawingMode = .fillStroke
}
} else if let stroke = shape.stroke {
setStrokeAttributes(stroke, ctx: ctx)
drawingMode = .stroke
} else if let fill = shape.fill {
drawingMode = .stroke
} else if let fill = shape.fill {
setFill(fill, ctx: ctx, opacity: 1.0)
drawingMode = .fill
}
drawingMode = .fill
}
var contains = false
if let mode = drawingMode {
@ -50,11 +56,11 @@ class ShapeRenderer: NodeRenderer {
return node()
}
}
// Prepare for next figure hittesting - clear current context path
ctx.beginPath()
return .none
}
// Prepare for next figure hittesting - clear current context path
ctx.beginPath()
return .none
}
fileprivate func setGeometry(_ locus: Locus, ctx: CGContext) {
if let rect = locus as? Rect {