OpenLayers OpenLayers

Changeset 7713

Show
Ignore:
Timestamp:
08/08/08 08:34:59 (4 months ago)
Author:
fredj
Message:

keep the cursor style to 'move' if the cursor is above a feature. r=elemoine (closes #1673)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Control/DragFeature.js

    r6131 r7713  
    233233            // TBD replace with CSS classes 
    234234            this.map.div.style.cursor = "default"; 
     235        } else { 
     236            // the drag handler itself resetted the cursor, so 
     237            // set it back to "move" here 
     238            this.map.div.style.cursor = "move"; 
    235239        } 
    236240    }, 
  • trunk/openlayers/tests/Control/DragFeature.html

    r6719 r7713  
    165165         
    166166    } 
     167 
     168    function test_Control_DragFeature_up(t) { 
     169        t.plan(7); 
     170        var map = new OpenLayers.Map("map"); 
     171        var layer = new OpenLayers.Layer.Vector(); 
     172        map.addLayer(layer); 
     173        var control = new OpenLayers.Control.DragFeature(layer); 
     174        map.addControl(control); 
     175 
     176        control.activate(); 
     177 
     178        // simulate a mouseover on a feature 
     179        layer.getFeatureFromEvent = function(evt) { 
     180            return "foo"; 
     181        } 
     182        map.events.triggerEvent("mousemove", {type: "mousemove"}); 
     183        t.eq(control.over, true, 
     184            "mouseover on a feature sets the over property to true"); 
     185        t.eq(control.map.div.style.cursor, "move", 
     186            "mouseover on a feature sets the cursor to move"); 
     187        t.eq(control.handlers.drag.active, true, 
     188            "mouseover on a feature activates drag handler"); 
     189 
     190        // simulate a mouse-up on the map, with the mouse still 
     191        // over the dragged feature 
     192        control.handlers.drag.started = true; 
     193        map.events.triggerEvent("mouseup", {type: "mouseup"}); 
     194        t.eq(control.map.div.style.cursor, "move", 
     195            "mouseup while still over dragged feature does not reset cursor to default"); 
     196        t.eq(control.handlers.drag.active, true, 
     197            "mouseup while still over dragged feature does not deactivate drag handler"); 
     198 
     199        // simulate a mouse-up on the map, with the mouse out of 
     200        // the dragged feature 
     201        control.handlers.drag.started = true; 
     202        control.over = false; 
     203        map.events.triggerEvent("mouseup", {type: "mouseup"}); 
     204        t.eq(control.map.div.style.cursor, "default", 
     205            "mouseup resets cursor to default"); 
     206        t.eq(control.handlers.drag.active, false, 
     207            "mouseup deactivates drag handler"); 
     208 
     209        control.deactivate(); 
     210    } 
    167211     
    168212    function test_Control_DragFeature_done(t) {