Bin
2025-12-16 9e0b2ba2c317b1a86212f24cbae3195ad1f3dbfa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { observer } from "mobx-react";
import { types } from "mobx-state-tree";
 
import Registry from "../../core/Registry";
import { guidGenerator } from "../../core/Helpers";
import ControlBase from "./Base";
 
/**
 * VideoRectangle tag brings Object Tracking capabilities to videos. It works in combination with the `<Video/>` and the `<Labels/>` tags.
 *
 * Use with the following data types: video
 * @example
 * <!--Video Object Tracking-->
 * <View>
 *   <Header>Label the video:</Header>
 *   <Video name="video" value="$video" />
 *   <VideoRectangle name="box" toName="video" />
 *
 *   <Labels name="videoLabels" toName="video">
 *     <Label value="Cell" background="#944BFF"/>
 *     <Label value="Bacteria" background="#98C84E"/>
 *   </Labels>
 * </View>
 * @name VideoRectangle
 * @meta_title Video Tag for Video Labeling
 * @meta_description Customize Label Studio with the Video tag for basic video annotation tasks for machine learning and data science projects.
 * @param {string} name Name of the element
 * @param {string} toName Name of the element to control (video)
 */
const TagAttrs = types.model({
  toname: types.maybeNull(types.string),
});
 
const ModelAttrs = types.model("VideoRectangleModel", {
  pid: types.optional(types.string, guidGenerator),
  type: "videorectangle",
});
 
const VideoRectangleModel = types.compose("VideoRectangleModel", ControlBase, ModelAttrs, TagAttrs);
 
const HtxVideoRectangle = observer(() => {
  return null;
});
 
Registry.addTag("videorectangle", VideoRectangleModel, HtxVideoRectangle);
 
export { HtxVideoRectangle, VideoRectangleModel };