mirror of
https://github.com/stan-smith/FossFLOW.git
synced 2025-12-24 06:58:48 -05:00
feat: introduces new TextBox tool
This commit is contained in:
14
src/interaction/modes/TextBox.ts
Normal file
14
src/interaction/modes/TextBox.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { setWindowCursor } from 'src/utils';
|
||||
import { ModeActions } from 'src/types';
|
||||
|
||||
export const TextBox: ModeActions = {
|
||||
entry: () => {
|
||||
setWindowCursor('crosshair');
|
||||
},
|
||||
exit: () => {
|
||||
setWindowCursor('default');
|
||||
},
|
||||
mousemove: () => {},
|
||||
mousedown: () => {},
|
||||
mouseup: () => {}
|
||||
};
|
||||
@@ -9,6 +9,7 @@ import { DrawRectangle } from './modes/Rectangle/DrawRectangle';
|
||||
import { Connector } from './modes/Connector';
|
||||
import { Pan } from './modes/Pan';
|
||||
import { PlaceElement } from './modes/PlaceElement';
|
||||
import { TextBox } from './modes/TextBox';
|
||||
|
||||
const modes: { [k in string]: ModeActions } = {
|
||||
CURSOR: Cursor,
|
||||
@@ -16,7 +17,8 @@ const modes: { [k in string]: ModeActions } = {
|
||||
'RECTANGLE.DRAW': DrawRectangle,
|
||||
CONNECTOR: Connector,
|
||||
PAN: Pan,
|
||||
PLACE_ELEMENT: PlaceElement
|
||||
PLACE_ELEMENT: PlaceElement,
|
||||
TEXTBOX: TextBox
|
||||
};
|
||||
|
||||
export const useInteractionManager = () => {
|
||||
|
||||
@@ -43,7 +43,7 @@ export interface Mouse {
|
||||
} | null;
|
||||
}
|
||||
|
||||
// Begin mode types
|
||||
// Mode types
|
||||
export interface InteractionsDisabled {
|
||||
type: 'INTERACTIONS_DISABLED';
|
||||
showCursor: boolean;
|
||||
@@ -94,6 +94,11 @@ export interface ResizeRectangleMode {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface TextBoxMode {
|
||||
type: 'TEXTBOX';
|
||||
showCursor: boolean;
|
||||
}
|
||||
|
||||
export type Mode =
|
||||
| InteractionsDisabled
|
||||
| CursorMode
|
||||
@@ -102,7 +107,8 @@ export type Mode =
|
||||
| ConnectorMode
|
||||
| DrawRectangleMode
|
||||
| ResizeRectangleMode
|
||||
| DragItemsMode;
|
||||
| DragItemsMode
|
||||
| TextBoxMode;
|
||||
// End mode types
|
||||
|
||||
export type ContextMenu =
|
||||
|
||||
Reference in New Issue
Block a user