@@ -172,11 +172,12 @@ export default function StampPreview({
172172 bottomPx : number ;
173173 } | null > ( null ) ;
174174 useEffect ( ( ) => {
175- const itemStyle = style . item as any ;
175+ const itemStyle = style . item ;
176176 if ( ! itemStyle || containerSize . width <= 0 || containerSize . height <= 0 )
177177 return ;
178178
179- const parse = ( v : any ) => parseFloat ( String ( v ) . replace ( "px" , "" ) ) || 0 ;
179+ const parse = ( v : string | number | undefined ) =>
180+ parseFloat ( String ( v ) . replace ( "px" , "" ) ) || 0 ;
180181 const leftPx = parse ( itemStyle . left ) ;
181182 const bottomPx = parse ( itemStyle . bottom ) ;
182183 const widthPx = parse ( itemStyle . width ) ;
@@ -208,8 +209,8 @@ export default function StampPreview({
208209 const newLeftPts = Math . max ( 0 , Math . min ( maxLeftPx , newLeftPx ) ) / scaleX ;
209210 const newBottomPts =
210211 Math . max ( 0 , Math . min ( maxBottomPx , newBottomPx ) ) / scaleY ;
211- onParameterChange ( "overrideX" , newLeftPts as any ) ;
212- onParameterChange ( "overrideY" , newBottomPts as any ) ;
212+ onParameterChange ( "overrideX" , newLeftPts ) ;
213+ onParameterChange ( "overrideY" , newBottomPts ) ;
213214 }
214215
215216 prevDimsRef . current = {
@@ -249,7 +250,7 @@ export default function StampPreview({
249250 if ( pageWidth <= 0 || pageHeight <= 0 ) return ;
250251
251252 // Recompute current x,y from style (so that we start from visual position)
252- const itemStyle = style . item as any ;
253+ const itemStyle = style . item ;
253254 const leftPx = parseFloat ( String ( itemStyle . left ) . replace ( "px" , "" ) ) || 0 ;
254255 const bottomPx =
255256 parseFloat ( String ( itemStyle . bottom ) . replace ( "px" , "" ) ) || 0 ;
@@ -265,11 +266,11 @@ export default function StampPreview({
265266 const maxBottomPx = Math . max ( 0 , pageHeight - heightPx ) ;
266267 onParameterChange (
267268 "overrideX" ,
268- ( Math . max ( 0 , Math . min ( maxLeftPx , leftPx ) ) / scaleX ) as any ,
269+ Math . max ( 0 , Math . min ( maxLeftPx , leftPx ) ) / scaleX ,
269270 ) ;
270271 onParameterChange (
271272 "overrideY" ,
272- ( Math . max ( 0 , Math . min ( maxBottomPx , bottomPx ) ) / scaleY ) as any ,
273+ Math . max ( 0 , Math . min ( maxBottomPx , bottomPx ) ) / scaleY ,
273274 ) ;
274275 }
275276 } ;
@@ -281,7 +282,7 @@ export default function StampPreview({
281282 e . preventDefault ( ) ;
282283 ensureOverrides ( ) ;
283284
284- const item = style . item as any ;
285+ const item = style . item ;
285286 const left = parseFloat ( String ( item . left ) . replace ( "px" , "" ) ) || 0 ;
286287 const bottom = parseFloat ( String ( item . bottom ) . replace ( "px" , "" ) ) || 0 ;
287288 const width =
@@ -336,8 +337,8 @@ export default function StampPreview({
336337 const scaleY = containerSize . height / heightPts ;
337338 const newLeftPts = newLeftPx / scaleX ;
338339 const newBottomPts = newBottomPx / scaleY ;
339- onParameterChange ( "overrideX" , newLeftPts as any ) ;
340- onParameterChange ( "overrideY" , newBottomPts as any ) ;
340+ onParameterChange ( "overrideX" , newLeftPts ) ;
341+ onParameterChange ( "overrideY" , newBottomPts ) ;
341342 }
342343
343344 if ( drag . type === "resize" ) {
@@ -346,13 +347,13 @@ export default function StampPreview({
346347 const scaleY = containerSize . height / heightPts ;
347348 const newHeightPx = Math . max ( 1 , drag . initHeight + ( y - drag . startY ) ) ;
348349 const newHeightPts = newHeightPx / scaleY ;
349- onParameterChange ( "fontSize" , newHeightPts as any ) ;
350+ onParameterChange ( "fontSize" , newHeightPts ) ;
350351 }
351352
352353 if ( drag . type === "rotate" ) {
353354 const angle =
354355 Math . atan2 ( y - drag . centerY , x - drag . centerX ) * ( 180 / Math . PI ) ;
355- onParameterChange ( "rotation" , angle as any ) ;
356+ onParameterChange ( "rotation" , angle ) ;
356357 }
357358 } ;
358359
@@ -441,9 +442,12 @@ export default function StampPreview({
441442 className = { `${ styles . gridTile } ${ selected || hoverTile === idx ? styles . gridTileSelected : "" } ${ hoverTile === idx ? styles . gridTileHovered : "" } ` }
442443 onClick = { ( ) => {
443444 // Clear overrides to use grid positioning and set position
444- onParameterChange ( "overrideX" , - 1 as any ) ;
445- onParameterChange ( "overrideY" , - 1 as any ) ;
446- onParameterChange ( "position" , idx as any ) ;
445+ onParameterChange ( "overrideX" , - 1 ) ;
446+ onParameterChange ( "overrideY" , - 1 ) ;
447+ onParameterChange (
448+ "position" ,
449+ idx as AddStampParameters [ "position" ] ,
450+ ) ;
447451 } }
448452 onMouseEnter = { ( ) => setHoverTile ( idx ) }
449453 onMouseLeave = { ( ) => setHoverTile ( null ) }
0 commit comments