Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // RectangleDrawableView.swift
- // OpenCVTest
- //
- // Created by Aratech iOS on 1/8/17.
- // Copyright © 2017 Nicolas Landa. All rights reserved.
- //
- import UIKit
- class RectangleDrawableView: DrawableView {
- override func update(path: inout UIBezierPath, with point: CGPoint) {
- let origin = self.startingPoint
- let height = point.y - origin.y
- let width = point.x - origin.x
- path = UIBezierPath(rect: CGRect(origin: origin, size: CGSize(width: width, height: height)))
- }
- override func view(from pathComponents: [CGPoint]) -> UIView {
- var newPath = UIBezierPath()
- self.update(path: &newPath, with: pathComponents.last!)
- newPath.close()
- let pathView = UIView(frame: CGRect(origin: newPath.bounds.origin, size: newPath.bounds.size))
- pathView.backgroundColor = .clear
- pathView.layer.borderWidth = self.pathLayer.lineWidth
- pathView.layer.borderColor = self.pathLayer.strokeColor
- return pathView
- }
- }
Add Comment
Please, Sign In to add comment