/
vshmidt
/
label-studio
Обзор
Документация
Войти
/
vshmidt
/
label-studio
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
web/libs/editor/src/regions/Test.js
62 строки
1 KB
Raul Martin
refactor: echo 27: Introducing biome (#5759)
29 апр 2024, 11:39
Не верифицирован
29 апр 2024, 11:39
2660ec9
Код
Авторство
О чём код?
import { types } from "mobx-state-tree"; const Region = types.model({ name: types.string, }); export const ImageRegion = types.compose( "Image", Region, types .model({ id: types.identifier, type: types.literal("image"), }) .actions(() => ({ draw() { // console.log("DRAW", self.id); }, })), ); export const TextRegion = types.compose( "Text", Region, types .model({ id: types.identifier, type: types.literal("text"), }) .actions(() => ({ select() { // console.log("SELECT", self.id); }, })), ); // const HyperTextRegion = types.model({ // id: types.identifier, // type: types.literal(""), // }); // const AudioRegion = types.model({ // id: types.identifier, // type: types.literal(""), // }); const TestRaw = types.model("TestRaw", { regions: types.array(types.union(ImageRegion, TextRegion)), // inheritance: types.array(Region), // wrong :( meta: types.number, }); const TestMeta = types.model({ meta: types.model({ width: 120, height: 100, }), }); const Test = types.compose("Test", TestRaw, TestMeta); export default Test;