feat(tools): add brush raster painting
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { Asset } from "@core/asset";
|
||||
import type { ImageDocument } from "@core/document";
|
||||
import type { Rect } from "@core/geometry";
|
||||
import type { ArtboardId, LayerId } from "@core/id";
|
||||
import type { ArtboardId, AssetId, LayerId } from "@core/id";
|
||||
import type { ImageLayer } from "@core/image-layer";
|
||||
import type { Layer } from "@core/layer";
|
||||
import type { RasterLayer } from "@core/raster-layer";
|
||||
@@ -43,6 +43,11 @@ export type DocumentAddAssetPayload = {
|
||||
asset: Asset;
|
||||
};
|
||||
|
||||
export type DocumentUpdateAssetSourcePayload = {
|
||||
assetId: AssetId;
|
||||
source: string;
|
||||
};
|
||||
|
||||
export type DocumentAddImageLayerPayload = {
|
||||
artboardId: ArtboardId;
|
||||
parentGroupId?: LayerId;
|
||||
@@ -219,6 +224,20 @@ export const documentAddAssetCommand: Command<DocumentAddAssetPayload> = {
|
||||
},
|
||||
};
|
||||
|
||||
export const documentUpdateAssetSourceCommand: Command<DocumentUpdateAssetSourcePayload> = {
|
||||
id: commandIds.documentUpdateAssetSource,
|
||||
name: "Update asset source",
|
||||
execute({ state }, payload) {
|
||||
return {
|
||||
...state,
|
||||
document: {
|
||||
...state.document,
|
||||
assets: state.document.assets.map((asset) => (asset.id === payload.assetId ? { ...asset, source: payload.source } : asset)),
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export const documentAddImageLayerCommand: Command<DocumentAddImageLayerPayload> = {
|
||||
id: commandIds.documentAddImageLayer,
|
||||
name: "Add image layer",
|
||||
@@ -406,6 +425,7 @@ export const documentCommands = [
|
||||
documentSetArtboardLockedCommand,
|
||||
documentRenameArtboardCommand,
|
||||
documentAddAssetCommand,
|
||||
documentUpdateAssetSourceCommand,
|
||||
documentAddImageLayerCommand,
|
||||
documentAddRasterLayerCommand,
|
||||
documentAddGroupLayerCommand,
|
||||
|
||||
Reference in New Issue
Block a user