PromucFlow_constructor/app/client/src/actions/canvasSelectionActions.ts
Ashok Kumar M 2a8e37bf3b
feat: Sliding Canvas for Dragging and Selection (#9983)
* Move existing canvas's to CanvasArenas folder

* moving hooks to canvas arenas folder.

* Sticky canvas implementation.

* fixing specs(WIP)

* dip

* fixing test cases.

* removing comments.

* fixing build

* renaming for readability.

* adding folder for canvas based sagas.

* Resolve conflicts.

* fixing failed cases.

* fixing cypress cases.

* fixing bugs introduced coz of drag and drop.

* fixing bugs.

* few more bug fixes in draw to select.

* mouse pointer default when drag to select.

* bug fix.

* dip

* integrating intersection api.

* dip need to adjust offset

* fixing offset issues.

* readability fix

* rebase bug fixes.

* bug fix.

* adjust canvas slider on mouse over.

* unwanted changes.

* left offset fix + removing dead code.

* fixing bugs.

* fixing broken test cases.

* addressing code review comments.
2022-01-25 20:58:31 +05:30

54 lines
1.3 KiB
TypeScript

import { ReduxAction, ReduxActionTypes } from "constants/ReduxActionConstants";
import { SelectedArenaDimensions } from "pages/common/CanvasArenas/CanvasSelectionArena";
import { XYCord } from "pages/common/CanvasArenas/hooks/useCanvasDragging";
export const setCanvasSelectionFromEditor = (
start: boolean,
startPoints?: XYCord,
) => {
return {
type: start
? ReduxActionTypes.START_CANVAS_SELECTION_FROM_EDITOR
: ReduxActionTypes.STOP_CANVAS_SELECTION_FROM_EDITOR,
payload: {
...(start && startPoints ? { startPoints } : {}),
},
};
};
export const setCanvasSelectionStateAction = (
start: boolean,
widgetId: string,
) => {
return {
type: start
? ReduxActionTypes.START_CANVAS_SELECTION
: ReduxActionTypes.STOP_CANVAS_SELECTION,
payload: {
widgetId,
},
};
};
export const selectAllWidgetsInAreaAction = (
selectionArena: SelectedArenaDimensions,
snapToNextColumn: boolean,
snapToNextRow: boolean,
isMultiSelect: boolean,
snapSpaces: {
snapColumnSpace: number;
snapRowSpace: number;
},
): ReduxAction<any> => {
return {
type: ReduxActionTypes.SELECT_WIDGETS_IN_AREA,
payload: {
selectionArena,
snapToNextColumn,
snapToNextRow,
isMultiSelect,
snapSpaces,
},
};
};