From 49f00bd4e6653bfdcda522951462a37d1812ba9a Mon Sep 17 00:00:00 2001 From: Sulf Date: Sat, 31 Aug 2019 11:24:30 -0500 Subject: [PATCH 1/4] Refresh obejct list without recreating it When an object is deleted updates it status in the list. --- annotationTools/js/handler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/annotationTools/js/handler.js b/annotationTools/js/handler.js index 380eb1d9..2c1864c5 100755 --- a/annotationTools/js/handler.js +++ b/annotationTools/js/handler.js @@ -145,7 +145,7 @@ function handler() { WriteXML(SubmitXmlUrl,LM_xml,function(){return;}); // Refresh object list: - if(view_ObjList) RenderObjectList(); + if(view_ObjList) UpdateObjectList(true, idx); selected_poly = -1; unselectObjects(); // Perhaps this should go elsewhere... StopEditEvent(); From 216aceab6e861e4b8b98612211241c25b825ccf6 Mon Sep 17 00:00:00 2001 From: Sulf Date: Sat, 31 Aug 2019 11:28:43 -0500 Subject: [PATCH 2/4] Update new_name if a object is modified Updates the object's name on the list instead of recreating it --- annotationTools/js/handler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/annotationTools/js/handler.js b/annotationTools/js/handler.js index 2c1864c5..a9424edb 100755 --- a/annotationTools/js/handler.js +++ b/annotationTools/js/handler.js @@ -108,7 +108,7 @@ function handler() { // Refresh object list: if(view_ObjList) { - RenderObjectList(); + UpdateObjectList(false, anno.anno_id, new_name); ChangeLinkColorFG(anno.GetAnnoID()); } }; From dde2b26cebc9115d97ee03cc06c7913889c68791 Mon Sep 17 00:00:00 2001 From: Sulf Date: Sat, 31 Aug 2019 11:31:22 -0500 Subject: [PATCH 3/4] Removed duplicated code Each function calling StopEditEvent() calls also RenderObjectList. Removing these lines avoids recreating the object list twice. This can be problematic when updating hundreds of objects. --- annotationTools/js/edit_event.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/annotationTools/js/edit_event.js b/annotationTools/js/edit_event.js index ca72d7c1..affde8d1 100644 --- a/annotationTools/js/edit_event.js +++ b/annotationTools/js/edit_event.js @@ -131,10 +131,6 @@ function StopEditEvent() { } } - // Render the object list: - if(view_ObjList) { - RenderObjectList(); - } console.log('LabelMe: Stopped edit event.'); } From aebf242ff2da924a2bccf3843f29debace10eb69 Mon Sep 17 00:00:00 2001 From: Sulf Date: Sat, 31 Aug 2019 11:33:47 -0500 Subject: [PATCH 4/4] Function that updates only what has been modified This function refreshes the object list modifying only the DOM element who was deleted or it name changed. --- annotationTools/js/object_list.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/annotationTools/js/object_list.js b/annotationTools/js/object_list.js index 3e1154a1..bb22b4c1 100644 --- a/annotationTools/js/object_list.js +++ b/annotationTools/js/object_list.js @@ -8,6 +8,13 @@ var IsHidingAllPolygons = false; var ListOffSet = 0; +function UpdateObjectList(deleted, idx, new_name) { + if (deleted) + $('#anno_list #LinkAnchor' + idx).empty(); + if (new_name != 'undefined') + $('#anno_list #LinkAnchor'+idx+ ' #Link'+ idx).text(new_name); +} + // This function creates and populates the list function RenderObjectList() { // If object list has been rendered, then remove it: