Skip to content

Commit c62f946

Browse files
Add method to get AllowedToolboxItem
1 parent a73f1d8 commit c62f946

7 files changed

Lines changed: 25 additions & 4 deletions

File tree

api_spec.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ enum AllowedToolboxItem {
325325
Brush // 9
326326
}
327327
```
328+
You can access the AllowedToolboxItem enum by calling the static method:
329+
```javascript
330+
const AllowedToolboxItem = ULabel.get_allowed_toolbox_item_enum();
331+
```
328332
329333
### `default_keybinds`
330334
Keybinds can be set to control the annotation session. The default values are:

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Nothing yet.
99
- Fix bug where the `filter_annotations_on_load = true` option would not work as expected.
1010
- The `keypoint_slider_default_value` option was not being properly multiplied by 100 internally.
1111
- Move several config argument defaults into the configuration class instead of in the ULabel constructor.
12+
- Add `get_allowed_toolbox_item_enum()` static method to ULabel.
1213
#### Breaking Changes
1314
- Changed default for `filter_annotations_on_load` from `false` to `true`.
1415
- Deprecated the `default_toolbox_item_order` argument in the ULabel constructor. Use `toolbox_order` instead.

demo/row-filtering-example.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@
715715
}
716716
]
717717

718-
let subtasks = {
718+
const subtasks = {
719719
"plants": {
720720
"display_name": "Plants",
721721
"classes": [
@@ -751,14 +751,25 @@
751751
}
752752
};
753753

754+
const AllowedToolboxItem = ULabel.get_allowed_toolbox_item_enum();
754755
// Initial ULabel configuration
755756
let ulabel = new ULabel({
756757
"container_id": "container",
757758
"image_data": "https://ulabel.s3.us-east-2.amazonaws.com/cs-demo-0.png",
758759
"username": "DemoUser",
759760
"submit_buttons": on_submit,
760761
"subtasks": subtasks,
761-
"toolbox_order": [0, 1, 3, 6, 8, 2, 7, 4, 5],
762+
"toolbox_order": [
763+
AllowedToolboxItem.ModeSelect,
764+
AllowedToolboxItem.ZoomPan,
765+
AllowedToolboxItem.AnnotationID,
766+
AllowedToolboxItem.ClassCounter,
767+
AllowedToolboxItem.KeypointSlider,
768+
AllowedToolboxItem.FilterDistance,
769+
AllowedToolboxItem.AnnotationResize,
770+
AllowedToolboxItem.SubmitButtons,
771+
AllowedToolboxItem.RecolorActive,
772+
],
762773
"distance_filter_toolbox_item": {
763774
"default_values": {
764775
"closest_row": {

dist/ulabel.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ulabel.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ export class ULabel {
213213
public toggle_delete_class_id_in_toolbox(): void;
214214
public change_brush_size(scale_factor: number): void;
215215
public remove_listeners(): void;
216+
static get_allowed_toolbox_item_enum(): AllowedToolboxItem;
216217
static process_classes(ulabel_obj: any, arg1: string, subtask_obj: any);
217218
static build_id_dialogs(ulabel_obj: any);
218219

src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ export class ULabel {
9191
document.cookie = "nightmode=true;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/";
9292
}
9393

94+
static get_allowed_toolbox_item_enum() {
95+
return AllowedToolboxItem;
96+
}
97+
9498
/*
9599
Types of drags
96100
- annotation

0 commit comments

Comments
 (0)