/
vshmidt
/
label-studio
Обзор
Документация
Войти
/
vshmidt
/
label-studio
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
web/libs/editor/src/tools/Rotate.jsx
53 строки
1 KB
Michael Malyuk
feat: BROS-114: Global Custom Hotkeys (#7784)
05 июл 2025, 19:04
Не верифицирован
05 июл 2025, 19:04
f0fb90a
Код
Авторство
О чём код?
import { observer } from "mobx-react"; import { types } from "mobx-state-tree"; import BaseTool from "./Base"; import ToolMixin from "../mixins/Tool"; import { Tool } from "../components/Toolbar/Tool"; import { IconRotateLeftTool, IconRotateRightTool } from "@humansignal/icons"; const ToolView = observer(({ item }) => { return ( <> <Tool active={item.selected} icon={<IconRotateLeftTool />} ariaLabel="rotate-left" label="Rotate Left" shortcut="tool:rotate-left" onClick={() => { item.rotate(-90); }} /> <Tool active={item.selected} icon={<IconRotateRightTool />} ariaLabel="rotate-right" label="Rotate Right" shortcut="tool:rotate-right" onClick={() => { item.rotate(90); }} /> </> ); }); const _Tool = types .model("RotateTool", { group: "control", }) .views((self) => ({ get viewClass() { return () => <ToolView item={self} />; }, })) .actions((self) => ({ rotate(degree) { self.obj.rotate(degree); }, })); const Rotate = types.compose(_Tool.name, ToolMixin, BaseTool, _Tool); export { Rotate };