OpenLayers OpenLayers

Ticket #1498: 1498-r6810-B0.patch

File 1498-r6810-B0.patch, 2.6 kB (added by ahocevar, 9 months ago)

more verbose ND comments, tests pass.

  • lib/OpenLayers/StyleMap.js

    old new  
    2222    /** 
    2323     * Property: extendDefault 
    2424     * {Boolean} if true, every render intent will extend the symbolizers 
    25      * specified for the "default" intent. Otherwise, every rendering intent 
    26      * is treated as a completely independent symbolizer. 
     25     * specified for the "default" intent at rendering time. Otherwise, every 
     26     * rendering intent will be treated as a completely independent style. 
     27     * Default is true. 
    2728     */ 
    2829    extendDefault: true, 
    2930     
     
    3334     * Parameters: 
    3435     * style   - {Object} Optional. Either a style hash, or a style object, or 
    3536     *           a hash of style objects (style hashes) keyed by rendering 
    36      *           intent 
     37     *           intent. If only a style hash or a style object is passed, the 
     38     *           select and temporary intents will inherit all symbolizer 
     39     *           properties except fillColor and strokeColor from the default 
     40     *           intent, if <extendDefault> is set to true (which it is by 
     41     *           default). With the <extendDefault> property set to true, it 
     42     *           is also possible to define a rich style object for the 
     43     *           default intent, and just slim symbolizer hashes with a few 
     44     *           properties that should override the default intent's 
     45     *           symbolizer for other intents. 
    3746     * options - {Object} optional hash of additional options for this 
    3847     *           instance 
    3948     */ 
    4049    initialize: function (style, options) { 
     50        var defaultStyle = OpenLayers.Feature.Vector.style; 
    4151        this.styles = { 
    42             "default": new OpenLayers.Style( 
    43                 OpenLayers.Feature.Vector.style["default"]), 
    44             "select": new OpenLayers.Style( 
    45                 OpenLayers.Feature.Vector.style["select"]), 
    46             "temporary": new OpenLayers.Style( 
    47                 OpenLayers.Feature.Vector.style["temporary"]) 
     52            "default": new OpenLayers.Style(defaultStyle["default"]), 
     53            "select": new OpenLayers.Style({ 
     54                fillColor: defaultStyle["select"].fillColor, 
     55                strokeColor: defaultStyle["select"].strokeColor}), 
     56            "temporary": new OpenLayers.Style({ 
     57                fillColor: defaultStyle["temporary"].fillColor, 
     58                strokeColor: defaultStyle["temporary"].strokeColor}) 
    4859        }; 
    4960         
    5061        // take whatever the user passed as style parameter and convert it