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

Clear clamp to ground callback for label glyphs #5648

Merged
merged 2 commits into from
Jul 19, 2017
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 @@ -20,6 +20,7 @@ Change Log
* Fixed label positioning when height reference changes [#5609](https://github.com/AnalyticalGraphicsInc/cesium/issues/5609)
* Fixed crash when using the `Cesium3DTilesInspectorViewModel` and removing a tileset [#5607](https://github.com/AnalyticalGraphicsInc/cesium/issues/5607)
* Fixed polygon outline in Polygon Sandcastle demo [#5642](https://github.com/AnalyticalGraphicsInc/cesium/issues/5642)
* Fixed label positioning when using `HeightReference.CLAMP_TO_GROUND` and no position [#5648](https://github.com/AnalyticalGraphicsInc/cesium/pull/5648)

### 1.35.2 - 2017-07-11

Expand Down
4 changes: 4 additions & 0 deletions Source/Scene/LabelCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ define([
if (defined(billboard)) {
billboard.show = false;
billboard.image = undefined;
if (defined(billboard._removeCallbackFunc)) {
billboard._removeCallbackFunc();
billboard._removeCallbackFunc = undefined;
}
labelCollection._spareBillboards.push(billboard);
glyph.billboard = undefined;
}
Expand Down
17 changes: 17 additions & 0 deletions Specs/Scene/LabelCollectionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2227,6 +2227,23 @@ defineSuite([
expect(l._clampedPosition).toBeUndefined();
expect(l._glyphs[0].billboard._clampedPosition).toBeUndefined();
});

it('clears the billboard height reference callback when the label is removed', function() {
scene.globe = createGlobe();
spyOn(scene.camera, 'update');
var l = labelsWithHeight.add({
heightReference : HeightReference.CLAMP_TO_GROUND,
text: 't',
position : Cartesian3.fromDegrees(-72.0, 40.0)
});
scene.renderForSpecs();
var billboard = l._glyphs[0].billboard;
expect(billboard._removeCallbackFunc).toBeDefined();
var spy = spyOn(billboard, '_removeCallbackFunc');
labelsWithHeight.remove(l);
expect(spy).toHaveBeenCalled();
expect(labelsWithHeight._spareBillboards[0]._removeCallbackFunc).not.toBeDefined();
});
});

}, 'WebGL');