@@ -162,20 +162,6 @@ const Tag = (props: TagProps) => {
162162 return "" ;
163163 } ;
164164
165- //ref๋ผ๋ฆฌ ๊ฒน์น๋ ์์ญ ๊ณ์ฐ
166- const getOverlapArea = ( rect1 : DOMRect , rect2 : DOMRect ) => {
167- const x_overlap = Math . max (
168- 0 ,
169- Math . min ( rect1 . right , rect2 . right ) - Math . max ( rect1 . left , rect2 . left )
170- ) ;
171- const y_overlap = Math . max (
172- 0 ,
173- Math . min ( rect1 . bottom , rect2 . bottom ) - Math . max ( rect1 . top , rect2 . top )
174- ) ;
175- const overlapArea = x_overlap * y_overlap ;
176- return overlapArea ;
177- } ;
178-
179165 //๋ชจ๋ฐ์ผ ํฐ์น ๋๋๊ทธ
180166 const handleTouchStart = ( e : React . TouchEvent < HTMLDivElement > ) => {
181167 if ( tagType === "letter" ) {
@@ -185,13 +171,7 @@ const Tag = (props: TagProps) => {
185171 e . stopPropagation ( ) ;
186172 console . log ( "ํฐ์น ์์" ) ;
187173 const touch = e . touches [ 0 ] ;
188- //setStartPosition({ x: touch.clientX, y: touch.clientY });
189- // ์ปจํ
์ด๋์ ์ด๊ธฐ ์์น๋ฅผ ๊ฐ์ ธ์ ์์ ์์น์ ๋ฐ์
190- const container = e . currentTarget . getBoundingClientRect ( ) ;
191- setStartPosition ( {
192- x : touch . clientX - container . left ,
193- y : touch . clientY - container . top ,
194- } ) ;
174+ setStartPosition ( { x : touch . clientX , y : touch . clientY } ) ;
195175
196176 e . currentTarget . addEventListener ( "touchmove" , handleTouchMove , {
197177 passive : false ,
@@ -206,9 +186,13 @@ const Tag = (props: TagProps) => {
206186 console . log ( "ํฐ์น ์์ง์" ) ;
207187 if ( startPosition ) {
208188 const touch = e . touches [ 0 ] ;
209- const deltaX = touch . clientX - startPosition . x ;
189+ console . log ( startPosition . x ) ;
190+ const deltaX = touch . clientX - 60 ;
210191 const deltaY = touch . clientY - startPosition . y ;
211- setTranslate ( { x : deltaX , y : deltaY } ) ;
192+ setTranslate ( {
193+ x : touch . clientX - startPosition . x ,
194+ y : touch . clientY - startPosition . y ,
195+ } ) ;
212196
213197 if ( tagRef . current ) {
214198 tagRef . current . style . zIndex = "999999" ;
0 commit comments