refactor(commands): centralize command ids
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { ArtboardId, LayerId } from "@core/id";
|
||||
import type { Command } from "./command";
|
||||
import { commandIds } from "./ids";
|
||||
|
||||
export type SelectionSetPayload = {
|
||||
artboardId?: ArtboardId;
|
||||
@@ -11,7 +12,7 @@ export type SelectionAddLayerPayload = {
|
||||
};
|
||||
|
||||
export const selectionSetCommand: Command<SelectionSetPayload> = {
|
||||
id: "selection.set",
|
||||
id: commandIds.selectionSet,
|
||||
name: "Set selection",
|
||||
execute({ state }, payload) {
|
||||
return {
|
||||
@@ -28,7 +29,7 @@ export const selectionSetCommand: Command<SelectionSetPayload> = {
|
||||
};
|
||||
|
||||
export const selectionClearCommand: Command = {
|
||||
id: "selection.clear",
|
||||
id: commandIds.selectionClear,
|
||||
name: "Clear selection",
|
||||
execute({ state }) {
|
||||
return {
|
||||
@@ -42,7 +43,7 @@ export const selectionClearCommand: Command = {
|
||||
};
|
||||
|
||||
export const selectionAddLayerCommand: Command<SelectionAddLayerPayload> = {
|
||||
id: "selection.addLayer",
|
||||
id: commandIds.selectionAddLayer,
|
||||
name: "Add layer to selection",
|
||||
execute({ state }, payload) {
|
||||
if (state.editor.selection.layerIds.includes(payload.layerId)) return state;
|
||||
|
||||
Reference in New Issue
Block a user