mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-14 11:49:59 +01:00
Fixed GUI for TransitionView in highDPI
This commit is contained in:
@@ -1547,13 +1547,13 @@ void Navigator::RenderTransitionPannel()
|
|||||||
ImGui::SameLine(0, 10);
|
ImGui::SameLine(0, 10);
|
||||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||||
ImGui::Combo("Curve", &Settings::application.transition.profile, "Linear\0Quadratic\0");
|
ImGui::Combo("Curve", &Settings::application.transition.profile, "Linear\0Quadratic\0");
|
||||||
if ( ImGui::Button( ICON_FA_PLAY " Start", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) {
|
|
||||||
TransitionView *tv = static_cast<TransitionView *>(Mixer::manager().view(View::TRANSITION));
|
|
||||||
if (tv) tv->play();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Text(" ");
|
ImGui::Text(" ");
|
||||||
if ( ImGui::Button( ICON_FA_DOOR_OPEN " Exit", ImVec2(ImGui::GetContentRegionAvail().x, 0)) )
|
if ( ImGui::Button( ICON_FA_PLAY " Play ", ImVec2(ImGui::GetContentRegionAvail().x, 0)) ){
|
||||||
|
TransitionView *tv = static_cast<TransitionView *>(Mixer::manager().view(View::TRANSITION));
|
||||||
|
if (tv) tv->play(true);
|
||||||
|
}
|
||||||
|
if ( ImGui::Button( ICON_FA_DOOR_OPEN " Cancel", ImVec2(ImGui::GetContentRegionAvail().x, 0)) )
|
||||||
Mixer::manager().setView(View::MIXING);
|
Mixer::manager().setView(View::MIXING);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
19
View.cpp
19
View.cpp
@@ -877,7 +877,7 @@ void TransitionView::draw()
|
|||||||
0.1f, TRANSITION_MIN_DURATION, TRANSITION_MAX_DURATION, "%.1f s");
|
0.1f, TRANSITION_MIN_DURATION, TRANSITION_MAX_DURATION, "%.1f s");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if ( ImGui::Button(ICON_FA_PLAY) )
|
if ( ImGui::Button(ICON_FA_PLAY) )
|
||||||
play();
|
play(false);
|
||||||
ImGui::PopFont();
|
ImGui::PopFont();
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
@@ -936,7 +936,7 @@ std::pair<Node *, glm::vec2> TransitionView::pick(glm::vec2 P)
|
|||||||
if (transition_source_ != nullptr) {
|
if (transition_source_ != nullptr) {
|
||||||
// start animation when clic on target
|
// start animation when clic on target
|
||||||
if (pick.first == output_surface_)
|
if (pick.first == output_surface_)
|
||||||
play();
|
play(true);
|
||||||
// otherwise cancel animation
|
// otherwise cancel animation
|
||||||
else
|
else
|
||||||
transition_source_->group(View::TRANSITION)->clearCallbacks();
|
transition_source_->group(View::TRANSITION)->clearCallbacks();
|
||||||
@@ -946,26 +946,31 @@ std::pair<Node *, glm::vec2> TransitionView::pick(glm::vec2 P)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TransitionView::play()
|
void TransitionView::play(bool open)
|
||||||
{
|
{
|
||||||
if (transition_source_ != nullptr) {
|
if (transition_source_ != nullptr) {
|
||||||
|
|
||||||
|
// if want to open session after play, target movement till end position, otherwise stop at 0
|
||||||
|
float target_x = open ? 0.4f : 0.f;
|
||||||
|
|
||||||
|
// calculate time remaining to reach target
|
||||||
float time = CLAMP(- transition_source_->group(View::TRANSITION)->translation_.x, 0.f, 1.f);
|
float time = CLAMP(- transition_source_->group(View::TRANSITION)->translation_.x, 0.f, 1.f);
|
||||||
time += 0.2; // extra time to reach transition
|
time += open ? 0.2f : 0.f;; // extra time to reach transition if want to open
|
||||||
time *= Settings::application.transition.duration * 1000.f;
|
time *= Settings::application.transition.duration * 1000.f;
|
||||||
|
|
||||||
// if remaining time is more than 50ms
|
// if remaining time is more than 50ms
|
||||||
if (time > 50.f) {
|
if (time > 50.f) {
|
||||||
// start animation
|
// start animation
|
||||||
MoveToCallback *anim = new MoveToCallback(glm::vec3(0.4f, 0.0, 0.0), time);
|
MoveToCallback *anim = new MoveToCallback(glm::vec3(target_x, 0.0, 0.0), time);
|
||||||
transition_source_->group(View::TRANSITION)->update_callbacks_.push_back(anim);
|
transition_source_->group(View::TRANSITION)->update_callbacks_.push_back(anim);
|
||||||
}
|
}
|
||||||
// otherwise finish animation
|
// otherwise finish animation
|
||||||
else
|
else
|
||||||
transition_source_->group(View::TRANSITION)->translation_.x = 0.4;
|
transition_source_->group(View::TRANSITION)->translation_.x = target_x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
View::Cursor TransitionView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::pair<Node *, glm::vec2> pick)
|
View::Cursor TransitionView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::pair<Node *, glm::vec2>)
|
||||||
{
|
{
|
||||||
if (!s)
|
if (!s)
|
||||||
return Cursor();
|
return Cursor();
|
||||||
|
|||||||
2
View.h
2
View.h
@@ -157,7 +157,7 @@ public:
|
|||||||
void attach(SessionSource *ts);
|
void attach(SessionSource *ts);
|
||||||
class Session *detach();
|
class Session *detach();
|
||||||
|
|
||||||
void play();
|
void play(bool open);
|
||||||
|
|
||||||
void draw () override;
|
void draw () override;
|
||||||
void update (float dt) override;
|
void update (float dt) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user