OpenLayers OpenLayers

Ticket #967: patch-967-A0.diff

File patch-967-A0.diff, 1.7 kB (added by elemoine, 1 year ago)

setCenter noEvent patch

  • lib/OpenLayers/Map.js

    old new  
    10281028     * Parameters: 
    10291029     * lonlat - {<OpenLayers.LonLat>} 
    10301030     * zoom - {Integer} 
    1031      * dragging - {Boolean} Specifies whether or not to trigger  
    1032      *                      movestart/end events 
     1031     * dragging - {Boolean} Specifies whether the map is being dragged 
    10331032     * forceZoomChange - {Boolean} Specifies whether or not to trigger zoom  
    10341033     *                             change events (needed on baseLayer change) 
     1034     * noEvent - {Boolean} prevent movestart/end evens 
    10351035     * 
    10361036     * TBD: reconsider forceZoomChange in 3.0 
    10371037     */ 
    1038     setCenter: function (lonlat, zoom, dragging, forceZoomChange) { 
     1038    setCenter: function (lonlat, zoom, dragging, forceZoomChange, noEvent) { 
    10391039         
    10401040        if (!this.center && !this.isValidLonLat(lonlat)) { 
    10411041            lonlat = this.maxExtent.getCenterLonLat(); 
     
    10521052        // if neither center nor zoom will change, no need to do anything 
    10531053        if (zoomChanged || centerChanged || !dragging) { 
    10541054 
    1055             if (!dragging) { this.events.triggerEvent("movestart"); } 
     1055            if (!dragging && !noEvent) { 
     1056                this.events.triggerEvent("movestart"); 
     1057            } 
    10561058 
    10571059            if (centerChanged) { 
    10581060                if ((!zoomChanged) && (this.center)) {  
     
    11201122        } 
    11211123 
    11221124        // even if nothing was done, we want to notify of this 
    1123         if (!dragging) { this.events.triggerEvent("moveend"); } 
     1125        if (!dragging & !noEvent) { 
     1126            this.events.triggerEvent("moveend"); 
     1127        } 
    11241128    }, 
    11251129 
    11261130    /**