UberSignature icon indicating copy to clipboard operation
UberSignature copied to clipboard

One mistake

Open YaHoYii opened this issue 7 years ago • 1 comments

I found a mistake in the UIBezierPath+WeightedPoint.swift file,https://github.com/uber/UberSignature/blob/master/Sources/Swift/Internal/UIBezierPath%2BWeightedPoint.swift Original code

 class func line(withWeightedPointA pointA: WeightedPoint, pointB: WeightedPoint) -> UIBezierPath {
        let lines = linesPerpendicularToLine(from: pointA, to: pointB)
        
        let path = UIBezierPath()
        path.move(to: lines.0.startPoint)
        path.addLine(to: lines.1.startPoint)
        path.addLine(to: lines.1.endPoint)
        **path.addLine(to: lines.0. startPoint)**
        path.close()
        
        return path
    }

Sometimes it causes the drawn lines to be jagged. I read the code of Objects-C,It should be changed to solve this problem.

    class func line(withWeightedPointA pointA: WeightedPoint, pointB: WeightedPoint) -> UIBezierPath {
        let lines = linesPerpendicularToLine(from: pointA, to: pointB)
        
        let path = UIBezierPath()
        path.move(to: lines.0.startPoint)
        path.addLine(to: lines.1.startPoint)
        path.addLine(to: lines.1.endPoint)
        **path.addLine(to: lines.0.endPoint)**
        path.close()
        
        return path
    }

You can confirm this question.

YaHoYii avatar Oct 30 '18 07:10 YaHoYii

This is a duplicate of Issue #7

rpstro02 avatar Jun 26 '19 17:06 rpstro02