I'm building a simple map application, where users can click
on the map and drag it around. Pretty basic idea. The map is an
extended Canvas, nested inside of a parent container which is also
a Canvas. When someone clicks on the map, I call startDrag, and on
release I stop it. Still pretty basic. The problem I'm having is
that whenever a user clicks on the map, they can sometimes drag the
map right outside of the parent container. I'm not sure how to fix
this, is it a bug? Or am I missing something?
I've put together a simple example of what I'm talking about.
If you click on the red square and drag it, I want that to
stay in the white square. It makes sense to me that it should be
default, but you can drag the red square out of its parent. Notice
when you release it goes back into its parent, and you see
scrollbars to its position.