From 72da8cae81509123b10a4c80c3f387503d55cd62 Mon Sep 17 00:00:00 2001 From: hpinkos Date: Tue, 18 Jul 2017 15:31:01 -0400 Subject: [PATCH 1/2] clear clamp to ground callback --- Source/Scene/LabelCollection.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Scene/LabelCollection.js b/Source/Scene/LabelCollection.js index c93803a6c255..efb9f4fd11b0 100644 --- a/Source/Scene/LabelCollection.js +++ b/Source/Scene/LabelCollection.js @@ -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; } From 8fb7df9859b287c5bd927ea229652c114b8f9687 Mon Sep 17 00:00:00 2001 From: hpinkos Date: Tue, 18 Jul 2017 15:42:47 -0400 Subject: [PATCH 2/2] specs, CHANGES.md --- CHANGES.md | 1 + Specs/Scene/LabelCollectionSpec.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index e06889b90fa6..547dfc0ca0b5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/Specs/Scene/LabelCollectionSpec.js b/Specs/Scene/LabelCollectionSpec.js index 01d0a0e9f67e..2f999ca1ea9d 100644 --- a/Specs/Scene/LabelCollectionSpec.js +++ b/Specs/Scene/LabelCollectionSpec.js @@ -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');