         }
     }
 
-    open override func didMoveToWindow() {
-        super.didMoveToWindow()
+    open override func didMoveToSuperview() {
+        super.didMoveToSuperview()
 
         initializeView()
     }

        get { return drawingView.intrinsicContentSize }
    }

    #if os(OSX)
    open override var layer: CALayer? {
        didSet {

        self.addGestureRecognizer(pinchRecognizer)
    }

    open override func mTouchesBegan(_ touches: Set<MTouch>, with event: MEvent?) {
        super.mTouchesBegan(touches, with: event)
        zoom.touchesBegan(touches)

        drawingView.touchesBegan(touchPoints: convert(touches: touches))
    }

    open override func mTouchesMoved(_ touches: Set<MTouch>, with event: MEvent?) {
        super.mTouchesMoved(touches, with: event)
        zoom.touchesMoved(touches)

        drawingView.touchesMoved(touchPoints: convert(touches: touches))
    }

    open override func mTouchesEnded(_ touches: Set<MTouch>, with event: MEvent?) {
        super.mTouchesEnded(touches, with: event)
        zoom.touchesEnded(touches)

        drawingView.touchesEnded(touchPoints: convert(touches: touches))
    }

    override open func mTouchesCancelled(_ touches: Set<MTouch>, with event: MEvent?) {
        super.mTouchesCancelled(touches, with: event)
        zoom.touchesEnded(touches)

        drawingView.touchesEnded(touchPoints: convert(touches: touches))
