capacitor-onyx
v0.0.2
Published
Provides an interface to the Onyx SDK
Readme
capacitor-onyx
Provides an interface to the Onyx SDK for the Boox series of tablets
Install
npm install capacitor-onyx
npx cap syncConfigure Gradle
Add the following to your app's build.gradle repositories block (it will also have the flatDirs config from default capacitor).
repositories {
maven {
url "http://repo.boox.com/repository/maven-public"
allowInsecureProtocol = true
}
}And in the android block in your build.gradle:
android {
//..namespace, defaultConfig, buildTypes, etc
packagingOptions {
jniLibs {
pickFirsts += [
'lib/arm64-v8a/libc++_shared.so',
'lib/armeabi-v7a/libc++_shared.so',
'lib/x86/libc++_shared.so',
'lib/x86_64/libc++_shared.so'
]
}
}
}Last, add the following line to your gradle.properties file
android.enableJetifier=trueAPI
start(...)stop()configureStroke(...)addListener('onDrawingStart', ...)addListener('onDrawingEnd', ...)addListener('onStroke', ...)addListener('onErasingStart', ...)addListener('onErasingEnd', ...)addListener('onErase', ...)removeAllListeners()- Interfaces
start(...)
start(options: DrawAreaOptions) => Promise<void>| Param | Type |
| ------------- | ----------------------------------------------------------- |
| options | DrawAreaOptions |
stop()
stop() => Promise<void>configureStroke(...)
configureStroke(options: StrokeOptions) => Promise<void>| Param | Type |
| ------------- | ------------------------------------------------------- |
| options | StrokeOptions |
addListener('onDrawingStart', ...)
addListener(name: 'onDrawingStart', callback: (point: Point) => void) => PluginListenerHandle| Param | Type |
| -------------- | ----------------------------------------------------------- |
| name | 'onDrawingStart' |
| callback | (point: Point) => void |
Returns: PluginListenerHandle
addListener('onDrawingEnd', ...)
addListener(name: 'onDrawingEnd', callback: () => void) => PluginListenerHandle| Param | Type |
| -------------- | --------------------------- |
| name | 'onDrawingEnd' |
| callback | () => void |
Returns: PluginListenerHandle
addListener('onStroke', ...)
addListener(name: 'onStroke', callback: (stroke: Stroke) => void) => PluginListenerHandle| Param | Type |
| -------------- | -------------------------------------------------------------- |
| name | 'onStroke' |
| callback | (stroke: Stroke) => void |
Returns: PluginListenerHandle
addListener('onErasingStart', ...)
addListener(name: 'onErasingStart', callback: (point: Point) => void) => PluginListenerHandle| Param | Type |
| -------------- | ----------------------------------------------------------- |
| name | 'onErasingStart' |
| callback | (point: Point) => void |
Returns: PluginListenerHandle
addListener('onErasingEnd', ...)
addListener(name: 'onErasingEnd', callback: () => void) => PluginListenerHandle| Param | Type |
| -------------- | --------------------------- |
| name | 'onErasingEnd' |
| callback | () => void |
Returns: PluginListenerHandle
addListener('onErase', ...)
addListener(name: 'onErase', callback: (stroke: Stroke) => void) => PluginListenerHandle| Param | Type |
| -------------- | -------------------------------------------------------------- |
| name | 'onErase' |
| callback | (stroke: Stroke) => void |
Returns: PluginListenerHandle
removeAllListeners()
removeAllListeners() => voidInterfaces
DrawAreaOptions
| Prop | Type |
| ------------ | ------------------- |
| x | number |
| y | number |
| height | number |
| width | number |
StrokeOptions
| Prop | Type |
| ----------- | ------------------------------------------------------------------------------------------------------- |
| width | number |
| style | 'pencil' | 'fountain' | 'marker' | 'neo-brush' | 'charcoal' | 'dash' | 'charcoal-v2' |
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
Point
| Prop | Type |
| --------------- | ------------------- |
| x | number |
| y | number |
| size | number |
| pressure | number |
| timestamp | number |
Stroke
| Prop | Type |
| ------------ | -------------------- |
| points | Point[] |
