WIP
WIP
WIP
WIP
- public ν΄λμ 64px μ png μ΄λ―Έμ§λ₯Ό μΆκ°ν©λλ€.
- νμ: λ λ° μ΄λ―Έμ§
- μ΅μ : 컀μ μ΄λ―Έμ§
- μ΅μ : λ§ν¬ μ΄λ―Έμ§
-
static/IMAGE.ts μμ κΈ°μ‘΄ μ½λλ₯Ό μ°Έκ³ νμ¬ μ΄λ―Έμ§ Urlμ μΆκ°ν©λλ€.
-
ν΄ νμ μ μΆκ°ν©λλ€.
// types/tool
export type ToolType = 'none' | 'highlighter' | ... | 'newTool'
- κ° μ΄λ―Έμ§λ₯Ό νμνκ³³μ μΆκ°ν©λλ€.
- ContentWrapper.styled.ts μμ 컀μ μ΄λ―Έμ§λ₯Ό μΆκ°ν©λλ€.
- IconButton.styled.ts μμ λ λ° μμ΄μ½μ μΆκ°ν©λλ€.
- Konva Layer μ»΄ν¬λνΈλ₯Ό μμ±ν©λλ€.
const MyNewTool = ({ stageRef }: MyNewToolProps) => {
const layerRef = useRef<Konva.Layer>(null);
const { ants, killIfInRange } = useAntKiller(MARK_SIZE, MARK_SIZE);
const { shakeBrowser } = useShake();
const callbackFunc = (clientX: number, clientY: number, offset: number) => {
// ...
shakeBrowser(100);
killIfInRange(clientX - offset / 2, clientY);
};
useTurn({ stageRef, layerRef, callback: callbackFunc, offset }); // or useMove
return <Layer ref={layerRef}>...</Layer>;
};
export default MyNewTool;
- νμμ λ°λΌ
useAntKiller
,useShake
,useTurn
,useMove
λ±μ 컀μ€ν ν μ μ¬μ©ν©λλ€.
- DockBarμ μλ‘μ΄ μμ΄μ½μ λ±λ‘ν©λλ€.
const DockBar = ({ selectTool }: DockBarProps) => {
const onClickBtn = (tool: ToolType) => selectTool(tool);
return (
<S.DockBarWrapper>
<IconButton icon="highlighter" onClickBtn={() => onClickBtn('highlighter')} />
///
<IconButton icon="newTool" onClickBtn={() => onClickBtn('newTool')} />
</S.DockBarWrapper>
);
};
- ContentApp μ λ§λ μ»΄ν¬λνΈλ₯Ό μΆκ°ν©λλ€.