In addition to my comment, here is an example using map bounds as boundaries.
The bounds are defined to the map bounds when the map first loads:
bounds = map.getBounds();
Then in the marker dragend
event, I check whether the new location falls within the defined bounds, and if not, revert the marker to the last saved position:
google.maps.event.addListener(marker, 'dragend', function () {
var position = marker.getPosition();
bounds.contains(position) ? lastPosition = position : marker.setPosition(lastPosition);
});
You can check the below example for a live example (zoom out and drag the marker outside of the original map bounds).
JSFiddle demo