Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
return false;
}
iconRejected = !iconSpaceAvailable;
} else if (renderIcon && poiInfo!.isValid !== false) {
// Ensure that text elements still loading icons get a chance to be rendered if
// there's no text element updates in the next frames.
this.m_forceNewLabelsPass = true;
}
// Check if label should be rendered at this zoomLevel
const renderText =
hasText &&
(poiInfo === undefined ||
this.m_viewState.zoomLevel === undefined ||
MathUtils.isClamped(
this.m_viewState.zoomLevel,
poiInfo.iconMinZoomLevel,
poiInfo.iconMaxZoomLevel
));
// Check if we should render the label's text.
const doRenderText =
// Render if between min/max zoom level
renderText &&
// Do not render if the distance is too great and distance shouldn't be ignored.
(pointLabel.ignoreDistance === true ||
labelState.viewDistance === undefined ||
labelState.viewDistance < poiTextMaxDistance) &&
// Do not render text if POI cannot be rendered and is not optional.
(poiInfo === undefined || poiInfo.isValid === true || poiInfo.iconIsOptional !== false);
textScale *= distanceScaleFactor;
}
const distanceFadeFactor = this.getDistanceFadingFactor(
pointLabel,
labelState,
this.m_viewState.maxVisibilityDist
);
// Check if there is need to check for screen space for the label's icon.
const poiInfo = pointLabel.poiInfo;
let iconRejected = false;
// Check if icon should be rendered at this zoomLevel
const renderIcon =
poiInfo !== undefined &&
MathUtils.isClamped(
this.m_viewState.zoomLevel,
poiInfo.iconMinZoomLevel,
poiInfo.iconMaxZoomLevel
) &&
poiInfo!.isValid !== false;
const iconReady =
renderIcon && poiRenderer.prepareRender(pointLabel, this.m_viewState.zoomLevel);
if (iconReady) {
PoiRenderer.computeIconScreenBox(
poiInfo!,
tempPoiScreenPosition,
distanceScaleFactor,
this.m_viewState.zoomLevel,
tempBox2D
return { result: PrePlacementResult.Invisible, viewDistance };
}
// If a PoiTable is specified in the technique, the table is required to be
// loaded before the POI can be rendered.
if (!poiManager.updatePoiFromPoiTable(textElement)) {
// PoiTable has not been loaded, but is required to determine
// visibility.
return { result: PrePlacementResult.NotReady, viewDistance };
}
// Text element visibility and zoom level ranges must be checked after calling
// updatePoiFromPoiTable, since that function may change those values.
if (
!textElement.visible ||
!MathUtils.isClamped(
viewState.zoomLevel,
textElement.minZoomLevel,
textElement.maxZoomLevel
)
) {
return { result: PrePlacementResult.Invisible, viewDistance };
}
viewDistance =
maxViewDistance === undefined
? computeViewDistance(viewState.worldCenter, textElement)
: checkViewDistance(
viewState.worldCenter,
textElement,
projectionType,
viewCamera,