add ui and viewport scale option, fix combobox items height from parent
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "node_dialog_picker.h"
|
||||
#include "node_panel_floating.h"
|
||||
#include "settings.h"
|
||||
#include "serializer.h"
|
||||
|
||||
void App::title_update()
|
||||
{
|
||||
@@ -925,6 +926,38 @@ void App::init_menu_tools()
|
||||
}
|
||||
};
|
||||
|
||||
if (auto ui_scale = popup_exp->find<NodeComboBox>("tools-ui-scale"))
|
||||
{
|
||||
// set index to current zoom level (or at least the closest in list)
|
||||
for (int i = 0; i < ui_scale->m_data.size(); i++)
|
||||
if (App::I->zoom >= ui_scale->get_float(i))
|
||||
ui_scale->set_index(i);
|
||||
|
||||
ui_scale->on_select = [ui_scale](Node* target, int index)
|
||||
{
|
||||
App::I->zoom = ui_scale->get_float(index);
|
||||
Settings::set("ui-scale", Serializer::Float(App::I->zoom));
|
||||
Settings::save();
|
||||
App::I->title_update();
|
||||
};
|
||||
}
|
||||
|
||||
if (auto vp_scale = popup_exp->find<NodeComboBox>("tools-vp-scale"))
|
||||
{
|
||||
// set index to current zoom level (or at least the closest in list)
|
||||
for (int i = 0; i < vp_scale->m_data.size(); i++)
|
||||
if (App::I->canvas->m_density >= vp_scale->get_float(i))
|
||||
vp_scale->set_index(i);
|
||||
|
||||
vp_scale->on_select = [vp_scale](Node* target, int index)
|
||||
{
|
||||
float d = vp_scale->get_float(index);
|
||||
App::I->canvas->set_density(d);
|
||||
Settings::set("vp-scale", Serializer::Float(d));
|
||||
Settings::save();
|
||||
};
|
||||
}
|
||||
|
||||
if (auto rtl_btn = popup_exp->find<NodeButtonCustom>("tools-rtl"))
|
||||
{
|
||||
NodeCheckBox* cb = rtl_btn->find<NodeCheckBox>("tools-rtl-check");
|
||||
|
||||
Reference in New Issue
Block a user