     }
     
     override open func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
-        if !isWritingMode { isWritingMode = true }
+        if !isWritingMode {
+            hideMenu()
+            isWritingMode = true
+        }
         register(touch: touches.first!)
     }
     

    }
    
    open func replace(with character: Character) {
        guard selectedNodeLayer != nil else { return }
        
        if let rect = manager.replaceSelectedNode(with: character) {
            setNeedsDisplay(rect)
        }
        
        selectedNodeLayer!.removeFromSuperlayer()
        candidatesView!.removeFromSuperview()
    }
    
    // MARK: - MyScriptParser delegate

            ctx.fill(CGRect(origin: CGPoint.zero, size: node.frame.size))
            ctx.translateBy(x: -node.frame.origin.x, y: -node.frame.origin.y)

            ctx.setLineWidth(lineWidth)
            ctx.setLineCap(.round)
            
            for ink in node.ink {
                if let strokeInk = ink as? StrokeInk {
                    ctx.addPath(strokeInk.path.cgPath)
                } else {
                    let charInk = ink as! CharacterInk
                    guard let image = getImage(for: charInk, strokeColor: selectionStrokeColor)?.cgImage else { return }
                    ctx.draw(image, in: charInk.frame)
                }
            }
            
            ctx.strokePath()
            
            ctx.restoreGState()
            image = UIGraphicsGetImageFromCurrentImageContext()?.cgImage
