@@ -63,6 +63,7 @@ export type ClassDefinition = {
6363 name : string ;
6464 id : number ;
6565 color : string ;
66+ keybind ?: string ;
6667} ;
6768
6869export type SliderInfo = {
@@ -168,7 +169,7 @@ export type ImageData = {
168169export type ULabelSubtasks = { [ key : string ] : ULabelSubtask } ;
169170
170171export class ULabel {
171- subtasks : ULabelSubtask [ ] ;
172+ subtasks : ULabelSubtasks ;
172173 state : {
173174 // Viewer state
174175 zoom_val : number ;
@@ -194,6 +195,9 @@ export class ULabel {
194195 valid_class_ids : number [ ] ;
195196 toolbox_order ?: number [ ] ;
196197 filter_distance_overlay ?: FilterDistanceOverlay ;
198+ begining_time : number ;
199+ is_init : boolean ;
200+ resize_observers : ResizeObserver [ ] ;
197201 /**
198202 * @link https://github.com/SenteraLLC/ulabel/blob/main/api_spec.md#ulabel-constructor
199203 */
@@ -217,12 +221,20 @@ export class ULabel {
217221 * @link https://github.com/SenteraLLC/ulabel/blob/main/api_spec.md#display-utility-functions
218222 */
219223 public init ( callback : ( ) => void ) : void ;
224+ public after_init ( ) : void ;
220225 public show_initial_crop ( ) : void ;
221226 public show_whole_image ( ) : void ;
222227 public swap_frame_image ( new_src : string , frame ?: number ) : string ;
223228 public swap_anno_bg_color ( new_bg_color : string ) : string ;
229+
230+ // Subtasks
224231 public get_current_subtask_key ( ) : string ;
225232 public get_current_subtask ( ) : ULabelSubtask ;
233+ public readjust_subtask_opacities ( ) : void ;
234+ public set_subtask ( st_key : string ) : void ;
235+ public switch_to_next_subtask ( ) : void ;
236+
237+ // Annotations
226238 public get_annotations ( subtask : ULabelSubtask ) : ULabelAnnotation [ ] ;
227239 public set_annotations ( annotations : ULabelAnnotation [ ] , subtask : ULabelSubtask ) ;
228240 public set_saved ( saved : boolean ) ;
@@ -235,8 +247,6 @@ export class ULabel {
235247 public show_annotation_mode (
236248 target_jq ?: JQuery < HTMLElement > , // TODO (joshua-dean): validate this type
237249 ) ;
238- public raise_error ( message : string , level ?: number ) ;
239- public rezoom ( ) : void ;
240250 public update_frame ( delta ?: number , new_frame ?: number ) : void ;
241251 public handle_id_dialog_hover (
242252 mouse_event : JQuery . TriggeredEvent ,
@@ -245,14 +255,120 @@ export class ULabel {
245255 dist_prop : number ;
246256 } ,
247257 ) : void ;
248- public toggle_erase_mode ( mouse_event : JQuery . TriggeredEvent ) : void ;
249- public toggle_brush_mode ( mouse_event : JQuery . TriggeredEvent ) : void ;
258+
259+ // Brush
260+ // TODO (joshua-dean): should these actually be optional?
261+ public toggle_erase_mode ( mouse_event ?: JQuery . TriggeredEvent ) : void ;
262+ public toggle_brush_mode ( mouse_event ?: JQuery . TriggeredEvent ) : void ;
250263 public toggle_delete_class_id_in_toolbox ( ) : void ;
251264 public change_brush_size ( scale_factor : number ) : void ;
265+ public recolor_brush_circle ( ) : void ;
266+ public destroy_brush_circle ( ) : void ;
267+
268+ // Listeners
252269 public remove_listeners ( ) : void ;
253270 static get_allowed_toolbox_item_enum ( ) : AllowedToolboxItem ;
254- static process_classes ( ulabel_obj : ULabel , arg1 : string , subtask_obj : ULabelSubtask ) ;
255- static build_id_dialogs ( ulabel_obj : ULabel ) ;
271+ static process_classes ( ulabel_obj : ULabel , arg1 : string , subtask_obj : ULabelSubtask ) : void ;
272+ static build_id_dialogs ( ulabel_obj : ULabel ) : void ;
273+
274+ // Instance init functions
275+ public create_overlays ( ) : void ;
276+
277+ // nops
278+ public redraw_demo ( ) : void ;
279+
280+ // Annotation lifecycle
281+ // TODO (joshua-dean): type for redo_payload
282+ public begin_annotation ( mouse_event : JQuery . TriggeredEvent , redo_payload ?: object ) : void ;
283+ public create_annotation (
284+ spatial_type : ULabelSpatialType ,
285+ spatial_payload : ULabelSpatialPayload ,
286+ unique_id ?: string ,
287+ ) : void ;
288+ public create_nonspatial_annotation (
289+ redo_payload ?: object ,
290+ ) : void ;
291+ public delete_annotation (
292+ annotation_id : string ,
293+ redo_payload ?: object ,
294+ record_action ?: boolean ,
295+ ) : void ;
296+ public cancel_annotation ( redo_payload ?: object ) : void ;
297+ public get_active_class_id ( ) : number ;
298+ public get_active_class_id_idx ( ) : number ;
299+ public undo ( is_internal_undo ?: boolean ) : void ;
300+ public redo ( ) : void ;
301+
302+ // Mouse event handlers
303+ public handle_mouse_down ( mouse_event : JQuery . TriggeredEvent ) : void ;
304+ public handle_mouse_move ( mouse_event : JQuery . TriggeredEvent ) : void ;
305+ public handle_mouse_up ( mouse_event : JQuery . TriggeredEvent ) : void ;
306+ public handle_aux_click ( mouse_event : JQuery . TriggeredEvent ) : void ;
307+ public handle_wheel ( wheel_event : WheelEvent ) : void ;
308+ public start_drag (
309+ drag_key : string ,
310+ release_button : string ,
311+ mouse_event : JQuery . TriggeredEvent ,
312+ ) : void ;
313+ public end_drag ( mouse_event : JQuery . TriggeredEvent ) : void ;
314+ public drag_repan ( mouse_event : JQuery . TriggeredEvent ) : void ;
315+ public drag_rezoom ( mouse_event : JQuery . TriggeredEvent ) : void ;
316+
317+ // "Mouse event interpreters"
318+ public get_global_mouse_x ( mouse_event : JQuery . TriggeredEvent ) : number ;
319+ public get_global_mouse_y ( mouse_event : JQuery . TriggeredEvent ) : number ;
320+
321+ // Edit suggestions
322+ public suggest_edits (
323+ mouse_event ?: JQuery . TriggeredEvent ,
324+ nonspatial_id ?: string ,
325+ ) : void ;
326+ public show_global_edit_suggestion (
327+ annid : string ,
328+ offset ?: {
329+ diffX : number ;
330+ diffY : number ;
331+ diffZ ?: number ;
332+ } ,
333+ nonspatial_id ?: string ,
334+ ) : void ;
335+ public hide_global_edit_suggestion ( ) : void ;
336+
337+ // Drawing
338+ public rezoom (
339+ foc_x ?: number ,
340+ foc_y ?: number ,
341+ abs ?: boolean ,
342+ ) : void ;
343+ public reposition_dialogs ( ) : void ;
344+ public handle_toolbox_overflow ( ) : void ;
345+
346+ // ID Dialog
347+ public set_id_dialog_payload_nopin (
348+ class_ind : number ,
349+ dist_prop : number
350+ ) : void ;
351+ public update_id_dialog_display (
352+ front ?: boolean ,
353+ ) : void ;
354+ public handle_id_dialog_click (
355+ mouse_event : JQuery . TriggeredEvent ,
356+ annotation_id ?: string ,
357+ new_class_idx ?: number ,
358+ ) : void ;
359+ public show_id_dialog (
360+ gbx : number ,
361+ gby : number ,
362+ active_ann : string , // annotation id
363+ thumbnail ?: boolean ,
364+ nonspatial ?: boolean ,
365+ ) : void ;
366+
367+ // Canvases
368+ public get_init_canvas_context_id (
369+ annotation_id : string ,
370+ subtask ?: string , // SUBTASK KEY
371+ ) : string ;
256372}
257373
258374declare global {
0 commit comments