Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit 8969ae4

Browse files
fix: LSDV-4752: Support relations in MIG scenario (#1240)
* Support relations in MIG scenario * Remove excess import * Fix relations checks * Render relation if above checks were skipped * Fix formatting * Remove excess checks * Fix check
1 parent 3d56cef commit 8969ae4

File tree

4 files changed

+48
-663
lines changed

4 files changed

+48
-663
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@
162162
"mobx-state-tree": "^3.16.0",
163163
"nanoid": "^3.3.0",
164164
"node-fetch": "^2.6.1",
165-
"node-sass": "^6.0.1",
166165
"pleasejs": "^0.4.2",
167166
"postcss": "^8.4.6",
168167
"postcss-loader": "^6.2.1",

src/components/RelationsOverlay/RelationsOverlay.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ const RelationItemObserver = observer(({ relation, startNode, endNode, visible,
164164

165165
const visibility = visible && relation.visible;
166166

167-
return render ? (
167+
return (render && relation.shouldRender) ? (
168168
<RelationItem
169169
id={relation.id}
170170
startNode={startNode}

src/stores/RelationStore.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { cloneNode, guidGenerator } from '../core/Helpers';
44
import { RelationsModel } from '../tags/control/Relations';
55
import { TRAVERSE_SKIP } from '../core/Tree';
66
import Area from '../regions/Area';
7+
import { isDefined } from '../utils/utilities';
78

89
/**
910
* Relation between two different nodes
@@ -34,6 +35,24 @@ const Relation = types
3435

3536
return r && r.children && r.children.length > 0;
3637
},
38+
39+
get shouldRender() {
40+
const { node1: start, node2: end } = self;
41+
const [sIdx, eIdx] = [start.item_index, end.item_index];
42+
43+
// as we don't currently have a unified solution for multi-object segmentation
44+
// and the Image tag is the only one to support it, we rely on its API
45+
// TODO: make multi-object solution more generic
46+
if (isDefined(sIdx) &&
47+
start.object.multiImage &&
48+
sIdx !== start.object.currentImage) return false;
49+
50+
if (isDefined(eIdx) &&
51+
end.object.multiImage &&
52+
eIdx !== end.object.currentImage) return false;
53+
54+
return true;
55+
},
3756
}))
3857
.actions(self => ({
3958
afterAttach() {

0 commit comments

Comments
 (0)