Now you are aware of the most important APIs of iinkTS let’s dive into OffScreen Interactivity specificities.
You can see below an example fully based on iinkTS
: It uses iinkTS ink capture, rendering and model.
To use this integration option, all you need is to call iinkTS Editor
load method with the INTERACTIVEINK
mode (See also Editing).
This instantiates an InteractiveInkEditor
object that defines and instantiates all the objects used by the offscreen interactivity.
We provide a set of ready-to-use menus:
All you have to do is configure whether you want to show or hide these menus:
While the InteractiveInkEditor
object comes with a default configuration you can easily customize it, by providing your own options on creation:
For more details, you can also refer to the configuration reference page
You can modify the following styling properties:
editor.updateSymbolsStyle([stroke1.id], { width: 42, color: "#808080" , fill: "#ffff00" , opacity: 50 })
editor.updateTextFontStyle([text.id],{ fontSize: 20, fontWeight: "bold" })
rendering.guides.*
properties. For example:const options = {
configuration: {
rendering: {
guides: {
gap: 25,
type: "line"
}
}
}
}
You can also use your own framework for ink capture, rendering and model and use the IIRecognizer to send strokes updates to our recognition Engine and receive all server updates.
We have developed a React app example based on a tldraw canvas to illustrate such a custom integration:
This example is based on the following main objects:
A Recognizer extending IIRecognizer, which handles all communication with the recognition server.
A Synchronizer which is responsible for intercepting canvas events and translating them to the Recognizer. It also receives gesture notifications from the Recognizer and invokes the gesture to perform associated actions.
a Gesture which is responsible for applying the actions associated with gestures.
a Converter which is responsible for converting handwritten content into a typed equivalent.
Please refer to this callflow for a more detailed description of these objects and how they interact with iinkTS and tldraw: