Skip to content

Commit

Permalink
fix(Label): Multiple labels with same textContent
Browse files Browse the repository at this point in the history
  • Loading branch information
ftoromanoff committed Jan 15, 2025
1 parent 11d10ea commit a2cfd3a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Renderer/Label2DRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,15 @@ class Label2DRenderer {
if (!frustum.containsPoint(worldPosition.applyMatrix4(camera.matrixWorldInverse)) ||
// Check if globe horizon culls the label
// Do some horizon culling (if possible) if the tiles level is small enough.
label.horizonCullingPoint && GlobeLayer.horizonCulling(label.horizonCullingPoint) ||
// Check if content isn't present in visible labels
this.grid.visible.some((l) => {
// TODO for icon without text filter by position
const textContent = label.content.textContent;
return textContent !== '' && l.content.textContent.toLowerCase() == textContent.toLowerCase();
})) {
label.horizonCullingPoint && GlobeLayer.horizonCulling(label.horizonCullingPoint)
// Why do we might need this part ?
// || // Check if content isn't present in visible labels
// this.grid.visible.some((l) => {
// // TODO for icon without text filter by position
// const textContent = label.content.textContent;
// return textContent !== '' && l.content.textContent.toLowerCase() == textContent.toLowerCase();
// })
) {
label.visible = false;
} else {
// projecting world position label
Expand Down

0 comments on commit a2cfd3a

Please # to comment.