Bin
2025-12-16 9e0b2ba2c317b1a86212f24cbae3195ad1f3dbfa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { types } from "mobx-state-tree";
import Registry from "../../../core/Registry";
 
export const DrawingRegion = types.union({
  dispatcher(sn) {
    if (!sn) return types.null;
    // may be a tag itself or just its name
    const objectName = sn.object.name || sn.object;
    // we have to use current config to detect Object tag by name
    const tag = window.Htx.annotationStore.names.get(objectName);
    // provide value to detect Area by data
    const available = Registry.getAvailableAreas(tag.type, sn);
    // union of all available Areas for this Object type
 
    return types.union(...available, types.null);
  },
});