OpenLayers OpenLayers

Changeset 6727

Show
Ignore:
Timestamp:
03/31/08 01:55:12 (5 months ago)
Author:
crschmidt
Message:

Add 'allowSelection' option to controls, to determine whether they allow
selection. Use CSS ClassName in FF, and onselectstart attribute in IE, to
control selection. Fix inappropriate overriding of className in some Control
subclasses in order to let this work. Prevents accidental selection of controls
in IE and FF. r=euzuro. (Closes #1378)

Files:

Legend:

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

    r6718 r6727  
    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 
     
    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; 
  • trunk/openlayers/lib/OpenLayers/Control/MousePosition.js

    r5906 r6727  
    9292            this.div.left = ""; 
    9393            this.div.top = ""; 
    94             this.div.className = this.displayClass; 
    9594            this.element = this.div; 
    9695        } 
  • trunk/openlayers/lib/OpenLayers/Control/OverviewMap.js

    r6330 r6727  
    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 
  • trunk/openlayers/lib/OpenLayers/Control/Permalink.js

    r6313 r6727  
    110110           
    111111        if (!this.element) { 
    112             this.div.className = this.displayClass; 
    113112            this.element = document.createElement("a"); 
    114113            this.element.innerHTML = OpenLayers.i18n("permalink"); 
  • trunk/openlayers/lib/OpenLayers/Control/Scale.js

    r6313 r6727  
    4444        if (!this.element) { 
    4545            this.element = document.createElement("div"); 
    46             this.div.className = this.displayClass; 
    4746            this.div.appendChild(this.element); 
    4847        } 
  • trunk/openlayers/lib/OpenLayers/Control/ScaleLine.js

    r6557 r6727  
    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"; 
  • trunk/openlayers/theme/default/style.css

    r6718 r6727  
    241241  cursor: pointer; 
    242242} 
     243 
     244.olControlNoSelect { 
     245 -moz-user-select: none; 
     246}