     
     required public init?(coder: NSCoder) {
         fatalError("init(coder:) has not been implemented")
+    }
+    
+    public override func mouseMoved(with event: NSEvent) {
+        
+        q = Point(self.convert(event.locationInWindow, from: nil))
+        
+        super.mouseMoved(with: event)
     }
     
     func handleGesture(_ sender: NSPanGestureRecognizer) {

            drawPoint(context, p2)
            drawPoint(context, p3)
            
            drawPoint(context, q)
            
            if let (t1, t2) = CubicBezierSelfIntersect(p0, p1, p2, p3) {
                
                context.setStrokeColor(NSColor.red.cgColor)

        switch sender.state {
        case .began:
            let location = sender.location(in: self)
            target = [p0, p1, p2, p3].map { (Point(location) - $0).magnitude }.enumerated().min { $0.1 }?.0 ?? -1
        case .changed:
            switch target {
            case 0: p0 = Point(sender.location(in: self))
            case 1: p1 = Point(sender.location(in: self))
            case 2: p2 = Point(sender.location(in: self))
            case 3: p3 = Point(sender.location(in: self))
            default: break
            }
        default: break
