Merge pull request #1913 from fredj/heatmap-clamp
Optimize opacity clamping
This commit is contained in:
@@ -69,7 +69,7 @@ ol.layer.Heatmap = function(opt_options) {
|
|||||||
|
|
||||||
this.setStyle(function(feature, resolution) {
|
this.setStyle(function(feature, resolution) {
|
||||||
var weight = weightFunction(feature);
|
var weight = weightFunction(feature);
|
||||||
var opacity = goog.math.clamp(goog.isDef(weight) ? weight : 1, 0, 1);
|
var opacity = goog.isDef(weight) ? goog.math.clamp(weight, 0, 1) : 1;
|
||||||
// cast to 8 bits
|
// cast to 8 bits
|
||||||
var index = (255 * opacity) | 0;
|
var index = (255 * opacity) | 0;
|
||||||
var style = styleCache[index];
|
var style = styleCache[index];
|
||||||
|
|||||||
Reference in New Issue
Block a user