From e7f8b64570ece5551e81d33b61e74282c29f2fd6 Mon Sep 17 00:00:00 2001 From: mahmoud adel <58145645+mahmoudadel54@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:01:26 +0200 Subject: [PATCH] #10711: Control loading FontAwesome for vector style (#10715) * #10711: Control loading FontAwsome for vector style Description: - add boolean cfg called 'loadFontAwesomeForIcons' for Map plugin to control the loading fontAwesome for vector style - add jsdocs in plugin/Map - handle the control of loading fontAwesome for openlayers, leaflet and cesium * #10711: enhance drawIcons if there are icons in data and loadFontAwesomeForIcons = true --> it will load fontAwesome and if there is no icons ---> it won't load * #10711: using cfg loadFontAwesomeForIcons in root in localConfig instead of map plugin and revert other changes * #10711: remove unused console.log in StylePArserUtils --- web/client/utils/styleparser/StyleParserUtils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/client/utils/styleparser/StyleParserUtils.js b/web/client/utils/styleparser/StyleParserUtils.js index b6f4d96334..498173598e 100644 --- a/web/client/utils/styleparser/StyleParserUtils.js +++ b/web/client/utils/styleparser/StyleParserUtils.js @@ -39,6 +39,7 @@ import isNil from 'lodash/isNil'; import isObject from 'lodash/isObject'; import MarkerUtils from '../MarkerUtils'; import {randomInt} from '../RandomUtils'; +import { getConfigProp } from '../ConfigUtils'; export const isGeoStylerBooleanFunction = (got) => [ @@ -917,7 +918,10 @@ export const drawIcons = (geoStylerStyle, options) => { }, []); const marks = symbolizers.filter(({ kind }) => kind === 'Mark'); const icons = symbolizers.filter(({ kind }) => kind === 'Icon'); - return loadFontAwesome() + const loadFontAwesomeForIcons = getConfigProp("loadFontAwesomeForIcons"); + // if undefined or true it will load it to preserve previous behaviour + const loadingPromise = (isNil(loadFontAwesomeForIcons) || loadFontAwesomeForIcons) && icons?.length ? loadFontAwesome() : Promise.resolve(); + return loadingPromise .then( () => new Promise((resolve) => { if (marks.length > 0 || icons.length > 0) {