Add selection copy and paste

This commit is contained in:
Mitchell McCaffrey
2021-07-23 15:41:07 +10:00
parent 1b248c16a5
commit 5546bf525e
7 changed files with 321 additions and 58 deletions
+13
View File
@@ -342,6 +342,18 @@ function NetworkedMapAndTokens({ session }: { session: Session }) {
]);
}
function handleSelectionItemsCreate(
tokenStates: TokenState[],
notes: Note[]
) {
const tokenAction = new AddStatesAction(tokenStates);
const noteAction = new AddStatesAction(notes);
addActions([
{ type: "tokens", action: tokenAction },
{ type: "notes", action: noteAction },
]);
}
useEffect(() => {
async function handlePeerData({ id, data, reply }: PeerDataEvent) {
if (id === "assetRequest") {
@@ -407,6 +419,7 @@ function NetworkedMapAndTokens({ session }: { session: Session }) {
onMapTokenStateRemove={handleMapTokenStateRemove}
onSelectionItemsChange={handleSelectionItemsChange}
onSelectionItemsRemove={handleSelectionItemsRemove}
onSelectionItemsCreate={handleSelectionItemsCreate}
onMapChange={handleMapChange}
onMapReset={handleMapReset}
onMapDraw={handleMapDraw}