@geogirafe/lib-geoportal
Version:
GeoGirafe is a flexible application to build online geoportals.
14 lines (13 loc) • 451 B
JavaScript
/**
* Determines if a layer is visible based on its opacity and print resolution.
* @returns true if the layer is visible, otherwise false.
*/
export const isLayerVisible = (layer, printResolution) => {
if (layer.opacity === 0) {
return false;
}
if (printResolution === undefined) {
return true;
}
return printResolution >= (layer.minResolution ?? -1) && printResolution <= (layer.maxResolution ?? Infinity);
};