diff --git a/Mixer.cpp b/Mixer.cpp index 966a4e6..71a03f8 100644 --- a/Mixer.cpp +++ b/Mixer.cpp @@ -454,8 +454,6 @@ void Mixer::setCurrentNext() void Mixer::unsetCurrentSource() { - Log::Info("unsetCurrentSource"); - // discard overlay for previously current source if ( current_source_ != session_->end() ) { @@ -469,11 +467,11 @@ void Mixer::unsetCurrentSource() // remove from selection selection().remove( *current_source_ ); } - } - // deselect current source - current_source_ = session_->end(); - current_source_index_ = -1; + // deselect current source + current_source_ = session_->end(); + current_source_index_ = -1; + } } int Mixer::indexCurrentSource() diff --git a/Source.cpp b/Source.cpp index 88747ca..9923424 100644 --- a/Source.cpp +++ b/Source.cpp @@ -86,6 +86,10 @@ Source::Source() : initialized_(false), need_update_(true) handle_[Handles::ROTATE]->color = glm::vec4( COLOR_HIGHLIGHT_SOURCE, 1.f); handle_[Handles::ROTATE]->translation_.z = 0.1; overlays_[View::GEOMETRY]->attach(handle_[Handles::ROTATE]); + frame = new Frame(Frame::SHARP, Frame::THIN, Frame::NONE); + frame->translation_.z = 0.1; + frame->color = glm::vec4( COLOR_HIGHLIGHT_SOURCE, 0.7f); + overlays_[View::GEOMETRY]->attach(frame); groups_[View::GEOMETRY]->attach(overlays_[View::GEOMETRY]); // default layer nodes diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index 6ad4302..c48613f 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -379,10 +379,10 @@ void UserInterface::handleMouse() // if ( ImGui::IsMouseDown(ImGuiMouseButton_Left) ) { - if ( !mousedown) + if ( !mousedown ) { + Log::Info("LMB down"); mousedown = true; - Log::Info("LMB %d", mousedown); // ask the view what was picked picked = Mixer::manager().view()->pick(mousepos); @@ -430,27 +430,27 @@ void UserInterface::handleMouse() } } } - else if ( ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left) ) + else if ( ImGui::IsMouseReleased(ImGuiMouseButton_Left) ) { + Log::Info("LMB release"); + mousedown = false; +// picked = { nullptr, glm::vec2(0.f) }; + } + + if ( ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left) ) + { + Log::Info("LMB double clic"); // display source in left pannel navigator.showPannelSource( Mixer::manager().indexCurrentSource() ); // discard current to select front most source // (because single clic maintains same source active) Mixer::manager().unsetCurrentSource(); - } - else if ( ImGui::IsMouseReleased(ImGuiMouseButton_Left) ) - { - mousedown = false; - Log::Info("LMB %d", mousedown); - picked = { nullptr, glm::vec2(0.f) }; } // if ( mousedown && glm::distance(mouseclic[ImGuiMouseButton_Left], mousepos) > 3.f ) if ( ImGui::IsMouseDragging(ImGuiMouseButton_Left, 5.0f) ) { -// Log::Info("LMB drag %f", glm::distance(mouseclic[ImGuiMouseButton_Left], mousepos)); - Source *current = Mixer::manager().currentSource(); if (current) { diff --git a/View.cpp b/View.cpp index 3ead768..25c0a46 100644 --- a/View.cpp +++ b/View.cpp @@ -370,14 +370,24 @@ void GeometryView::zoom( float factor ) void GeometryView::draw() { + // hack to prevent source manipulation (scale and rotate) + // when multiple sources are selected: simply do not draw overlay in scene + Source *s = Mixer::manager().currentSource(); + if (s != nullptr) { + if ( Mixer::selection().size() > 1) { + s->setMode(Source::SELECTED); + s = nullptr; + } + } + // draw scene of this view scene.root()->draw(glm::identity(), Rendering::manager().Projection()); - // draw overlay of current source - Source *s = Mixer::manager().currentSource(); + // re-draw overlay of current source on top + // (allows manipulation current source even when hidden below others) if (s != nullptr) { - - DrawVisitor dv(s->overlays_[View::GEOMETRY], Rendering::manager().Projection()); + s->setMode(Source::CURRENT); + DrawVisitor dv(s->overlays_[mode_], Rendering::manager().Projection()); scene.accept(dv); } }