Skip to content

Commit

Permalink
add smooth_map_scaling to settings.json
Browse files Browse the repository at this point in the history
  • Loading branch information
black-sliver committed Jan 6, 2024
1 parent 058f91a commit ff1aba7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions doc/PACKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Configures behavior of the pack.

{
"smooth_scaling": true|false|null, // configure the image scaling method. null = default = currently crisp
"smooth_map_scaling": true|false|null, // configure the image scaling method for maps. null = default = smooth
}

Currently **not** user overridable.
Expand Down
11 changes: 7 additions & 4 deletions src/ui/trackerview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Item* TrackerView::makeItem(int x, int y, int width, int height, const ::BaseIte

Item *w = new Item(x,y,width,height,_fontStore->getFont(DEFAULT_FONT_NAME,
FontStore::sizeFromData(DEFAULT_FONT_SIZE, item->getOverlayFontSize())));
w->setQuality(_defaultQuality);
w->setQuality(_defaultItemQuality);
size_t stages = item->getStageCount();
bool disabled = item->getAllowDisabled();
bool stagedWithDisabled = item->getStageCount() && disabled;
Expand Down Expand Up @@ -218,7 +218,10 @@ TrackerView::TrackerView(int x, int y, int w, int h, Tracker* tracker, const std
const auto& settings = pack->getSettings();
auto itScaling = settings.find("smooth_scaling");
if (itScaling != settings.end() && itScaling.value().is_boolean())
_defaultQuality = itScaling.value() ? 2 : 0;
_defaultItemQuality = itScaling.value() ? 2 : 0;
itScaling = settings.find("smooth_map_scaling");
if (itScaling != settings.end() && itScaling.value().is_boolean())
_defaultMapQuality = itScaling.value() ? 2 : 0;
}
_tracker->onLayoutChanged += {this, [this](void *s, const std::string& layout) {
updateLayout(layout);
Expand Down Expand Up @@ -715,7 +718,7 @@ bool TrackerView::addLayoutNode(Container* container, const LayoutNode& node, si
w->setHideClearedLocations(_hideClearedLocations);
w->setHideUnreachableLocations(_hideUnreachableLocations);
_maps[mapname].push_back(w);
w->setQuality(2);
w->setQuality(_defaultMapQuality);
if (!node.getBackground().empty()) w->setBackground(node.getBackground());
w->setGrow(1,1);
w->setMinSize({200,200});
Expand Down Expand Up @@ -758,7 +761,7 @@ bool TrackerView::addLayoutNode(Container* container, const LayoutNode& node, si
_mapTooltipName = locid;
_mapTooltipPos = {absX,absY};
auto off = MapTooltip::OFFSET;
_mapTooltip = new MapTooltip(absX-_absX-off, absY-_absY-off, _font, _smallFont, _defaultQuality,
_mapTooltip = new MapTooltip(absX-_absX-off, absY-_absY-off, _font, _smallFont, _defaultItemQuality,
_tracker, locid, [this](auto ...args) { return makeItem(args...); });
// TODO: move mapTooltip to mapwidget?
// fix up position
Expand Down
3 changes: 2 additions & 1 deletion src/ui/trackerview.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class TrackerView : public SimpleContainer {
bool _hideClearedLocations = false;
bool _hideUnreachableLocations = false;

int _defaultQuality = -1;
int _defaultItemQuality = -1;
int _defaultMapQuality = 2; // default smooth

void updateLayout(const std::string& layout);
void updateDisplay(const std::string& check);
Expand Down

0 comments on commit ff1aba7

Please sign in to comment.