Text

Undo Redo & Erase options for MultiLineTextWidget

Hi,

I have recently downloaded MyScript_ATK-ios-1.3.0 where I need MultiLineTextWidget sample, which is not present in MyScript_ATK-ios-2 and MyScript_ATK-ios-2.2 version iOS ATK. But please do tell us if undo, redo and erase options(which are like in Nebo app) are available in MultiLineTextWidget. Also, I want to restrict the user to write with finger but use only Apple Pencil. No delegate methods are called as soon as I touch the "MLTWMultiLineView" so that I can compare using UITouchType(direct, indirect, stylus) Enum. Please provide us the solution.

Thankyou.


Dear Sunanda,

thank you for contacting us.

Currently, undo/redo are not present in the API of the multi line text widget.
Erase is available as a gesture (see the below list of gestures):
typedef NS_ENUM(NSUInteger, MLTWGestureType ) {
  MLTWGestureTypeInsert,
  MLTWGestureTypeJoin,
  MLTWGestureTypeErase,
  MLTWGestureTypeOverwrite,
  MLTWGestureTypeSingleTap,
  MLTWGestureTypeSelection,
  MLTWGestureTypeUnderline,
  MLTWGestureTypeReturn,
};

Regarding using only events from pen, please find a demo sample (basically just detect if touch event is of type UITouchTypeStylus):

- (void) touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event

{

 self.forward = ([[touches anyObject] type] == UITouchTypeStylus);

 

    if (self.forward)

    {

 IMCaptureInfo* ci = [IMCaptureInfo captureInfoWithX:[[touches anyObject] locationInView:self].x andY:[[touches anyObject] locationInView:self].y pressure:1.0f width:1.0f timeInterval:[[touches anyObject] timestamp]];

        [super penDown:ci];

    }

}

  

- (void) touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event

{

    if (self.forward)

    {

 IMCaptureInfo* ci = [IMCaptureInfo captureInfoWithX:[[touches anyObject] locationInView:self].x andY:[[touches anyObject] locationInView:self].y pressure:1.0f width:1.0f timeInterval:[[touches anyObject] timestamp]];

        [super penUp:ci];

    }

}

  

- (void) touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event

{

    if (self.forward)

    {

 IMCaptureInfo* ci = [IMCaptureInfo captureInfoWithX:[[touches anyObject] locationInView:self].x andY:[[touches anyObject] locationInView:self].y pressure:1.0f width:1.0f timeInterval:[[touches anyObject] timestamp]];

        [super penMove:ci];

    }

}

  

- (void) touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event

{

    if (self.forward)

    {

        [super penAbort];

    }

}



Best regards,

Olivier

Hi Olivier,

   Thankyou so much for reply. But as far as our research on MLTWMultiLineView class there is no InkManagement and their methods. We are planning to buy the SDK so, is the access for methods gonna change if we buy the product?(I mean InkManagement for MLTWMultiLineView). But still for SLTWSingleLineWidget I have even subclassed and tested if touch delegates are called, but touch delegates are not getting called, attaching the code that I am working.  

class ViewController: UIViewController, SLTWSingleLineWidgetDelegate {
    @IBOutlet weak var widget: SingleLineTextView!
    override func viewDidLoad() {
        super.viewDidLoad()
        let certificate_ = NSData(bytes:myCertificate.bytes, length:myCertificate.length) as Data
        let isSuccess = widget.registerCertificate(certificate_)
        if isSuccess {
            widget.configure(withBundle: "en_US", andConfig: "si_text")
            widget.addSearchDir(Bundle.main.path(forResource: "resources", ofType: "bundle", inDirectory: "conf"))
            widget.delegate = self
        }
    }
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {print("touch") }
}

class SingleLineTextView: SLTWSingleLineWidget {
    override func awakeFromNib() {
        super.awakeFromNib()
    }
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        guard let touch_ = touches.first else { return }
        if #available(iOS 9.1, *) {
            let forward = touch_.type == .stylus
            if (forward) {
                let ci = IMCaptureInfo(x: touch_.location(in: self).x, andY: touch_.location(in: self).x, pressure: 1.0, width: 1.0, timeInterval: touch_.timestamp)
                super.penDown(ci)
            }
        }
    }
}

    Neither in ViewController nor in SubClassed view, the touch delegates are called. But working for views other than widget. Can we know as how Nebo is integrating multiline with undo and redo, I mean is it because of customization on their end or from the SDK.

Thankyou. 

Dear Sunanda,

indeed you are right, this is not possible for the SLTW, only for Single Char and Single Line on ATK 2.2.

Regarding buying the ATK, this doesn't provide with any change in the API, by default you have access to the whole opened API.

Neither in ViewController nor in SubClassed view, the touch delegates are calle
>>Can you please try to create a view on top of the ATK, and try to get the touchEvents?

Can we know as how Nebo is integrating multiline with undo and redo, I mean is it because of customization on their end or from the SDK.

>>Regarding Nebo, a huge internal development has been done, which is not yet available in our offer. Developing a "similar Nebo" is not possible with our ATK offer.

Best regards,

Olivier

Thankyou Olivier.