export function relativePointerPosition(pointer,dx,dy,scaleX,scaleY,speed,width,height){ const clamp=(value,min,max)=>Math.min(max,Math.max(min,value)) return { x:clamp(pointer.x+dx*scaleX*speed,0,Math.max(0,width-1)), y:clamp(pointer.y+dy*scaleY*speed,0,Math.max(0,height-1)), } }