daihase / Sketch

Sketch have a lot of basic functions to develop a drawing app for iPhone. Anyone can easily create drawing iOS Application.
MIT License
339 stars 58 forks source link

Stamp Resize after added #14

Closed longnh2604 closed 6 years ago

longnh2604 commented 6 years ago

I need to resize the stamp on the screen so I have add gestures(pinch,pan) and a button to confirm when it completed to remove the gestures and get the location of its.

@objc func onAddStampConfirm(sender: UIButton!) {

        //remove gesture
        for subview in sketchView.subviews {
            for recognizer in subview.gestureRecognizers ?? [] {
                subview.removeGestureRecognizer(recognizer)
            }
        }

        sketchView.drawTool = .stamp
        self.sketchView.stampImage = imvStamp.image
        let cgPoint = CGPoint.init(x: imvStamp.frame.origin.x, y: imvStamp.frame.origin.y)
        self.sketchView.addStampComplete(position: cgPoint)
 }

And in sketchView class, I've added this to regconize when add stamp complete

public func addStampComplete(position:CGPoint) {
        currentTool = toolWithCurrentSettings()
        guard let stampTool = currentTool as? StampTool else { return }
        pathArray.add(stampTool)
        stampTool.setStampImage(image: stampImage)
        stampTool.setInitialPoint(position)
        finishDrawing()
    }

in touchbegan (case is StampTool) I let it blank. Thanks

Originally posted by @longnh2604 in https://github.com/daihase/Sketch/issues/2#issuecomment-432520974

daihase commented 6 years ago

@longnh2604 I confirmed the contents. Basically, if you extend library yourself, it's difficult for others to understand the scope of its impact, so I want you to solve it yourself. (I couldn't figure out the whole thing after all even if I saw it here.)

If you fork the library and build an issue on its own repository I think that the problem will be solved.

longnh2604 commented 6 years ago

Thanks for your reply. At this moment, I've put one UIImageView in front of your SketchView and attach gestures to it to resize or delete. I will do think again of resizing that when I have time. I will close now. Thanks so much. Your lib is pretty good.