Skip to content

Commit

Permalink
issue planetfederal#230 - IE8 fix for generating random color for WFS…
Browse files Browse the repository at this point in the history
… layers
  • Loading branch information
justb4 committed Aug 12, 2014
1 parent 4c33f16 commit b44ff58
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/script/plugins/WFSSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,11 @@ gxp.plugins.WFSSource = Ext.extend(gxp.plugins.LayerSource, {
return keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);
}

// Generate a random color (thanks to Mark Prins)
var colour = '#' + ('000000' + Math.round(0xffffff * Math.random()).toString(16)).substr(-6);
// Generate a random color (thanks to Mark Prins) - not working in IE8...
// var colour = '#' + Math.round(0xffffff * Math.random()).toString(16);

// better (IE compat): http://www.paulirish.com/2009/random-hex-color-code-snippets/
var colour = '#'+('00000'+(Math.random()*(1<<24)|0).toString(16)).slice(-6);

// Save color in record to generate StyleMap later
record.data.colour = colour;
Expand Down

0 comments on commit b44ff58

Please sign in to comment.