/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the Clear BSD
 * license.  See http://svn.openlayers.org/trunk/openlayers/license.txt for the
 * full text of the license. */

/**
 * @requires OpenLayers/Control.js
 * @requires OpenLayers/Handler/Click.js
 *
 * Class: OpenLayers.Control.ZoomOut
 *
 * Inherits from:
 *  - <OpenLayers.Control>
 */
OpenLayers.Control.ZoomOut = OpenLayers.Class(OpenLayers.Control, {
    /**
     * Property: type
     * {OpenLayers.Control.TYPE}
     */
    type: OpenLayers.Control.TYPE_TOOL,

    /**
     * Method: draw
     */    
    draw: function() {
        this.handler = new OpenLayers.Handler.Click( this, 
                            {"click": this.zoomOut}, {keyMask: this.keyMask} );
    },

    /**
     * Method: zoomOut
     *
     * Parameters:
     * evt - {<Click Event>}
     */
    zoomOut: function (evt) {
        var position = evt.xy;
        this.map.setCenter(this.map.getLonLatFromPixel(position),
                           this.map.getZoom() - 1);
    },

    CLASS_NAME: "OpenLayers.Control.ZoomOut"
});
