uber / UberSignature

Provides an iOS view controller allowing a user to draw their signature with their finger in a realistic style.
MIT License
1.29k stars 174 forks source link

One mistake #16

Open YaHoYii opened 6 years ago

YaHoYii commented 6 years ago

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.

rpstro02 commented 5 years ago

This is a duplicate of Issue #7