feat: implement document actions for managing artboards, zoom, and history; update UI components to utilize new actions
This commit is contained in:
@@ -9,7 +9,7 @@ import { createDocumentReadIndex, type DocumentReadIndex } from "@editor/documen
|
||||
import type { MaskEditState, SelectionState } from "@editor/state";
|
||||
import type { AppStore } from "@editor/store";
|
||||
import { resolveLayerDrop } from "@input/index";
|
||||
import { downloadArtboardPng } from "@operations/export/downloadArtboard";
|
||||
import type { DocumentActions } from "@app/document-actions";
|
||||
import { addArtboard, addEmptyLayer, addGroupLayer, addLayerMask, deleteSelection, groupLayers, moveLayer } from "@operations/document/layerActions";
|
||||
import { MaskOperationButtons, MaskStatus } from "./layers/MaskControls";
|
||||
|
||||
@@ -19,9 +19,10 @@ export type LayersSheetProps = {
|
||||
maskEdit?: MaskEditState;
|
||||
open: boolean;
|
||||
dispatch: AppStore["dispatch"];
|
||||
documentActions: DocumentActions;
|
||||
};
|
||||
|
||||
export function LayersSheet({ document, selection, maskEdit, open, dispatch }: LayersSheetProps) {
|
||||
export function LayersSheet({ document, selection, maskEdit, open, dispatch, documentActions }: LayersSheetProps) {
|
||||
const draggedLayerId = useRef<string | undefined>(undefined);
|
||||
const [editingTitle, setEditingTitle] = useState<EditingTitle>();
|
||||
|
||||
@@ -41,6 +42,7 @@ export function LayersSheet({ document, selection, maskEdit, open, dispatch }: L
|
||||
editingTitle={editingTitle}
|
||||
setEditingTitle={setEditingTitle}
|
||||
dispatch={dispatch}
|
||||
documentActions={documentActions}
|
||||
/>
|
||||
) : null}
|
||||
</aside>
|
||||
@@ -55,6 +57,7 @@ function LayersSheetBody({
|
||||
editingTitle,
|
||||
setEditingTitle,
|
||||
dispatch,
|
||||
documentActions,
|
||||
}: Omit<LayersSheetProps, "open"> & {
|
||||
draggedLayerId: MutableRefObject<string | undefined>;
|
||||
editingTitle: EditingTitle | undefined;
|
||||
@@ -152,7 +155,7 @@ function LayersSheetBody({
|
||||
title="Export PNG"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
void downloadArtboardPng(artboard, document.assets);
|
||||
void documentActions.exportArtboard(artboard.id);
|
||||
}}
|
||||
>
|
||||
<DownloadSimple size={24} weight="regular" />
|
||||
|
||||
Reference in New Issue
Block a user