Skip to content

Breaking the browser!!!๐Ÿ”จ๐Ÿ”ซ๐Ÿœ

Notifications You must be signed in to change notification settings

song-ku-hae-hyeon/BTB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

58 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Breaking The Browser (BTB)

How to Use

WIP

Download

WIP

How to Develop

WIP

Setting

WIP

Add Tool

  1. public ํด๋”์— 64px ์˜ png ์ด๋ฏธ์ง€๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
  • ํ•„์ˆ˜: ๋…๋ฐ” ์ด๋ฏธ์ง€
  • ์˜ต์…˜: ์ปค์„œ ์ด๋ฏธ์ง€
  • ์˜ต์…˜: ๋งˆํฌ ์ด๋ฏธ์ง€
  1. static/IMAGE.ts ์—์„œ ๊ธฐ์กด ์ฝ”๋“œ๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ์ด๋ฏธ์ง€ Url์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

  2. ํˆด ํƒ€์ž…์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

// types/tool
export type ToolType = 'none' | 'highlighter' | ... | 'newTool'
  1. ๊ฐ ์ด๋ฏธ์ง€๋ฅผ ํ•„์š”ํ•œ๊ณณ์— ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
  • ContentWrapper.styled.ts ์—์„œ ์ปค์„œ ์ด๋ฏธ์ง€๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
  • IconButton.styled.ts ์—์„œ ๋…๋ฐ” ์•„์ด์ฝ˜์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
  1. 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 ๋“ฑ์˜ ์ปค์Šคํ…€ ํ›…์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
  1. 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>
  );
};
  1. ContentApp ์— ๋งŒ๋“  ์ปดํฌ๋„ŒํŠธ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

About

Breaking the browser!!!๐Ÿ”จ๐Ÿ”ซ๐Ÿœ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •