Toward natural JavaScript syntax

This commit is contained in:
Tim Schaub
2015-09-25 12:16:42 -06:00
parent d610b206f7
commit 0927c55b3c
40 changed files with 146 additions and 188 deletions
+5 -6
View File
@@ -59,8 +59,7 @@ ol.layer.Heatmap = function(opt_options) {
* @private
* @type {number}
*/
this.shadow_ = ol.isDef(options.shadow) ?
/** @type {number} */ (options.shadow) : 250;
this.shadow_ = options.shadow !== undefined ? options.shadow : 250;
/**
* @private
@@ -81,10 +80,10 @@ ol.layer.Heatmap = function(opt_options) {
this.setGradient(options.gradient ?
options.gradient : ol.layer.Heatmap.DEFAULT_GRADIENT);
this.setBlur(ol.isDef(options.blur) ?
this.setBlur(options.blur !== undefined ?
/** @type {number} */ (options.blur) : 15);
this.setRadius(ol.isDef(options.radius) ?
this.setRadius(options.radius !== undefined ?
/** @type {number} */ (options.radius) : 8);
goog.events.listen(this, [
@@ -112,8 +111,8 @@ ol.layer.Heatmap = function(opt_options) {
goog.asserts.assert(this.circleImage_ !== undefined,
'this.circleImage_ should be defined');
var weight = weightFunction(feature);
var opacity = ol.isDef(weight) ?
goog.math.clamp(/** @type {number} */ (weight), 0, 1) : 1;
var opacity = weight !== undefined ?
goog.math.clamp(weight, 0, 1) : 1;
// cast to 8 bits
var index = (255 * opacity) | 0;
var style = this.styleCache_[index];