combobox selected element alignment, brush preview
This commit is contained in:
@@ -30,6 +30,7 @@ void NodeComboBox::loaded()
|
|||||||
popup->loaded();
|
popup->loaded();
|
||||||
root()->add_child(popup);
|
root()->add_child(popup);
|
||||||
m_items.clear();
|
m_items.clear();
|
||||||
|
int real_index = 0;
|
||||||
for (int i = 0; i < m_data.size(); i++)
|
for (int i = 0; i < m_data.size(); i++)
|
||||||
{
|
{
|
||||||
if (m_data[i] == "-")
|
if (m_data[i] == "-")
|
||||||
@@ -46,6 +47,8 @@ void NodeComboBox::loaded()
|
|||||||
btn->m_border->SetWidthP(100.f);
|
btn->m_border->SetWidthP(100.f);
|
||||||
btn->m_border->SetHeight(30.f);
|
btn->m_border->SetHeight(30.f);
|
||||||
int index = (int)m_items.size();
|
int index = (int)m_items.size();
|
||||||
|
if (index == m_current_index)
|
||||||
|
m_selected_child_index = popup->get_child_index(btn);
|
||||||
m_items.push_back(m_data[i]);
|
m_items.push_back(m_data[i]);
|
||||||
btn->on_click = [this,popup,btn,index](Node* target) {
|
btn->on_click = [this,popup,btn,index](Node* target) {
|
||||||
m_current_index = index;
|
m_current_index = index;
|
||||||
@@ -103,7 +106,6 @@ void NodeComboBox::parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute*
|
|||||||
void NodeComboBox::set_index(int index)
|
void NodeComboBox::set_index(int index)
|
||||||
{
|
{
|
||||||
m_current_index = index;
|
m_current_index = index;
|
||||||
m_selected_child_index = index;
|
|
||||||
m_text->set_text(m_items[index].c_str());
|
m_text->set_text(m_items[index].c_str());
|
||||||
//if (on_select)
|
//if (on_select)
|
||||||
// on_select(this, index);
|
// on_select(this, index);
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ void NodeStrokePreview::draw_stroke()
|
|||||||
|
|
||||||
// copy background color to tex2
|
// copy background color to tex2
|
||||||
ShaderManager::use(kShader::Checkerboard);
|
ShaderManager::use(kShader::Checkerboard);
|
||||||
ShaderManager::u_int(kShaderUniform::Colorize, b->m_tip_mix > 0.f);
|
ShaderManager::u_int(kShaderUniform::Colorize, b->m_tip_mix > 0.f || b->m_blend_mode != 0);
|
||||||
float aspect = size.x / size.y;
|
float aspect = size.x / size.y;
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f / aspect, .5f / aspect, -1.f, 1.f));
|
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f / aspect, .5f / aspect, -1.f, 1.f));
|
||||||
m_plane.draw_fill();
|
m_plane.draw_fill();
|
||||||
|
|||||||
Reference in New Issue
Block a user