OpenLayers OpenLayers

Changeset 6998

Show
Ignore:
Timestamp:
04/23/08 06:46:39 (9 months ago)
Author:
bartvde
Message:

changes for handler cursors

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/bartvde/cursor/examples/cursor.html

    r6992 r6998  
    7373                new OpenLayers.Control.ZoomBox({title:"Zoom out box", displayClass: 'olControlZoomOutBox', out: true, cursor: 'url(../theme/default/img/zoomout.cur),auto'}), 
    7474                new OpenLayers.Control.DragPan( 
    75                     {title:'Drag map', cursor: 'move'}) 
     75                    {title:'Drag map', cursor: 'url(../theme/default/img/pan.cur),auto', handlerOptions: {cursors: {mousedown: 'url(../theme/default/img/pandown.cur),auto', mouseup: 'url(../theme/default/img/pan.cur),auto' } }}) 
    7676            ]); 
    7777            map.addControl(panel); 
  • sandbox/bartvde/cursor/lib/OpenLayers/Control/DragPan.js

    r6833 r6998  
    3636    draw: function() { 
    3737        this.handler = new OpenLayers.Handler.Drag(this, 
    38                             {"move": this.panMap, "done": this.panMapDone}); 
     38                            {"move": this.panMap, "done": this.panMapDone},  
     39                            this.handlerOptions); 
    3940    }, 
    4041 
  • sandbox/bartvde/cursor/lib/OpenLayers/Handler.js

    r5614 r6998  
    4545 
    4646    /** 
     47     * APIProperty: cursors 
     48     * {Array} an array specifying the mouse cursors to use on the map div  
     49    */ 
     50    cursors: null, 
     51 
     52    /** 
    4753     * Property: map 
    4854     * {<OpenLayers.Map>} 
     
    222228        this.map.events.unregister(name, this, this.setEvent); 
    223229    }, 
     230 
     231    /** 
     232     * Method: setCursor 
     233     * Set the mouse cursor on the map div 
     234     * 
     235     * Parameters: 
     236     * functionName - {String} the name of the function (e.g. mousedown) 
     237    */ 
     238    setCursor: function(functionName) { 
     239        if (this.cursors && this.cursors[functionName]) { 
     240            this.map.div.style.cursor = this.cursors[functionName]; 
     241        } 
     242    }, 
    224243     
    225244    /** 
  • sandbox/bartvde/cursor/lib/OpenLayers/Handler/Drag.js

    r6992 r6998  
    155155     */ 
    156156    mousedown: function (evt) { 
     157        this.setCursor('mousedown'); 
    157158        var propagate = true; 
    158159        this.dragging = false; 
     
    216217     */ 
    217218    mouseup: function (evt) { 
     219        this.setCursor('mouseup'); 
    218220        if (this.started) { 
    219221            var dragged = (this.start != this.last);