Interactive Ink

switching input text to script on myscript.

Hello myscript,

I used 

this.myscriptPad.mathCalculator.editorElement.editor.pointerEvents(stroke, false) to import strokes from a canvas but then I tried to manually convert them using 

this.myscriptPad.mathCalculator.editorElement.editor.convert() to actual script but that doesn't seem to work. What could I possibly be  missing? I tried to wait for idle too like so :

 

this.myscriptPad.mathCalculator.editorElement.editor.waitForIdle();

this.myscriptPad..mathCalculator.editorElement.editor.convert();

physically tapping on the screen does convert it.

Thanks,

Daniel 


Dear Daniel,


Thank you for the update, we are glad you solved your issue! 


Best regards, 


Maël

Hello again,

I figured it out, I need to shoot  custom pointer events because all my listeners are based on pointers and not mouse.

Daniel

hello Mael,

I forgot to add that I call pointerEvents once for each stroke that the user makes, so I call that function multiple times. 

Thanks,

Daniel

Hello mael,

You misunderstood my question. The adding strokes to myscript works. Its changing them to actual text that doesnt. Here is my code in more detail:

I have a timeline when a stroke is inputed on to myscript and on that timeline I also have an event when I want to change it actual text using convert. 

So this function works:

addInk(strokes){

  const processGestures = true;

  this.myscriptPad.mathCalculator.editorElement.editor.pointerEvents(strokes, processGestures);

}

it successfully adds the user input to myscript.

but then my other function to convert that user input doesnt work:

convertInk(){

  this.myscriptPad.mathCalculator.editorElemenet.editor.convert();

}

I used waitingforIdle function too but that didnt help either. Changing  var ProcessGestures  to any value  doesn't help either.  But I'm more confused why convert() didnt work.

Here is one of my inputted strokes:

 

{"events":[{"pointerType":"PEN","pointerId":"1","x":[876,883,893,907,923,936,954,967,977,988],"y":[55,59,67,79,94,108,131,151,167,184],"t":[1533764142183,1533764142188,1533764142200,1533764142217,1533764142232,1533764142251,1533764142266,1533764142282,1533764142300,1533764142316],"p":[1,1,1,1,1,1,1,1,1,1]}]}}

Thanks again for you help,

Daniel

Dear Daniel,


Your use case is related to "Raw Content", see : https://developer.myscript.com/docs/interactive-ink/1.2/web/myscriptjs/import-and-export/#raw-ink-import


When you call the "editor.pointerEvents" method the stroke is immediately processed.

What you can do is to store your imported stroke into a variable and then call the "editor.pointerEvents(stroke)" method manually.


Let me know if this is usefull.


Regards,


Maël

using javascript for this.

Login or Signup to post a comment