From 80d297c10a403d6fb065d68b7236ca8c59a1abfa Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 1 Mar 2019 11:35:16 -0500 Subject: [PATCH] Render strokes behind text. --- .../Views/ImageEditor/ImageEditorCanvasView.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SignalMessaging/Views/ImageEditor/ImageEditorCanvasView.swift b/SignalMessaging/Views/ImageEditor/ImageEditorCanvasView.swift index 79a1ae986..7df5344eb 100644 --- a/SignalMessaging/Views/ImageEditor/ImageEditorCanvasView.swift +++ b/SignalMessaging/Views/ImageEditor/ImageEditorCanvasView.swift @@ -53,7 +53,7 @@ public class ImageEditorCanvasView: UIView { public let contentView = OWSLayerView() // clipView is used to clip the content. It reflects the actual - // visible bounds of the content. + // visible bounds of the "canvas" content. private let clipView = OWSLayerView() private var contentViewConstraints = [NSLayoutConstraint]() @@ -461,6 +461,8 @@ public class ImageEditorCanvasView: UIView { shapeLayer.fillColor = nil shapeLayer.lineCap = kCALineCapRound shapeLayer.lineJoin = kCALineJoinRound + // We want strokes to be rendered above the image and behind text. + shapeLayer.zPosition = 1 return shapeLayer } @@ -520,6 +522,9 @@ public class ImageEditorCanvasView: UIView { let transform = CGAffineTransform.identity.scaledBy(x: item.scaling, y: item.scaling).rotated(by: item.rotationRadians) layer.setAffineTransform(transform) + // We want text to be rendered above the image and strokes. + layer.zPosition = 2 + return layer }