You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've updated the touchesBegan function in my forked repo to experiment adding a 'continue path' functionality, where the line you draw will automatically continue from the last one you did (if it exists)
Is something like this worth adding into the library?
The updated touchesBegan() looks like
/// Determines whether the path should continue from the last touch point.publicvarshouldContinuePath= false
overrideopenfunc touchesBegan(_ touches:Set<UITouch>, with event:UIEvent?){
guard isEnabled,let touch = touches.first else{return}
if #available(iOS 9.1,*){
guard allowedTouchTypes.flatMap({ $0.uiTouchTypes }).contains(touch.type)else{return}}
guard delegate?.swiftyDraw(shouldBeginDrawingIn:self, using: touch)?? true else{return}
delegate?.swiftyDraw(didBeginDrawingIn:self, using: touch)
firstPoint = shouldContinuePath && previousPoint !=.zero ? previousPoint : touch.location(in:self)setTouchPoints(touch, view:self)letnewLine=DrawItem(path:CGMutablePath(),
brush:Brush(color: brush.color.uiColor, width: brush.width, opacity: brush.opacity, blendMode: brush.blendMode), isFillPath: false)
if shouldContinuePath && currentPoint !=.zero {// draw a straight line between the end of the last touch point// and this new touch point
newLine.path.addPath(createNewStraightPath())}addLine(newLine)}
The text was updated successfully, but these errors were encountered:
I've updated the
touchesBegan
function in my forked repo to experiment adding a 'continue path' functionality, where the line you draw will automatically continue from the last one you did (if it exists)Is something like this worth adding into the library?
The updated
touchesBegan()
looks likeThe text was updated successfully, but these errors were encountered: