OpenLayers OpenLayers

Ticket #1378: allowSelection.2.patch

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

    old new  
    240240  background: url("../../img/close.gif") no-repeat; 
    241241  cursor: pointer; 
    242242} 
     243 
     244.olControlNoSelect { 
     245 -moz-user-select: none; 
     246} 
  • 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            } 
  • lib/OpenLayers/Control/OverviewMap.js

    old new  
    204204        // Optionally add min/max buttons if the control will go in the 
    205205        // map viewport. 
    206206        if(!this.outsideViewport) { 
    207             this.div.className = this.displayClass + 'Container'; 
     207            this.div.className += " " + this.displayClass + 'Container'; 
    208208            var imgLocation = OpenLayers.Util.getImagesLocation(); 
    209209            // maximize button div 
    210210            var img = imgLocation + 'layer-switcher-maximize.png'; 
  • lib/OpenLayers/Control/MousePosition.js

    old new  
    9191        if (!this.element) { 
    9292            this.div.left = ""; 
    9393            this.div.top = ""; 
    94             this.div.className = this.displayClass; 
    9594            this.element = this.div; 
    9695        } 
    9796         
  • lib/OpenLayers/Control/Permalink.js

    old new  
    109109        OpenLayers.Control.prototype.draw.apply(this, arguments); 
    110110           
    111111        if (!this.element) { 
    112             this.div.className = this.displayClass; 
    113112            this.element = document.createElement("a"); 
    114113            this.element.innerHTML = OpenLayers.i18n("permalink"); 
    115114            this.element.href=""; 
  • lib/OpenLayers/Control/Scale.js

    old new  
    4343        OpenLayers.Control.prototype.draw.apply(this, arguments); 
    4444        if (!this.element) { 
    4545            this.element = document.createElement("div"); 
    46             this.div.className = this.displayClass; 
    4746            this.div.appendChild(this.element); 
    4847        } 
    4948        this.map.events.register( 'moveend', this, this.updateScale); 
  • lib/OpenLayers/Control/ScaleLine.js

    old new  
    8181    draw: function() { 
    8282        OpenLayers.Control.prototype.draw.apply(this, arguments); 
    8383        if (!this.eTop) { 
    84             this.div.className = this.displayClass; 
    8584            this.div.style.display = "block"; 
    8685            this.div.style.position = "absolute"; 
    8786