diff --git a/ImGuiVisitor.cpp b/ImGuiVisitor.cpp index 0413cbf..e375534 100644 --- a/ImGuiVisitor.cpp +++ b/ImGuiVisitor.cpp @@ -395,17 +395,22 @@ void ImGuiVisitor::visit (Source& s) // preview float preview_width = ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN; - float width = preview_width; - glm::vec2 size = s.frame()->projectionArea() * glm::vec2( s.frame()->aspectRatio(), 1.f); - float height = width * size.y / size.x; - if (height > 200) { - height = 200; - width = height * size.x / size.y; + float width = preview_width; + float height = width / s.frame()->aspectRatio(); + if (height > 230) { + height = 230; + width = height * s.frame()->aspectRatio(); } ImGui::Image((void*)(uintptr_t) s.frame()->texture(), ImVec2(width, height)); ImVec2 pos = ImGui::GetCursorPos(); // remember where we were... + ImGui::SetCursorPos( ImVec2(preview_width + 15, pos.y -height ) ); + if (s.active()) + ImGuiToolkit::Icon(10, 4); + else + ImGuiToolkit::Icon(11, 4); + // toggle enable/disable image processing bool on = s.imageProcessingEnabled(); ImGui::SetCursorPos( ImVec2(preview_width + 15, pos.y -ImGui::GetFrameHeight() ) ); diff --git a/Selection.cpp b/Selection.cpp index 0b7e218..a55c89c 100644 --- a/Selection.cpp +++ b/Selection.cpp @@ -111,6 +111,9 @@ uint Selection::size() Source *Selection::front() { + if (selection_.empty()) + return nullptr; + return selection_.front(); } diff --git a/UpdateCallback.cpp b/UpdateCallback.cpp index 65d63ae..3fbaec4 100644 --- a/UpdateCallback.cpp +++ b/UpdateCallback.cpp @@ -70,8 +70,8 @@ void RotateToCallback::update(Node *n, float dt) } } -BounceScaleCallback::BounceScaleCallback(float duration) : UpdateCallback(), - duration_(duration), progress_(0.f), initialized_(false) +BounceScaleCallback::BounceScaleCallback(float scale) : UpdateCallback(), + duration_(100.f), progress_(0.f), initialized_(false), scale_(scale) { } @@ -87,8 +87,8 @@ void BounceScaleCallback::update(Node *n, float dt) // calculate amplitude of movement progress_ += dt / duration_; - n->scale_.x = initial_scale_.x + (initial_scale_.x * 0.05f) * sin(M_PI * progress_); - n->scale_.y = initial_scale_.y + (initial_scale_.y * 0.05f) * sin(M_PI * progress_); + n->scale_.x = initial_scale_.x + (initial_scale_.x * scale_) * sin(M_PI * progress_); + n->scale_.y = initial_scale_.y + (initial_scale_.y * scale_) * sin(M_PI * progress_); // end of movement if ( progress_ > 1.f) { diff --git a/UpdateCallback.h b/UpdateCallback.h index 9ef8820..2c2fb1b 100644 --- a/UpdateCallback.h +++ b/UpdateCallback.h @@ -55,12 +55,13 @@ public: class BounceScaleCallback : public UpdateCallback { float duration_; + float scale_; float progress_; bool initialized_; glm::vec3 initial_scale_; public: - BounceScaleCallback(float duration = 100.f); + BounceScaleCallback(float scale = 0.05f); void update(Node *n, float dt); }; diff --git a/View.cpp b/View.cpp index 342fa97..3c3dd05 100644 --- a/View.cpp +++ b/View.cpp @@ -419,6 +419,9 @@ std::pair MixingView::pick(glm::vec2 P) else anim = new RotateToCallback(SIGN(slider_root_->rotation_.z) * M_PI, 500.f); + // animate clic + pick.first->update_callbacks_.push_back(new BounceScaleCallback(0.3f)); + // reset & start animation slider_root_->update_callbacks_.clear(); slider_root_->update_callbacks_.push_back(anim); @@ -502,7 +505,7 @@ View::Cursor MixingView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::pai // else if ( Mixer::manager().concealed(s) ) // info << "Stashed"; else - info << "Inactive"; + info << "Inactive " << ICON_FA_EYE_SLASH; // store action in history current_action_ = s->name() + ": " + info.str(); @@ -2055,6 +2058,13 @@ void AppearanceView::adjustBackground() Source *AppearanceView::getEditOrCurrentSource() { + // cancel multiple selection + if (Mixer::selection().size() > 1) { + Source *_alternate = Mixer::selection().front(); + Mixer::selection().clear(); + Mixer::manager().setCurrentSource(_alternate); + } + // get current source Source *_source = Mixer::manager().currentSource();