iink SDK on Device

Answered

Adding block at the bottom of the Text Document

Hi,

I would like to add a new block at the bottom [Text Document Part]. 

I have tried:

  1. Getting all children to block from root block
  2. Calculating the maximum y by calling getBox method for every children block, adding y and height
  3. Adding a block with X and Y based on the above calculation.

What I realized is getBox is returning position in editor space while addBlock requires input from screen space.
How can I add a new block at the bottom of the Text Document?


Best Answer

 shikang_neoh

Dear Shikang,

Thank you for contacting us and your question.

Currently, it is not possible to add a block at the top of a "Text Document" "a posteriori".

Indeed, blocks can only be added at the bottom of a "Text Document" or beside another block IF there is enough space left.

Indeed, adding a block at the top would imply moving all the previous blocks of the document, and would likely result in unexpected behaviors.

You can also refer to the following topics, that give explanations how to properly use the "addBlock":
-https://developer-support.myscript.com/support/discussions/topics/16000028588
-https://developer-support.myscript.com/support/discussions/topics/16000027123
-https://developer-support.myscript.com/support/discussions/topics/16000030020
-https://developer-support.myscript.com/support/discussions/topics/16000024723

Best regards,

Olivier


Answer

 shikang_neoh

Dear Shikang,

Thank you for contacting us and your question.

Currently, it is not possible to add a block at the top of a "Text Document" "a posteriori".

Indeed, blocks can only be added at the bottom of a "Text Document" or beside another block IF there is enough space left.

Indeed, adding a block at the top would imply moving all the previous blocks of the document, and would likely result in unexpected behaviors.

You can also refer to the following topics, that give explanations how to properly use the "addBlock":
-https://developer-support.myscript.com/support/discussions/topics/16000028588
-https://developer-support.myscript.com/support/discussions/topics/16000027123
-https://developer-support.myscript.com/support/discussions/topics/16000030020
-https://developer-support.myscript.com/support/discussions/topics/16000024723

Best regards,

Olivier

Or is there any way I can convert from editor space to screen space?