Skip to content

Commit

Permalink
fix scaling one last time
Browse files Browse the repository at this point in the history
  • Loading branch information
anatom3000 committed Oct 22, 2024
1 parent 4f8274f commit 785958e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
21 changes: 21 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,24 @@ struct matjson::Serialize<ToolConfig> {
return value;
}
};

#define DEFAULT_PRESETS\
ToolConfig {\
.name = "Circle",\
.x = "4*sin(t)",\
.y = "4*cos(t)",\
.rotation = "t",\
.n = "16",\
.start = "0",\
.end = "360",\
.delete_original = true\
},\
ToolConfig {\
.name = "Random blocks",\
.x = "round(20*random())",\
.y = "round(20*random())",\
.n = "50",\
.start = "0.0",\
.end = "1.0",\
.delete_original = true\
},\
10 changes: 0 additions & 10 deletions src/default_presets.inc

This file was deleted.

3 changes: 2 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@ class FunctionToolPopup : public geode::Popup<> {
obj_single->addObject(obj);


ui->scaleObjects(obj_single, scale_x*obj->getRScaleX(), scale_y*obj->getRScaleY(), current_center, ObjectScaleType::XY, /* absoluteScaling: */ true);
ui->scaleObjects(obj_single, scale_x*obj->getRScaleX(), scale_y*obj->getRScaleY(), current_center, ObjectScaleType::X, /* absoluteScaling: */ true);
ui->scaleObjects(obj_single, scale_x*obj->getRScaleX(), scale_y*obj->getRScaleY(), current_center, ObjectScaleType::Y, /* absoluteScaling: */ true);
if (!m_abs_scaling) this->scaleRelative(obj, current_center, scale_x, scale_y);
if (m_abs_rotation) ui->rotateObjects(obj_single, rotation, obj->getRealPosition());

Expand Down
4 changes: 1 addition & 3 deletions src/popups/add.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ class AddPopup : public geode::Popup<> {

void onCreate(CCObject* obj) {
auto presets = Mod::get()->getSavedValue<std::vector<ToolConfig>>(
"presets", std::vector<ToolConfig> {
#include "default_presets.inc"
}
"presets", std::vector<ToolConfig> { DEFAULT_PRESETS }
);

presets.insert(presets.begin(), m_functool->saveConfig(m_input_name->getString()));
Expand Down
4 changes: 1 addition & 3 deletions src/popups/history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ class HistoryPopup : public geode::Popup<> {
auto const center2 = CCSize(440, 280) / 2;

m_presets = Mod::get()->getSavedValue<std::vector<ToolConfig>>(
"presets", std::vector<ToolConfig> {
#include "default_presets.inc"
}
"presets", std::vector<ToolConfig> { DEFAULT_PRESETS }
);

// inspired by https://github.com/hiimjustin000/SearchHistory/blob/v1.1.0/src/SearchHistoryPopup.cpp
Expand Down

0 comments on commit 785958e

Please sign in to comment.