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

PrimitiveCollection.removeAll removes guid #7491

Merged
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 @@ -26,6 +26,7 @@ Change Log
* Fixed image size issue when using multiple particle systems. [#7412](https://github.com/AnalyticalGraphicsInc/cesium/pull/7412)
* Fixed Sandcastle's "Open in New Window" button not displaying imagery due to blob URI limitations. [#7250](https://github.com/AnalyticalGraphicsInc/cesium/pull/7250)
* Fixed an issue where setting `scene.globe.cartographicLimitRectangle` to `undefined` would cause a crash. [#7477](https://github.com/AnalyticalGraphicsInc/cesium/issues/7477)
* Fixed `PrimitiveCollection.removeAll` to no longer `contain` removed primitives. [#7491](https://github.com/AnalyticalGraphicsInc/cesium/pull/7491)

### 1.53 - 2019-01-02

Expand Down
9 changes: 5 additions & 4 deletions Source/Scene/PrimitiveCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,11 @@ define([
* @see PrimitiveCollection#destroyPrimitives
*/
PrimitiveCollection.prototype.removeAll = function() {
if (this.destroyPrimitives) {
var primitives = this._primitives;
var length = primitives.length;
for ( var i = 0; i < length; ++i) {
var primitives = this._primitives;
var length = primitives.length;
for ( var i = 0; i < length; ++i) {
delete primitives[i]._external._composites[this._guid];
if (this.destroyPrimitives) {
primitives[i].destroy();
}
}
Expand Down
16 changes: 16 additions & 0 deletions Specs/Scene/PrimitiveCollectionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,22 @@ defineSuite([
expect(primitives.contains(labels1)).toEqual(false);
});

it('does not contain removed primitive', function() {
var labels0 = createLabels();
primitives.add(labels0);
primitives.remove(labels0);

expect(primitives.contains(labels0)).toEqual(false);
});

it('does not contain all removed primitives', function() {
var labels0 = createLabels();
primitives.add(labels0);
primitives.removeAll();

expect(primitives.contains(labels0)).toEqual(false);
});

it('does not contain undefined', function() {
expect(primitives.contains()).toEqual(false);
});
Expand Down