Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't add polyline to update list twice #7155

Merged
merged 5 commits into from
Oct 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Change Log

##### Fixes :wrench:
* Fixed an issue where `pickPosition` would return incorrect results when called after `sampleHeight` or `clampToHeight`. [#7113](https://github.com/AnalyticalGraphicsInc/cesium/pull/7113)
* Fixed crash when updating polyline attributes twice in one frame [#7155](https://github.com/AnalyticalGraphicsInc/cesium/pull/7155)
* Fixed a crash when using `BingMapsGeocoderService` [#7143](https://github.com/AnalyticalGraphicsInc/cesium/issues/7143)

### 1.50 - 2018-10-01
Expand Down
4 changes: 3 additions & 1 deletion Source/Scene/PolylineCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,9 @@ define([

PolylineCollection.prototype._updatePolyline = function(polyline, propertyChanged) {
this._polylinesUpdated = true;
this._polylinesToUpdate.push(polyline);
if (!polyline._dirty) {
this._polylinesToUpdate.push(polyline);
}
++this._propertiesChanged[propertyChanged];
};

Expand Down
15 changes: 15 additions & 0 deletions Specs/Scene/PolylineCollectionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,21 @@ defineSuite([
expect(polylines._polylinesToUpdate.length).toEqual(1);
});

it('only adds polyline to the update list once', function() {
var firstPolyline = polylines.add();
var secondPolyline = polylines.add();

firstPolyline.width = 4;
secondPolyline.width = 5;
secondPolyline.width = 7;

expect(polylines._polylinesToUpdate.length).toEqual(2);

polylines.remove(secondPolyline);

expect(polylines._polylinesToUpdate.length).toEqual(1);
});

it('can check if it contains a polyline', function() {
var polyline = polylines.add();

Expand Down