#include <generators/fracGen.hh> #include <utils/safeJsonParse.hh> using ty::util::castJsonValues; namespace ty::gen { fracGen::fracGen(const int& w, const int& h) : baseGen(w, h) { } fracGen::~fracGen() { } void fracGen::loadJson(const json& j) { for (const auto& v : settings) { castJsonValues(j, v.first, v.second); } } pair<double, double> fracGen::scaleRange() { double nRange = range / zoomFactor; if (width >= height) { return {nRange * static_cast<double>(width) / static_cast<double>(height), nRange}; } return {nRange, nRange * static_cast<double>(height) / static_cast<double>(width)}; } } // ty::gen