2020-01-12 02:22:03 +04:00
|
|
|
import { Action } from "./types";
|
|
|
|
import {
|
|
|
|
moveOneLeft,
|
|
|
|
moveOneRight,
|
|
|
|
moveAllLeft,
|
|
|
|
moveAllRight
|
|
|
|
} from "../zindex";
|
|
|
|
import { getSelectedIndices } from "../scene";
|
2020-01-19 13:21:33 -08:00
|
|
|
import { KEYS } from "../keys";
|
2020-01-12 02:22:03 +04:00
|
|
|
|
|
|
|
export const actionSendBackward: Action = {
|
|
|
|
name: "sendBackward",
|
|
|
|
perform: (elements, appState) => {
|
|
|
|
return {
|
|
|
|
elements: moveOneLeft([...elements], getSelectedIndices(elements)),
|
|
|
|
appState
|
|
|
|
};
|
|
|
|
},
|
|
|
|
contextItemLabel: "Send Backward",
|
|
|
|
keyPriority: 40,
|
|
|
|
keyTest: event =>
|
2020-01-19 13:21:33 -08:00
|
|
|
event[KEYS.META] && event.shiftKey && event.altKey && event.code === "KeyB"
|
2020-01-12 02:22:03 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
export const actionBringForward: Action = {
|
|
|
|
name: "bringForward",
|
|
|
|
perform: (elements, appState) => {
|
|
|
|
return {
|
|
|
|
elements: moveOneRight([...elements], getSelectedIndices(elements)),
|
|
|
|
appState
|
|
|
|
};
|
|
|
|
},
|
|
|
|
contextItemLabel: "Bring Forward",
|
|
|
|
keyPriority: 40,
|
|
|
|
keyTest: event =>
|
2020-01-19 13:21:33 -08:00
|
|
|
event[KEYS.META] && event.shiftKey && event.altKey && event.code === "KeyF"
|
2020-01-12 02:22:03 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
export const actionSendToBack: Action = {
|
|
|
|
name: "sendToBack",
|
|
|
|
perform: (elements, appState) => {
|
|
|
|
return {
|
|
|
|
elements: moveAllLeft([...elements], getSelectedIndices(elements)),
|
|
|
|
appState
|
|
|
|
};
|
|
|
|
},
|
|
|
|
contextItemLabel: "Send to Back",
|
2020-01-19 13:21:33 -08:00
|
|
|
keyTest: event => event[KEYS.META] && event.shiftKey && event.code === "KeyB"
|
2020-01-12 02:22:03 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
export const actionBringToFront: Action = {
|
|
|
|
name: "bringToFront",
|
|
|
|
perform: (elements, appState) => {
|
|
|
|
return {
|
|
|
|
elements: moveAllRight([...elements], getSelectedIndices(elements)),
|
|
|
|
appState
|
|
|
|
};
|
|
|
|
},
|
|
|
|
contextItemLabel: "Bring to Front",
|
2020-01-19 13:21:33 -08:00
|
|
|
keyTest: event => event[KEYS.META] && event.shiftKey && event.code === "KeyF"
|
2020-01-12 02:22:03 +04:00
|
|
|
};
|