Skip to content

Commit 3f678ca

Browse files
committed
Revert "Reduces redundant clamping on labels"
This reverts commit 83eb415.
1 parent f99c570 commit 3f678ca

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- Improved performance and reduced memory usage of `Event` class. [#12896](https://github.com/CesiumGS/cesium/pull/12896)
1313
- Fixes vertical misalignment of glyphs in labels with small fonts [#8474](https://github.com/CesiumGS/cesium/issues/8474)
1414
- Prevent runtime errors for certain forms of invalid PNTS files [#12872](https://github.com/CesiumGS/cesium/issues/12872)
15+
- Improved performance of clamped labels [#12905](https://github.com/CesiumGS/cesium/pull/12905)
1516

1617
#### Additions :tada:
1718

packages/engine/Source/Scene/LabelCollection.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import bitmapSDF from "bitmap-sdf";
1111
import BillboardCollection from "./BillboardCollection.js";
1212
import BillboardTexture from "./BillboardTexture.js";
1313
import BlendOption from "./BlendOption.js";
14-
import HeightReference, { isHeightReferenceClamp } from "./HeightReference.js";
14+
import { isHeightReferenceClamp } from "./HeightReference.js";
1515
import HorizontalOrigin from "./HorizontalOrigin.js";
1616
import Label from "./Label.js";
1717
import LabelStyle from "./LabelStyle.js";
@@ -307,8 +307,7 @@ function rebindAllGlyphs(labelCollection, label) {
307307
billboard.pixelOffset = label._pixelOffset;
308308
billboard.horizontalOrigin = HorizontalOrigin.LEFT;
309309
billboard.verticalOrigin = label._verticalOrigin;
310-
// To avoid excessive height update listeners, glyphs are not clamped. Their height values are updated manually by the owning label.
311-
billboard.heightReference = HeightReference.NONE;
310+
billboard.heightReference = label._heightReference;
312311
billboard.scale = label.totalScale;
313312
billboard.pickPrimitive = label;
314313
billboard.id = label._id;

packages/engine/Specs/Scene/LabelCollectionSpec.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,8 +2446,6 @@ describe("Scene/LabelCollection", function () {
24462446
});
24472447

24482448
expect(l._clampedPosition).toBeDefined();
2449-
// Glyphs are not truly clamped (to avoid excessive listeners and globe picks). They simply copy their owning label's clamped position.
2450-
expect(l._glyphs[0].billboard._clampedPosition).toBeUndefined();
24512449

24522450
l.heightReference = HeightReference.NONE;
24532451
expect(l._clampedPosition).toBeUndefined();
@@ -2459,8 +2457,8 @@ describe("Scene/LabelCollection", function () {
24592457
heightReference: HeightReference.CLAMP_TO_GROUND,
24602458
text: "t",
24612459
position: Cartesian3.fromDegrees(-72.0, 40.0),
2460+
showBackground: true,
24622461
});
2463-
l.showBackground = true;
24642462

24652463
await pollToPromise(() => {
24662464
scene.renderForSpecs();

0 commit comments

Comments
 (0)