fix scroll

This commit is contained in:
2019-10-20 16:13:24 +02:00
parent e30ac277c1
commit 0d575be198
7 changed files with 29 additions and 36 deletions

View File

@@ -109,10 +109,6 @@ void NodePanelAnimation::load_layers()
auto& layers = Canvas::I->m_layers;
m_selected_frame = nullptr;
float max_width = find("hscroll")->GetWidth() - 2;
for (int i = 0; i < layers.size(); i++)
max_width = glm::max(max_width, layers[i]->total_duration() * 35.f);
for (int i = 0; i < layers.size(); i++)
{
auto l = m_layers_container->add_child<NodeAnimationLayer>();
@@ -120,8 +116,6 @@ void NodePanelAnimation::load_layers()
l->set_selected(Canvas::I->m_current_layer_idx == i);
l->set_chekcbox(layers[i]->m_visible);
auto film = m_frames_container->add_child_ref<NodeAnimationFilm>();
//film->m_color = glm::vec4(glm::vec3(i % 2 ? .8 : .7), 1);
film->SetWidth(max_width - 5);
for (int fi = 0; fi < layers[i]->m_frames.size(); fi++)
{
auto b = film->add_frame(layers[i]->m_frames[fi].m_duration);
@@ -146,7 +140,6 @@ void NodePanelAnimation::load_layers()
};
}
}
m_timeline->SetWidth(max_width - 4);
m_timeline->m_frame = Canvas::I->m_anim_frame;
m_timeline->m_onion_size = m_onion->get_int();
update_frames();
@@ -159,18 +152,6 @@ void NodePanelAnimation::update_frames()
m_frame_label->set_text_format("%0*d/%d", digits, m_timeline->m_frame + 1, total_frames);
}
void NodePanelAnimation::handle_resize(glm::vec2 old_size, glm::vec2 new_size, float zoom)
{
parent::handle_resize(old_size, new_size, zoom);
auto& layers = Canvas::I->m_layers;
float max_width = find("hscroll")->GetWidth() - 2;
for (int i = 0; i < layers.size(); i++)
max_width = glm::max(max_width, layers[i]->total_duration() * 35.f);
for (auto& film : m_frames_container->m_children)
film->SetWidth(max_width - 5);
m_timeline->SetWidth(max_width - 4);
}
void NodePanelAnimation::on_tick(float dt)
{
parent::on_tick(dt);