Repository navigation
Expand file tree
/
Copy pathindex.js
More file actions
66 lines (56 loc) · 1.63 KB
/
Copy pathindex.js
File metadata and controls
66 lines (56 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* @format
*/
import {AppRegistry, Image} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import {PluginManager} from 'sn-plugin-lib';
import {SNAP_SHAPE_BUTTON_ID, snapCurrentSelection} from './src/shapeSnap';
import {
EXPORT_NOTE_BUTTON_ID,
EXPORT_SAMPLE_BUTTON_ID,
exportCurrentLassoSample,
exportCurrentNoteDataset,
} from './src/exportDataset';
const iconUri = Image.resolveAssetSource(require('./assets/icon.png')).uri;
const SUPPORTED_LASSO_DATA_TYPES = [0, 1, 2, 3, 4, 5];
const ENABLE_DATASET_EXPORT_BUTTONS = false;
AppRegistry.registerComponent(appName, () => App);
PluginManager.init();
PluginManager.registerButton(2, ['NOTE', 'DOC'], {
id: SNAP_SHAPE_BUTTON_ID,
name: 'Snap Shapes',
icon: iconUri,
editDataTypes: SUPPORTED_LASSO_DATA_TYPES,
showType: 0,
});
if (ENABLE_DATASET_EXPORT_BUTTONS) {
PluginManager.registerButton(2, ['NOTE', 'DOC'], {
id: EXPORT_SAMPLE_BUTTON_ID,
name: 'Export Sample',
icon: iconUri,
editDataTypes: SUPPORTED_LASSO_DATA_TYPES,
showType: 0,
});
PluginManager.registerButton(1, ['NOTE'], {
id: EXPORT_NOTE_BUTTON_ID,
name: 'Export Note',
icon: iconUri,
showType: 0,
});
}
PluginManager.registerButtonListener({
onButtonPress(event) {
if (event.id === SNAP_SHAPE_BUTTON_ID) {
void snapCurrentSelection();
return;
}
if (ENABLE_DATASET_EXPORT_BUTTONS && event.id === EXPORT_SAMPLE_BUTTON_ID) {
void exportCurrentLassoSample();
return;
}
if (ENABLE_DATASET_EXPORT_BUTTONS && event.id === EXPORT_NOTE_BUTTON_ID) {
void exportCurrentNoteDataset();
}
},
});