diff --git a/src/Models/ThemeConfig/DependencyCalculator.ts b/src/Models/ThemeConfig/DependencyCalculator.ts index 1379917b15..ccdd801b4c 100644 --- a/src/Models/ThemeConfig/DependencyCalculator.ts +++ b/src/Models/ThemeConfig/DependencyCalculator.ts @@ -108,29 +108,31 @@ export default class DependencyCalculator { } let currentKey = undefined let currentLine = undefined + const detectNearyFeatures = (layerId) => { + if (layerId === "*") { + // This is a wildcard + return [] + } + + // The important line: steal the dependencies! + deps.push({ + neededLayer: layerId, + reason: "a calculated tag loads features from this layer", + context: + "calculatedTag[" + + currentLine + + "] which calculates the value for " + + currentKey, + neededBy: layer.id, + checkHasSnapName: false + }) + + return [] + } const params: ExtraFuncParams = { getFeatureById: () => undefined, - getFeaturesWithin: (layerId) => { - if (layerId === "*") { - // This is a wildcard - return [] - } - - // The important line: steal the dependencies! - deps.push({ - neededLayer: layerId, - reason: "a calculated tag loads features from this layer", - context: - "calculatedTag[" + - currentLine + - "] which calculates the value for " + - currentKey, - neededBy: layer.id, - checkHasSnapName: false, - }) - - return [] - }, + getFeaturesWithin: detectNearyFeatures, + getProbablyOverlapsWith: detectNearyFeatures } const helpers = ExtraFunctions.constructHelpers(params) // ... Run the calculated tag code, which will trigger the getFeaturesWithin above...