CanvasView
@available(iOS 9.0, *)
@objcMembers
@objc(PESDKCanvasView)
open class CanvasView : GLKView
extension CanvasView: Identifiable
The CanvasView
is responsible for presenting a painting and handling touch events related to paintings.
-
The painting that is managed by this canvas view.
Declaration
Swift
public let painting: Painting
-
The tool that is currently active. Currently only an instance of
FreehandTool
is supported.Declaration
Swift
open var activeTool: Tool
-
The object that acts as the data source for the canvas view.
Declaration
Swift
open weak var dataSource: CanvasViewDataSource?
-
The object that acts as the delegate for the canvas view.
Declaration
Swift
open weak var canvasDelegate: CanvasViewDelegate?
-
true
if a user is currently painting,false
otherwise.Declaration
Swift
open private(set) var currentlyPainting: Bool { get }
-
Creates a canvas view for the given painting, with the given tool and the given frame.
Declaration
Parameters
painting
The painting that is managed by this canvas view.
activeTool
The tool that should be used for the painting. Currently only an instance of
FreehandTool
is supported.uuid
The UUID that matches this instance with its
BrushSpriteModel
.frame
The frame of the view.
-
Called by a pan gesture recognizer to handle touches.
Declaration
Swift
open func handlePan(_ gestureRecognizer: UIGestureRecognizer)
Parameters
gestureRecognizer
The recognizer that called this method.
-
Converts a given point from view coordinates to painting coordinates.
Declaration
Swift
open func convertPointToDocument(_ pt: CGPoint) -> CGPoint
Parameters
pt
The point that should be converted.
Return Value
The converted point.