Skip to content

Commit

Permalink
remove zoom dependant feature calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
zimmermannubique committed Jan 10, 2024
1 parent 58fca20 commit f1462cc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions shared/public/Value.h
Original file line number Diff line number Diff line change
Expand Up @@ -629,15 +629,15 @@ class Value {
template<class ResultType>
class ValueEvaluator {
public:
inline ResultType getResult(const std::shared_ptr<Value> &value, const EvaluationContext &context, const ResultType defaultValue) {
inline ResultType getResult(const std::shared_ptr<Value> &value, const EvaluationContext &context, const ResultType &defaultValue) {
std::lock_guard<std::mutex> lock(mutex);
if (!value) {
return defaultValue;
}
if (lastValuePtr != value.get()) {
lastResults.clear();
staticValue = std::nullopt;
const auto usedKeysCollection = value->getUsedKeys();
const auto &usedKeysCollection = value->getUsedKeys();
isStatic = usedKeysCollection.empty();
if (isStatic) {
staticValue = value->evaluateOr(context, defaultValue);
Expand All @@ -652,12 +652,12 @@ class ValueEvaluator {
return *staticValue;
}

if(isStateDependant && isZoomDependent && !context.featureStateManager->empty()) {
if((isStateDependant && !context.featureStateManager->empty()) || isZoomDependent) {
return value->evaluateOr(context, defaultValue);
}


auto identifier = (context.feature->identifier << 12) | (uint64_t)((isZoomDependent ? context.zoomLevel : 0.f) * 100);
auto identifier = context.feature->identifier;
if(isStateDependant && !context.featureStateManager->empty()) {
identifier = (context.feature->identifier << 32) | (uint64_t)(context.featureStateManager->getCurrentState());
}
Expand Down

0 comments on commit f1462cc

Please sign in to comment.