meta: clamp nominalSize

This commit is contained in:
Vaxry 2024-12-21 20:00:02 +00:00
parent 84203d8126
commit abc1c60eb5

View file

@ -4,6 +4,7 @@
#include <toml++/toml.hpp>
#include <filesystem>
#include <regex>
#include <algorithm>
#include "VarList.hpp"
@ -154,7 +155,7 @@ std::optional<std::string> CMeta::parseHL() {
parsedData.hotspotX = std::any_cast<Hyprlang::FLOAT>(meta->getConfigValue("hotspot_x"));
parsedData.hotspotY = std::any_cast<Hyprlang::FLOAT>(meta->getConfigValue("hotspot_y"));
parsedData.nominalSize = std::any_cast<Hyprlang::FLOAT>(meta->getConfigValue("nominal_size"));
parsedData.nominalSize = std::clamp(std::any_cast<Hyprlang::FLOAT>(meta->getConfigValue("nominal_size")), 0.1F, 2.F);
parsedData.resizeAlgo = std::any_cast<Hyprlang::STRING>(meta->getConfigValue("resize_algorithm"));
return {};
@ -166,7 +167,7 @@ std::optional<std::string> CMeta::parseTOML() {
parsedData.hotspotX = MANIFEST["General"]["hotspot_x"].value_or(0.f);
parsedData.hotspotY = MANIFEST["General"]["hotspot_y"].value_or(0.f);
parsedData.hotspotY = MANIFEST["General"]["nominal_size"].value_or(1.f);
parsedData.nominalSize = std::clamp(MANIFEST["General"]["nominal_size"].value_or(1.F), 0.1F, 2.F);
const std::string OVERRIDES = MANIFEST["General"]["define_override"].value_or("");
const std::string SIZES = MANIFEST["General"]["define_size"].value_or("");