CanvasView

@objc(PESDKCanvasView) open class CanvasView: GLKView

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

    open 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

    fileprivate(set) open var currentlyPainting = false
  • Returns a newly initialized canvas view for the given painting, with the given tool and the given frame.

    Declaration

    Swift

    public init(painting: Painting, activeTool: Tool, frame: CGRect)

    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.

    frame

    The frame of the view.

    Return Value

    A newly initialized CanvasView object.

  • 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.