Apply the scaling functions to different variables

This commit is contained in:
Stuart Lynn 2015-09-09 10:38:17 -04:00
parent 266919ad1b
commit b24b4b0db9

View File

@ -57,7 +57,7 @@ var Filters = require('./torque_filters');
this.TILE_SIZE = 256;
this._style = null;
this._gradients = {};
this._forcePoints = false;
}
@ -139,6 +139,18 @@ var Filters = require('./torque_filters');
var st = shader.getStyle({
value: value
}, shaderVars);
var processingVars = {}
for(var key in shaderVars){ processingVars[key]= shaderVars[key]}
processingVars.value = value
var varsToProcess = ['marker-width', 'marker-fill-opacity', 'marker-fill', 'marker-stroke']
varsToProcess.forEach(function(key){
if(st[key]){
st[key] = this.processScaleFunction(st[key], processingVars)
}
}.bind(this))
if(this._style === null || this._style !== st){
this._style = st;
}
@ -189,7 +201,7 @@ var Filters = require('./torque_filters');
i.src = canvas.toDataURL();
return i;
}
return canvas;
},
@ -217,7 +229,7 @@ var Filters = require('./torque_filters');
}
}
}
prof.end(true);
return callback && callback(null);
@ -261,7 +273,7 @@ var Filters = require('./torque_filters');
},
//
// renders a tile in the canvas for key defined in
// renders a tile in the canvas for key defined in
// the torque tile
//
_renderTile: function(tile, key, frame_offset, sprites, shader, shaderVars) {
@ -298,7 +310,7 @@ var Filters = require('./torque_filters');
}
}
}
prof.end(true);
},
@ -449,7 +461,7 @@ var Filters = require('./torque_filters');
}
gradient = {};
var colorize = this._style['image-filters'].args;
var increment = 1/colorize.length;
for (var i = 0; i < colorize.length; i++){
var key = increment * i + increment;