iink SDK on Device

Answered

How to control the display position of handwriting on different devices?

Hi MyScript:

First, the demo has been set up:


Then,  File.iink file saved on one phone contains the math and diagram handwriting displayed in the center of the screen, and is copied to another phone with a different screen size, but the math and diagram handwriting positions are displayed inconsistently. That is, the display position of the same handwriting file changes on mobile phones with different screen sizes. How to control the display position of handwriting on different devices?


Thank you for your time,

longjunhao



Best Answer

Dear longjunhao,


thank you for the update.


Currently, we have no API to do this easily ; this can be done manually doing a "zoomout" until the diagram fits to the screen.


Or, programatically, I just came up with the following idea:

-On device 1, you could export as JIIX. You would then have the coordinates (in milimeters) of the bounding-box

-On device 2:

  1. you get the screen size using the API: https://stackoverflow.com/questions/11252067/how-do-i-get-the-screensize-programmatically-in-android
  2. your application load the iink file, and the coordinates of the bounding-box of your diagram
  3. =>You should then be able to determine the zoom factor to apply to fit your Diagram on device 2.


Let me know if this helps.


Best regards,


Olivier


Answer

Dear longjunhao,


thank you for the update.


Currently, we have no API to do this easily ; this can be done manually doing a "zoomout" until the diagram fits to the screen.


Or, programatically, I just came up with the following idea:

-On device 1, you could export as JIIX. You would then have the coordinates (in milimeters) of the bounding-box

-On device 2:

  1. you get the screen size using the API: https://stackoverflow.com/questions/11252067/how-do-i-get-the-screensize-programmatically-in-android
  2. your application load the iink file, and the coordinates of the bounding-box of your diagram
  3. =>You should then be able to determine the zoom factor to apply to fit your Diagram on device 2.


Let me know if this helps.


Best regards,


Olivier

Sorry, the picture on the question is not shown, the picture is as follows:

image

Dear Long Junhao,


thank you for your question.


Indeed, when copying one .iink file from one device to the other, the iink SDK will re-factor the rendering according to the resolution of the device, screen size...


Nevertheless, could you provide with a screenshot of both devices, so that we better understand what is happening?


Thank you,


Best regards,


Olivier

Thank you for your answer, I am very sorry to reply to you now.


Demos are installed on both devices, only replacing MyCertificate.java, and no other code has been modified. Demo address: https://github.com/MyScript/interactive-ink-examples-android


On the first device, two interfaces, diagram and math, are written. The screenshot is as follows:

image


image


Then copy the data/data/com.myscript.iink.demo of this device to another device. Open the .iink file on another device, the screenshot is as follows:

image

image

The first device is a large screen, and the other device has a smaller screen. As shown in the screenshot, when the .iink file on the large screen is displayed on the small screen, the diagram display is incomplete. math performance is different from diagram.


Thank you,

 

 

 

Best regards,

 

 

 

longjunhao




Dear Olivier,

 

by the way.

This question is asked because: MyScript's .iink in the new requirements has a cloud backup function, which will synchronize the .iink to different devices, so there will be the above problems.

 

Thank you,

 

Best regards,

 

longjunhao

Dear Longjunhao,


thank you for the screenshot and precision.


Currently, the difference you notice in between Math and Diagram parts is the expected behavior.


In Math, we resize so that the content is fully displayed on the screen, while we do not resize in Diagram.


In Diagram, you can try to play with the zoom to display the whole content.


Best regards,


Olivier

Dear Olivier,

 

Can I adjust resize in Diagram to make the content fully displayed on the screen? Or in Math, resize is not called. This can make Math and Diagram phenomena consistent.

Because in my project, the "Diagram" of two devices may be included at the same time. If I set "zoom", I also need to distinguish which device "Diagram" comes from.

 

Thank you,

 

Best regards,

 

longjunhao