adds shortcut for anchoring
This commit is contained in:
@@ -47,7 +47,7 @@ export const Scene = () => {
|
||||
const room = useStore((state) => state.liveblocks.room);
|
||||
const self = useStore((state) => state.self);
|
||||
|
||||
// useAnchorShorcuts(anchorX, anchorZ, set);
|
||||
useAnchorShorcuts();
|
||||
|
||||
const addBrick = (e) => {
|
||||
e.stopPropagation();
|
||||
|
||||
+9
-5
@@ -1,20 +1,24 @@
|
||||
import useKeyboardShortcut from "use-keyboard-shortcut";
|
||||
import { useStore } from "../store";
|
||||
|
||||
export const useAnchorShorcuts = () => {
|
||||
const setAnchorX = useStore((state) => state.setAnchorX);
|
||||
const setAnchorZ = useStore((state) => state.setAnchorZ);
|
||||
|
||||
export const useAnchorShorcuts = (anchorX, anchorZ, set) => {
|
||||
const anchorXPlus = () => {
|
||||
set({ anchorX: anchorX + 1 });
|
||||
setAnchorX(useStore.getState().anchorX + 1);
|
||||
};
|
||||
|
||||
const anchorXMinus = () => {
|
||||
set({ anchorX: anchorX - 1 });
|
||||
setAnchorX(useStore.getState().anchorX - 1);
|
||||
};
|
||||
|
||||
const anchorZPlus = () => {
|
||||
set({ anchorZ: anchorZ - 1 });
|
||||
setAnchorZ(useStore.getState().anchorZ + 1);
|
||||
};
|
||||
|
||||
const anchorZMinus = () => {
|
||||
set({ anchorZ: anchorZ + 1 });
|
||||
setAnchorZ(useStore.getState().anchorZ - 1);
|
||||
};
|
||||
|
||||
useKeyboardShortcut(["D"], anchorXPlus, {
|
||||
|
||||
Reference in New Issue
Block a user