Styling path stroke and remove background lines in React component
LauraPiccolo opened this issue · 3 comments
Hi,
I am using iink in a react component and it's working but I can't figure out how to style the path stroke and the background lines (I don't want the lines).
Sorry if this is very obvious but I really can't find how ...
editor.penStyle()
or editor.theme()
are not being recognized by my component.
Did I forget to import something?
(I have this in my file: import * as iink from 'iink-js'
)
I would be really thankful if you could help!
Laura
Hi Laura,
Thank you for contacting us!
In order to customize your style with a theming approach, you can use the following commands:
editor.theme({'.greenThickPen' : { font-family: 'Open Sans', color: '#00FF00FF', '-myscript-pen-width': 1.5 });
editor.penStyleClasses("greenThickPen");
You can find further information in our online documentation:
https://developer.myscript.com/docs/interactive-ink/1.4/web/iinkjs/styling/
Or draw inspiration from our online styling example:
example is available online https://myscript.github.io/iinkJS/examples/v4/customize_style.html
corresponding source code is here: https://github.com/MyScript/iinkJS/blob/master/examples/v4/customize_style.html
Regarding the text guidelines, they are displayed by default, but you can modify the text.guides.enable property to false if you don't want them:
The full configuration properties list is available here https://developer.myscript.com/docs/interactive-ink/1.4/web/reference/configuration-iinkjs/#text
You can find a ready to use example on how to diable the guidelines here https://myscript.github.io/iinkJS/examples/v4/websocket_text_iink_no_guides.html
with corresponding code https://github.com/MyScript/iinkJS/blob/master/examples/v4/websocket_text_iink_no_guides.html
In order to get a faster support or check whether other developers have raised similar questions, feel free to browse our support forum and ask any question on the forum:
https://developer.myscript.com/support
We hope, this will help and answer your questions!
Gwenaëlle
Hi,
There is indeed no theme() function in the editor: the theme is an editor parameter, that you can modify directly.
With the React integration sample, you can access the editor from the App.js.
We have made a code sample where you can find an example of customized theme & penstyle in the react-custom-style-example branch of our web integration samples:
https://github.com/MyScript/web-integration-samples/tree/react-custom-style-example/react-integration-examples
The editor customized theme & penstyle is done in this file:
https://github.com/MyScript/web-integration-samples/blob/react-custom-style-example/react-integration-examples/src/App.js
Gwenaëlle