camera panning

hi, i am using this code for camera panning

	if (Input.GetMouseButton(2)) { 
        transform.rotation = cam.rotation; 
        transform.Translate(Vector3.right * -Input.GetAxis("Mouse X") * moveSpeed); 
        transform.Translate(transform.up * -Input.GetAxis("Mouse Y") * moveSpeed, Space.World); 
    }

so if the middle button is pressed then i can pan up or down. now i want to make easy for people on notebooks to use the panning by moving mouse at the edge of the screen. it works for up and down because no matter how you rotate camera one can use position.y+=0.1 to do the panning. it gets harder for left and right because if you rotate the camera around the object it isnt relly panning any more if i use position.x+=0.1

so i would like to use Input.GetAxis if possible when mouse goes near edge of the screen for left and right panning. does this makes any sense?

thanks!

A picture might help as I dont fully understand what you’re asking.

i managed to get this done by using this piece of code:

 mover.transform.Translate(transform.up*Time.deltaTime,Space.World);

so transform.up is always up no matter if you tilted the camera while if i translate with Vector(0,1,0) this will be bound to y axis.