Skip to content

Commit

Permalink
Require endGroupIndex, endVertexIndex; fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Anand Thakker committed Jul 5, 2016
1 parent d6167ef commit a556c97
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
5 changes: 2 additions & 3 deletions js/data/bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ Bucket.prototype.populatePaintArrays = function(interfaceName, globalProperties,
for (var l = 0; l < this.childLayers.length; l++) {
var layer = this.childLayers[l];
var groups = this.arrayGroups[interfaceName];
endGroupIndex = endGroupIndex || (groups.length - 1);

for (var g = startGroupIndex; g <= endGroupIndex; g++) {
var group = groups[g];
Expand All @@ -358,7 +357,7 @@ Bucket.prototype.populatePaintArrays = function(interfaceName, globalProperties,
vertexArray.resize(length);

var start = g === startGroupIndex ? startVertexIndex : 0;
var end = (endVertexIndex && g === endGroupIndex) ? endVertexIndex : length - 1;
var end = g === endGroupIndex ? endVertexIndex : length - 1;

var attributes = this.paintAttributes[interfaceName][layer.id].attributes;
for (var m = 0; m < attributes.length; m++) {
Expand All @@ -368,7 +367,7 @@ Bucket.prototype.populatePaintArrays = function(interfaceName, globalProperties,
var multiplier = attribute.multiplier || 1;
var components = attribute.components || 1;

for (var i = start; i < end; i++) {
for (var i = start; i <= end; i++) {
var vertex = vertexArray.get(i);
for (var c = 0; c < components; c++) {
var memberName = components > 1 ? (attribute.name + c) : attribute.name;
Expand Down
5 changes: 4 additions & 1 deletion js/data/bucket/circle_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,8 @@ CircleBucket.prototype.addFeature = function(feature) {
}
}

this.populatePaintArrays('circle', globalProperties, feature.properties, startGroup.index, startIndex);
var endGroupIndex = this.arrayGroups['circle'].length - 1;
var endVertexIndex = this.arrayGroups['circle'][endGroupIndex].layout.vertex.length - 1;

this.populatePaintArrays('circle', globalProperties, feature.properties, startGroup.index, startIndex, this.arrayGroups.length - 1, endGroupIndex, endVertexIndex);
};
2 changes: 1 addition & 1 deletion js/data/bucket/fill_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ FillBucket.prototype.addFeature = function(feature) {
indexes.endVertex = this.arrayGroups['fill'][endGroupIndex].layout.vertex.length - 1;
this._featureIndexToArrayIndex[feature.index] = indexes;

this.populatePaintArrays('fill', {zoom: this.zoom}, feature.properties, startGroup.index, startVertex);
this.populatePaintArrays('fill', {zoom: this.zoom}, feature.properties, indexes.startGroup, indexes.startVertex, indexes.endGroup, indexes.endVertex);
};

FillBucket.prototype.addPolygon = function(polygon) {
Expand Down
2 changes: 1 addition & 1 deletion test/js/data/bucket.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test('Bucket', function(t) {
group.layout.vertex.emplaceBack(point.x * 2, point.y * 2);
group.layout.element.emplaceBack(1, 2, 3);
group.layout.element2.emplaceBack(point.x, point.y);
this.populatePaintArrays('test', {}, feature.properties, group, startIndex);
this.populatePaintArrays('test', {}, feature.properties, group.index, startIndex, group.index, group.layout.vertex.length - 1);
};

return Class;
Expand Down

0 comments on commit a556c97

Please sign in to comment.