Skip to content

Commit

Permalink
Merge pull request #3169 from AnalyticalGraphicsInc/undefined-parent
Browse files Browse the repository at this point in the history
All Entity.parent to be set to undefined.
  • Loading branch information
pjcozzi committed Nov 5, 2015
2 parents bb288a0 + 4dd9b3d commit ee68e6b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Change Log
* Fixed an issue where the sun texture is not generated correctly on some mobile devices. [#3141](https://github.com/AnalyticalGraphicsInc/cesium/issues/3141)
* Fixed a bug in the deprecated `jsonp` that prevented it from returning a promise. Its replacement, `loadJsonp`, was unaffected.
* Fixed glTF implementation to read the version as a string as per the specification and to correctly handle backwards compatibility for axis-angle rotations in glTF 0.8 models.
* Fixed a bug that caused setting `Entity.parent` to `undefined` to throw an exception. [#3169](https://github.com/AnalyticalGraphicsInc/cesium/issues/3169)
* Added `Model.maximumScale` and `ModelGraphics.maximumScale` properties, giving an upper limit for minimumPixelSize.
* Entities have a reference to their entity collection.
* Entity collections have a reference to their owner (usually a data source, but can be a `CompositeEntityCollection`).
Expand Down
4 changes: 3 additions & 1 deletion Source/DataSources/Entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ define([
}

this._parent = value;
value._children.push(this);
if (defined(value)) {
value._children.push(this);
}

var isShowing = this.isShowing;

Expand Down
17 changes: 17 additions & 0 deletions Specs/DataSources/EntitySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,4 +462,21 @@ defineSuite([
expect(entity.show).toBe(true);
expect(entity.isShowing).toBe(false);
});

it('isShowing works when removing parent.', function() {
var entity = new Entity();
entity.parent = new Entity({
show : false
});
expect(entity.isShowing).toBe(false);

var listener = jasmine.createSpy('listener');
entity.definitionChanged.addEventListener(listener);

entity.parent = undefined;

expect(listener.calls.count()).toBe(2);
expect(listener.calls.argsFor(0)).toEqual([entity, 'isShowing', true, false]);
expect(entity.isShowing).toBe(true);
});
});

0 comments on commit ee68e6b

Please sign in to comment.