src/translate.js
function getFunctionFromDefaultAndShaderValue(sceneDrawGroup, ccssProperty, defaultValue, shaderValue) {
    if (referenceCSS[ccssProperty].type === 'color') {
        defaultValue = `'${color.normalize(defaultValue, tangramReference)}'`;
    }
    var fn = `var _value=${defaultValue};`;
    shaderValue.js.forEach(function (code) {
        if (code.search(/data\['mapnik::\S+'\]/) >= 0) {
            throw new Error('mapnik selector present in the CartoCSS');
        }
        fn += code;
    });
    if (referenceCSS[ccssProperty].type === 'color') {
        fn += getColorOverrideCode(sceneDrawGroup, ccssProperty.indexOf('fill') >= 0);
    }
    if (ccssProperty === 'line-width') {
        fn += '_value=_value*$meters_per_pixel;';
    }
    fn += 'return _value;';
    return wrapFn(fn);
}
function getFunctionFromDefaultAndShaderValue(sceneDrawGroup, ccssProperty, defaultValue, shaderValue) {
    if (referenceCSS[ccssProperty].type === 'color') {
        defaultValue = `'${color.normalize(defaultValue, tangramReference)}'`;
    }
    var fn = `var _value=${defaultValue};`;
    shaderValue.js.forEach(function (code) {
        if (code.search(/data\['mapnik::\S+'\]/) >= 0) {
            throw new Error('mapnik selector present in the CartoCSS');
        }
        fn += code;
    });
    if (referenceCSS[ccssProperty].type === 'color') {
        fn += getColorOverrideCode(sceneDrawGroup, ccssProperty.indexOf('fill') >= 0);
    }
    if (ccssProperty === 'line-width') {
        fn += '_value=_value*$meters_per_pixel;';
    }
    fn += 'return _value;';
    return wrapFn(fn);
}
function getFunctionFromDefaultAndShaderValue ( sceneDrawGroup , ccssProperty , defaultValue , shaderValue ) { if ( referenceCSS [ ccssProperty ] . type === 'color' ) { defaultValue = ` ${ color . normalize ( defaultValue , tangramReference ) } ` ; } var fn = ` ${ defaultValue } ` ; shaderValue . js . forEach ( function ( code ) { if ( code . search ( / data\['mapnik::\S+'\] / ) >= 0 ) { throw new Error ( 'mapnik selector present in the CartoCSS' ) ; } fn += code ; } ) ; if ( referenceCSS [ ccssProperty ] . type === 'color' ) { fn += getColorOverrideCode ( sceneDrawGroup , ccssProperty . indexOf ( 'fill' ) >= 0 ) ; } if ( ccssProperty === 'line-width' ) { fn += '_value=_value*$meters_per_pixel;' ; } fn += 'return _value;' ; return wrapFn ( fn ) ; }
Returns a function string that sets the value to the default one and then executes the shader value code
Returns a function string that sets the value to the default one and then executes the shader value code