Delete gameobject's inside margin

hi everybody…
I need your help soon… i have a container (panel) and inside there is an image, this can zoom and pan,

i want delete space inside between image and container when i dragged the image…

help me …!!

Hi… sorry my english :smiley: … so i have a image into app for IPAD, this will show all screen, i can drag this image and zooming, but when i will drag this image generated a margin and when i drop image this will return initial state. do how i make this?

Here is some code to get you started. It uses the mouse, and you’ll have to use touch events. Plus it does not check to see that the hit is over the object.

using UnityEngine;
using System.Collections;

public class DragAndSnap2 : MonoBehaviour {
	private float fSpeed = 2.0f;
	private Vector3 v3OrgPos;
	private Vector3 v3Delta;
	private bool bSnapToPosition = true;

	void Start () {
		v3OrgPos = transform.position;
	}
	
	void Update () {
		if (Input.GetMouseButtonDown(0)){
			v3Delta = Input.mousePosition;
			v3Delta.z = Mathf.Abs (transform.position.z - Camera.main.transform.position.z);
			v3Delta = transform.position - Camera.main.ScreenToWorldPoint(v3Delta);
			bSnapToPosition = false;			
		}
		else if (Input.GetMouseButton(0)){
			Vector3 v3Pos = Input.mousePosition;
			v3Pos.z = Mathf.Abs (transform.position.z - Camera.main.transform.position.z);
			v3Pos = Camera.main.ScreenToWorldPoint(v3Pos);
			transform.position = v3Pos + v3Delta;			
		}
		else if (Input.GetMouseButtonUp(0))
			bSnapToPosition = true;	
	
		
		if (bSnapToPosition)
			transform.position = Vector3.Lerp (transform.position, v3OrgPos, fSpeed * Time.deltaTime );
	}
}