Skip to content

Commit

Permalink
Merge pull request #125 from CartoDB/ramp-fix
Browse files Browse the repository at this point in the history
Ramp fixes
  • Loading branch information
David M authored Mar 1, 2018
2 parents b0f5d63 + 45c8886 commit 16f29bc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/client/windshaft.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ export default class Windshaft {
}

_getCategoryIDFromString(category) {
if (this._categoryStringToIDMap[category]) {
if (this._categoryStringToIDMap[category] !== undefined) {
return this._categoryStringToIDMap[category];
}
this._numCategories++;
this._categoryStringToIDMap[category] = this._numCategories;
return this._numCategories;
this._numCategories++;
return this._categoryStringToIDMap[category];
}

_instantiate(MNS, resolution, filtering) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class Renderer {


getStyledTiles() {
return this.dataframes.filter(tile => tile.style && tile.visible);
return this.dataframes.filter(tile => tile.style && tile.visible && tile.style.colorShader);
}


Expand Down
2 changes: 1 addition & 1 deletion src/core/style/expressions/buckets.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export default class Buckets extends Expression {
this.bucketUID = bucketUID++;
this.numCategories = args.length + 1;
this.args = args;
this.othersBucket = false;
}
_compile(metadata) {
super._compile(metadata);
this.type = 'category';
this.othersBucket = this.input.type == 'category';
this.args.map(breakpoint => {
if (breakpoint.type != this.input.type) {
throw new Error('Buckets() argument types mismatch');
Expand Down
2 changes: 1 addition & 1 deletion src/core/style/expressions/ramp.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default class Ramp extends Expression {
const srcType = gl.UNSIGNED_BYTE;
const pixel = new Uint8Array(4 * width);
const colors = this._getColorsFromPalette(this.input, this.palette);

// console.log(this.input.numCategories, this.input.othersBucket, colors, this);
for (var i = 0; i < width; i++) {
const vlowRaw = colors[Math.floor(i / width * (colors.length - 1))];
const vhighRaw = colors[Math.ceil(i / width * (colors.length - 1))];
Expand Down

0 comments on commit 16f29bc

Please sign in to comment.