Use ol.math.clamp()
This commit is contained in:
@@ -2,12 +2,12 @@ goog.provide('ol.layer.Heatmap');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.math');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.layer.Vector');
|
||||
goog.require('ol.math');
|
||||
goog.require('ol.render.EventType');
|
||||
goog.require('ol.style.Icon');
|
||||
goog.require('ol.style.Style');
|
||||
@@ -111,8 +111,7 @@ ol.layer.Heatmap = function(opt_options) {
|
||||
goog.asserts.assert(this.circleImage_ !== undefined,
|
||||
'this.circleImage_ should be defined');
|
||||
var weight = weightFunction(feature);
|
||||
var opacity = weight !== undefined ?
|
||||
goog.math.clamp(weight, 0, 1) : 1;
|
||||
var opacity = weight !== undefined ? ol.math.clamp(weight, 0, 1) : 1;
|
||||
// cast to 8 bits
|
||||
var index = (255 * opacity) | 0;
|
||||
var style = this.styleCache_[index];
|
||||
|
||||
@@ -2,10 +2,10 @@ goog.provide('ol.layer.Base');
|
||||
goog.provide('ol.layer.LayerProperty');
|
||||
goog.provide('ol.layer.LayerState');
|
||||
|
||||
goog.require('goog.math');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.math');
|
||||
goog.require('ol.source.State');
|
||||
|
||||
|
||||
@@ -141,10 +141,10 @@ ol.layer.Base.prototype.getLayerState = function() {
|
||||
var minResolution = this.getMinResolution();
|
||||
return {
|
||||
layer: /** @type {ol.layer.Layer} */ (this),
|
||||
brightness: goog.math.clamp(brightness, -1, 1),
|
||||
brightness: ol.math.clamp(brightness, -1, 1),
|
||||
contrast: Math.max(contrast, 0),
|
||||
hue: hue,
|
||||
opacity: goog.math.clamp(opacity, 0, 1),
|
||||
opacity: ol.math.clamp(opacity, 0, 1),
|
||||
saturation: Math.max(saturation, 0),
|
||||
sourceState: sourceState,
|
||||
visible: visible,
|
||||
|
||||
@@ -4,7 +4,6 @@ goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('goog.math');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.CollectionEvent');
|
||||
@@ -13,6 +12,7 @@ goog.require('ol.Object');
|
||||
goog.require('ol.ObjectEventType');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.layer.Base');
|
||||
goog.require('ol.math');
|
||||
goog.require('ol.source.State');
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ ol.layer.Group.prototype.getLayerStatesArray = function(opt_states) {
|
||||
var i, ii, layerState;
|
||||
for (i = pos, ii = states.length; i < ii; i++) {
|
||||
layerState = states[i];
|
||||
layerState.brightness = goog.math.clamp(
|
||||
layerState.brightness = ol.math.clamp(
|
||||
layerState.brightness + ownLayerState.brightness, -1, 1);
|
||||
layerState.contrast *= ownLayerState.contrast;
|
||||
layerState.hue += ownLayerState.hue;
|
||||
|
||||
Reference in New Issue
Block a user