Interactive Ink

Autoscroll does not work in EditorViewController on iOS

Hi! How to make this controller scrollable when user is writing text?


Dear Nurdaulet Bolatov,


thank you for your question.


Currently, you can change the viewOffset property of the renderer which will allows to "slide" the content of the canvas. You should get the size of the block, so that you know until where you can slide.


You can change the viewOffset as you prefer, e.g. after a timeout, when reaching a given point...


Best regards,


Olivier

Thanks for your answer!

How to detect if the user reached given point?

Dear Nurdalet,


currently, it depends on how you add the strokes to the iink:

-If using an external device, you know the x and y coordinates of the ink, and therefore can determine  when you reach the point.

-If writing on the screen of your device using the iink canvas, this is little more difficult, as the only way to get the x and y coordinates is using the export in jiix (for this case, you do not need to wait for recognition to end) ; you should then parse the JIIX string, and you should then be able to determine if you reach the expected point.


Best regards,


Olivier

Hi Olivier,

Can you please provide an example for the first case?

Is it possible to detect the position of separators in EditorViewController?

Dear Nurdaulet,


to answer your question

-If using an external device, you know the x and y coordinates of the ink, and therefore can determine when you reach the point.

>>-Basically, each time a pen up is done, you can export to JIIX.

-In the JIIX, you have the coordinates of each character, you can then determine the last "coordinates"

-When reaching it, you can then slide.


Nevertheless, one point to note is that JIIX is in millimeters, while the UI in pixels. You should then use the transform to get the "last point".

Basically, here is the way you could proceed:

-if(pen up)

-export JIIX

-From the JIIX, get the coordinates in milimeters of the last character

-Get Transform: Transform transform = editor.getRenderer().getViewTransform();

-Apply transform to coordinates: Point transformedPoint = transform.apply(xcoordMm, ycoordMm);

-Get x and y coordinates of point:float transformedPointX = transformedPoint.x;float transformedPointY = transformedPoint.y;

-If(transformedPointX>xreachedPoint)=> slide


Let me know if this is of help.


Is it possible to detect the position of separators in EditorViewController?

>What do you mean by separators? I am not sure to understand what it is.


Best regards,


Olivier

Login or Signup to post a comment