Camera Stop when mouse is not moving

So, i did a script for the camera to follow my crosshair around (Im doing a topdown shooter) and I sorta want the effect of the camera following the crosshair as it moves just like in enter the gungeon, everything is right and i did a script for the camera to follow the crosshair but, even when my mouse is not moving, the camera keeps going forward, or better said, transforming to where its positioned to. I want the camera to stop moving if my mouse isnt moving, AND i also want to but a border so that you cant go that far enough so the player doesnt get out of the picture, so like a border that follows the player around, any help appreciated thanks.

Script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public classCameraCrosshair : MonoBehaviour
{

public Transformcrosshair;
private bool mouseismoving = false;

voidStart()
{
    mouseismoving=false;
}


voidUpdate()
{

     if   (mouseismoving=true)
     {
       transform.position=newVector3(crosshair.position.x,crosshair.position.y,transform.position.z);
      }

   }

}

Please, use the proper tags when you post your scripts: Using code tags properly - Unity Engine - Unity Discussions