OpenLayers OpenLayers

Ticket #1378: allowSelection.patch

File allowSelection.patch, 1.5 kB (added by crschmidt, 9 months ago)
  • theme/default/style.css

    old new  
    229229    opacity: 0.50; 
    230230    font-size: 1px; 
    231231    filter: alpha(opacity=50); 
    232 }     
     232}    
     233 
     234.olControlNoSelect  { 
     235  -moz-user-select: none;  
     236}  
     237 
  • lib/OpenLayers/Control.js

    old new  
    7979    type: null,  
    8080 
    8181    /**  
     82     * Property: allowSelection 
     83     * {Boolean} By deafault, controls do not allow selection, because 
     84     * it may interfere with map dragging. If this is true, OpenLayers 
     85     * will not prevent selection of the control. 
     86     * Default is false. 
     87     */ 
     88    allowSelection: false,   
     89 
     90    /**  
    8291     * Property: displayClass  
    8392     * {string}  This property is used for CSS related to the drawing of the 
    8493     * Control.  
     
    240249        if (this.div == null) { 
    241250            this.div = OpenLayers.Util.createDiv(this.id); 
    242251            this.div.className = this.displayClass; 
     252            if (!this.allowSelection) { 
     253                this.div.className += " olControlNoSelect"; 
     254                this.div.setAttribute("unselectable", "on", 0); 
     255                this.div.onselectstart = function() { return(false); };  
     256            }     
    243257            if (this.title != "") { 
    244258                this.div.title = this.title; 
    245259            }