2020-01-12 02:22:03 +04:00
|
|
|
import { Action } from "./types";
|
|
|
|
import {
|
|
|
|
moveOneLeft,
|
|
|
|
moveOneRight,
|
|
|
|
moveAllLeft,
|
2020-01-24 12:04:54 +02:00
|
|
|
moveAllRight,
|
2020-01-12 02:22:03 +04:00
|
|
|
} 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)),
|
2020-01-24 12:04:54 +02:00
|
|
|
appState,
|
2020-01-12 02:22:03 +04:00
|
|
|
};
|
|
|
|
},
|
2020-01-21 01:14:10 +02:00
|
|
|
contextItemLabel: "labels.sendBackward",
|
2020-01-12 02:22:03 +04:00
|
|
|
keyPriority: 40,
|
|
|
|
keyTest: event =>
|
2020-01-24 12:04:54 +02: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)),
|
2020-01-24 12:04:54 +02:00
|
|
|
appState,
|
2020-01-12 02:22:03 +04:00
|
|
|
};
|
|
|
|
},
|
2020-01-21 01:14:10 +02:00
|
|
|
contextItemLabel: "labels.bringForward",
|
2020-01-12 02:22:03 +04:00
|
|
|
keyPriority: 40,
|
|
|
|
keyTest: event =>
|
2020-01-24 12:04:54 +02: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)),
|
2020-01-24 12:04:54 +02:00
|
|
|
appState,
|
2020-01-12 02:22:03 +04:00
|
|
|
};
|
|
|
|
},
|
2020-01-21 01:14:10 +02:00
|
|
|
contextItemLabel: "labels.sendToBack",
|
2020-01-24 12:04:54 +02: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)),
|
2020-01-24 12:04:54 +02:00
|
|
|
appState,
|
2020-01-12 02:22:03 +04:00
|
|
|
};
|
|
|
|
},
|
2020-01-21 01:14:10 +02:00
|
|
|
contextItemLabel: "labels.bringToFront",
|
2020-01-24 12:04:54 +02:00
|
|
|
keyTest: event => event[KEYS.META] && event.shiftKey && event.code === "KeyF",
|
2020-01-12 02:22:03 +04:00
|
|
|
};
|