# Dragging within the boundary of a smaller clip

**URL:** <https://forum.kirupa.com/t/dragging-within-the-boundary-of-a-smaller-clip/285416>\
**Category:** Uncategorized\
**Created:** [March 31, 2009, 3:38pm UTC](https://forum.kirupa.com/t/dragging-within-the-boundary-of-a-smaller-clip/285416 "2009-03-31T15:38:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yankeedoodles](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/yankeedoodles/32/812_2.png) [@yankeedoodles](https://forum.kirupa.com/u/yankeedoodles)\
**Post date:** [March 31, 2009, 3:38pm UTC](https://forum.kirupa.com/t/dragging-within-the-boundary-of-a-smaller-clip/285416/1 "2009-03-31T15:38:53Z")

</div>

Good evening everyone,  
I have a simple yet mind boggling problem on my hands,  
simply put I have a large MC (with its registration point in the center, i need it there), and it sits in a smaller stage (think of it like as if you were panning a map thru a viewer, like google maps) but i need a set of boundaries to prevent it from going haywire. Now i have tried a couple of methods ie

```auto

if ((boxer.x-boxer.width/2)<0) {
        boxer.x=mouseX-offX;
    }
    if ((boxer.y-boxer.height/2)<0) {
       boxer.y=mouseY-offY;
   }

```

The above just manages to stop it but once it reaches that point the drag stops totally.  
They are included in the file i have attached.  
I would really appreciate it if someone could guide me on this.

Thanks so much in advance
