Skip to content

Commit

Permalink
Merge pull request #5648 from AnalyticalGraphicsInc/label-height-refe…
Browse files Browse the repository at this point in the history
…rence

Clear clamp to ground callback for label glyphs
  • Loading branch information
bagnell authored Jul 19, 2017
2 parents c6d302f + 8fb7df9 commit bc3abf4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
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');

0 comments on commit bc3abf4

Please sign in to comment.