Skip to content

Commit ce36d2c

Browse files
2 parents 9b7b627 + f2b22f9 commit ce36d2c

File tree

13 files changed

+62
-15
lines changed

13 files changed

+62
-15
lines changed

web/dist/apps/labelstudio/main.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.

web/dist/apps/labelstudio/main.js.map

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

web/dist/apps/labelstudio/vendor.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.

web/dist/apps/labelstudio/vendor.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"message": "feat: OPTIC-1733: Standardize Dropdown Components Using LSE selector (#7257)",
3-
"commit": "ddb598a3e2f0aedb7d58055aa80b1937ee7f901f",
4-
"date": "2025-04-22T18:37:23.000Z",
2+
"message": "fix: LEAP-1947: Fix interactive view all FF in image tag case (#7387)",
3+
"commit": "98dfd898c23e94a2f094df3798ad233ba8a83a91",
4+
"date": "2025-04-23T16:14:37.000Z",
55
"branch": "develop"
66
}

web/dist/libs/editor/version.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"message": "feat: OPTIC-1733: Standardize Dropdown Components Using LSE selector (#7257)",
3-
"commit": "ddb598a3e2f0aedb7d58055aa80b1937ee7f901f",
4-
"date": "2025-04-22T18:37:23.000Z",
2+
"message": "fix: LEAP-1947: Fix interactive view all FF in image tag case (#7387)",
3+
"commit": "98dfd898c23e94a2f094df3798ad233ba8a83a91",
4+
"date": "2025-04-23T16:14:37.000Z",
55
"branch": "develop"
66
}

web/libs/editor/src/core/Tree.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ function renderItem(ref: IAnyStateTreeNode, annotation: IAnnotation, includeKey
221221
if (isFF(FF_DEV_3391)) {
222222
if (!annotation) return null;
223223

224-
el = annotation.ids.get(cleanUpId(ref.id ?? ref.name));
224+
// The part `|| el` is a hack to allow it to work with Image regions. For some reason, it uses this function for rendering
225+
el = annotation.ids.get(cleanUpId(ref.id ?? ref.name)) || el;
225226
}
226227

227228
if (!el) {
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"ff_front_DEV_1713_audio_ui_150222_short": false,
33
"ff_front_dev_2715_audio_3_280722_short": true,
4-
"fflag_fix_front_dev_3391_interactive_view_all": false,
54
"fflag_feat_front_dev_3873_labeling_ui_improvements_short": true,
65
"fflag_fix_front_lsdv_4620_memory_leaks_100723_short": false
76
}

web/libs/editor/src/mixins/Tool.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import { ff } from "@humansignal/core";
12
import { getEnv, getRoot, types } from "mobx-state-tree";
23
import { cloneNode } from "../core/Helpers";
4+
import { FF_DEV_3391 } from "../utils/feature-flags";
35
import { AnnotationMixin } from "./AnnotationMixin";
46

57
const ToolMixin = types
@@ -10,6 +12,13 @@ const ToolMixin = types
1012
})
1113
.views((self) => ({
1214
get obj() {
15+
if (ff.isActive(FF_DEV_3391)) {
16+
// It's a temporal solution (see root description)
17+
const root = self.manager?.root;
18+
if (root?.annotationStore.selected) {
19+
return root.annotationStore.selected.names.get(self.manager?.name);
20+
}
21+
}
1322
return self.manager?.obj ?? getEnv(self).object;
1423
},
1524

@@ -18,6 +27,16 @@ const ToolMixin = types
1827
},
1928

2029
get control() {
30+
if (ff.isActive(FF_DEV_3391)) {
31+
// It's a temporal solution (see root description)
32+
const control = getEnv(self).control;
33+
const { name } = control;
34+
const root = self.manager?.root;
35+
if (root?.annotationStore.selected) {
36+
return root.annotationStore.selected.names.get(name);
37+
}
38+
return control;
39+
}
2140
return getEnv(self).control;
2241
},
2342

web/libs/editor/src/mixins/ToolManagerMixin.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
import { ff } from "@humansignal/core";
12
import { types } from "mobx-state-tree";
23
import ToolsManager from "../tools/Manager";
34
import * as Tools from "../tools";
5+
import { FF_DEV_3391 } from "../utils/feature-flags";
46

57
export const ToolManagerMixin = types.model().actions((self) => {
68
return {
79
afterAttach() {
10+
if (ff.isActive(FF_DEV_3391) && !self.annotation) {
11+
return;
12+
}
813
const toolNames = self.toolNames ?? [];
914
const manager = ToolsManager.getInstance({ name: self.toname });
1015
const env = { manager, control: self };

web/libs/editor/src/stores/Annotation/Annotation.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,10 @@ const _Annotation = types
174174

175175
const updateIds = (item) => {
176176
const children = item.children?.map(updateIds);
177+
const imageEntities = item.imageEntities?.map(updateIds);
177178

178179
if (children) item = { ...item, children };
180+
if (imageEntities) item = { ...item, imageEntities };
179181
if (item.id) item = { ...item, id: `${item.name ?? item.id}@${sn.id}` };
180182
// @todo fallback for tags with name as id:
181183
// if (item.name) item = { ...item, name: item.name + "@" + sn.id };

web/libs/editor/src/tags/object/Image/Image.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ff } from "@humansignal/core";
12
import { inject } from "mobx-react";
23
import { destroy, getRoot, getType, types } from "mobx-state-tree";
34

@@ -16,6 +17,7 @@ import ToolsManager from "../../../tools/Manager";
1617
import { parseValue } from "../../../utils/data";
1718
import {
1819
FF_DEV_3377,
20+
FF_DEV_3391,
1921
FF_DEV_3793,
2022
FF_LSDV_4583,
2123
FF_LSDV_4583_6,
@@ -567,7 +569,9 @@ const Model = types
567569
};
568570
},
569571
}))
570-
572+
.volatile((self) => ({
573+
manager: null,
574+
}))
571575
// actions for the tools
572576
.actions((self) => {
573577
const manager = ToolsManager.getInstance({ name: self.name });
@@ -577,18 +581,19 @@ const Model = types
577581
if (!self.store.task) return;
578582

579583
const parsedValue = self.multiImage ? self.parsedValueList : self.parsedValue;
584+
const idPostfix = self.annotation ? `@${self.annotation.id}` : "";
580585

581586
if (Array.isArray(parsedValue)) {
582587
parsedValue.forEach((src, index) => {
583588
self.imageEntities.push({
584-
id: `${self.name}#${index}`,
589+
id: `${self.name}#${index}${idPostfix}`,
585590
src,
586591
index,
587592
});
588593
});
589594
} else {
590595
self.imageEntities.push({
591-
id: `${self.name}#0`,
596+
id: `${self.name}#0${idPostfix}`,
592597
src: parsedValue,
593598
index: 0,
594599
});
@@ -598,6 +603,9 @@ const Model = types
598603
}
599604

600605
function afterAttach() {
606+
if (ff.isActive(FF_DEV_3391) && !self.annotation) {
607+
return;
608+
}
601609
if (self.selectioncontrol) manager.addTool("MoveTool", Tools.Selection.create({}, env));
602610

603611
if (self.zoomcontrol) manager.addTool("ZoomPanTool", Tools.Zoom.create({}, env));

web/libs/editor/src/tools/Manager.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ class ToolsManager {
4242
get preservedTool() {
4343
return window.localStorage.getItem(`selected-tool:${this.name}`);
4444
}
45+
/**
46+
There are some problems with working with ToolManager with interactive view all flag switched on.
47+
For now, tool manager is hidden in view_all,
48+
so it allows us to use root and selected annotation
49+
while we are looking for the object or the control from the tool.
50+
At the same time, we can use `annotation_id`
51+
as an additional key to be able to get the right annotation in that view_all mode.
52+
But in that case,
53+
there will be a problem with the inconsistent state of tool manager for 2 different annotations in the context of the same task.
54+
*/
55+
get root() {
56+
return root;
57+
}
4558

4659
get obj() {
4760
return root.annotationStore.names.get(this.name);

0 commit comments

Comments
 (0)