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

Fix polyline update and removal bookkeeping #6455

Merged
merged 9 commits into from
Apr 20, 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 @@ -21,6 +21,7 @@ Change Log
* Fix Firefox WebGL console warnings. [#5912](https://github.com/AnalyticalGraphicsInc/cesium/issues/5912)
* Fix parsing Cesium.js in older browsers that do not support all TypedArray types. [#6396](https://github.com/AnalyticalGraphicsInc/cesium/pull/6396)
* Fix flicker when adding, removing, or modifying entities. [#3945](https://github.com/AnalyticalGraphicsInc/cesium/issues/3945)
* Fixed crash bug in PolylineCollection when a polyline was updated and removed at the same time. [#6455](https://github.com/AnalyticalGraphicsInc/cesium/pull/6455)
* Fixed Imagery Layers Texture Filters Sandcastle example. [#6472](https://github.com/AnalyticalGraphicsInc/cesium/pull/6472).

### 1.44 - 2018-04-02
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Stephen Wiseman](https://github.com/srwiseman)
* [Gabriel Macario](https://github.com/gabriel-macario)
* [Jonathan Puckey](https://github.com/puckey)
* [Mark Erikson](https://github.com/markerikson)
6 changes: 6 additions & 0 deletions Source/Scene/PolylineCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ define([
PolylineCollection.prototype.remove = function(polyline) {
if (this.contains(polyline)) {
this._polylines[polyline._index] = undefined; // Removed later

var polylineUpdateIndex = this._polylinesToUpdate.indexOf(polyline);
if (polylineUpdateIndex !== -1) {
this._polylinesToUpdate.splice(polylineUpdateIndex, 1);
}

this._polylinesRemoved = true;
this._createVertexArray = true;
this._createBatchTable = true;
Expand Down
14 changes: 14 additions & 0 deletions Specs/Scene/PolylineCollectionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,20 @@ defineSuite([
expect(polylines.length).toEqual(0);
});

it('removes a polyline from the updated list when removed', function() {
var firstPolyline = polylines.add();
var secondPolyline = polylines.add();

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

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