Math

I want to restore a model saved in the past using pointerEvents

Hello myscript,

I'd like to load handwriting written in the past

I thought it would be possible using pointerEvents, but there were various problems

My source code is below

   

//pastModel is a loaded model
//this.editor is a current editor object

for (let e in this.editor.model) {
        this.editor.model[e] = pastModel[e];
      }

 const pointerEventsObject = {
        events: pastModel.rawStrokes.slice().map(e => {
          const e2 = Object.assign({}, e);
          delete e2.l;
          delete e2.type;
          delete e2.width;
          delete e2.color;
          delete e2['-myscript-pen-width'];
          delete e2['-myscript-pen-fill-style'];
          delete e2['-myscript-pen-fill-color'];
          return e2;
        })
      };

this.editor.pointerEvents(pointerEventsObject);

 After loading the past model, we rewrite the current model and reproduce the handwriting with pointerEvents

Although it was possible to reproduce the handwriting with this code certainly, the event where the conversion event or the stroke was deleted is not taken into consideration

Is it possible to reproduce the past handwriting considering these events?

Thanks.



Dear Yuki Shimada San,


thank you for contacting us and your question.


Currently, to replay the ink, you are using the pointerEvents API, which is the way to proceed.


To be able to re-play the gestures/erasures, you should set the "processGestures" variable of the pointerEvents to true: http://cocoadocs.org/docsets/MyScriptInteractiveInk-Runtime/1.0.0/Classes/IINKEditor.html#//api/name/pointerEvents:count:doProcessGestures:error:


Nevertheless, as indicated in the "note", we do not recommend setting the processGestures to true, as this can lead to unexpected recognition results: Note: this method can be used to perform batch  recognition by representing the sequence of digital ink strokes as a  series of pointer events and sending them with the gesture processing  disabled.


Best regards,


Olivier

Dear Olivier,

Thank you for answering.

I referred to the URL you taught but I can not understand it.

Specifically, how can I fix my old code?

Should I set the third argument on line 22 to true?

Best regards,


Yuki

Dear Yuki,


As Olivier said, you should not set the "processGestures" parameter to true in a batch mode case.

However, you must provide the "processGesture" parameter to the "pointerEvents" method.


You can try :

this.editor.pointerEvents(pointerEventsObject, false);


Let me know if this is usefull.


Regards,


Maël

Login or Signup to post a comment
  • Support
  • Forums
  • Math
  • I want to restore a model saved in the past using pointerEvents