Skip to content
This repository was archived by the owner on Feb 26, 2021. It is now read-only.
This repository was archived by the owner on Feb 26, 2021. It is now read-only.

One mistake #16

Description

@YaHoYii

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions