mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 10:19:59 +01:00
Fixed source picking problems
Allow unlock of source in geometry, do not allow selection of locked source with CTRL
This commit is contained in:
@@ -441,28 +441,33 @@ std::pair<Node *, glm::vec2> GeometryView::pick(glm::vec2 P)
|
||||
}
|
||||
}
|
||||
// the clicked source changed (not the current source)
|
||||
if (current == nullptr){
|
||||
if (current == nullptr) {
|
||||
|
||||
// default to failed pick
|
||||
pick = { nullptr, glm::vec2(0.f) };
|
||||
|
||||
// loop over all nodes picked
|
||||
// loop over all nodes picked to detect clic on locks
|
||||
for (auto itp = pv.rbegin(); itp != pv.rend(); itp++){
|
||||
|
||||
// get if a source was picked
|
||||
Source *s = Mixer::manager().findSource((*itp).first);
|
||||
|
||||
// accept picked sources in current workspaces
|
||||
if ( s!=nullptr && s->workspace() == Settings::application.current_workspace) {
|
||||
|
||||
// lock icon of a source (not current) is picked : unlock
|
||||
if ( (*itp).first == s->lock_) {
|
||||
if ( s!=nullptr && (*itp).first == s->lock_) {
|
||||
s->setLocked(false);
|
||||
pick = { s->locker_, (*itp).second };
|
||||
break;
|
||||
}
|
||||
}
|
||||
// no lock icon picked, find what else was picked
|
||||
if ( pick.first == nullptr) {
|
||||
|
||||
// loop over all nodes picked
|
||||
for (auto itp = pv.rbegin(); itp != pv.rend(); itp++){
|
||||
// get if a source was picked
|
||||
Source *s = Mixer::manager().findSource((*itp).first);
|
||||
// accept picked sources in current workspaces
|
||||
if ( s!=nullptr && s->workspace() == Settings::application.current_workspace) {
|
||||
// a non-locked source is picked (anywhere)
|
||||
else if ( !s->locked() ) {
|
||||
if ( !s->locked() ) {
|
||||
// not in an active selection? don't pick this one!
|
||||
if ( !UserInterface::manager().ctrlModifier() &&
|
||||
Mixer::selection().size() > 1 &&
|
||||
@@ -472,14 +477,9 @@ std::pair<Node *, glm::vec2> GeometryView::pick(glm::vec2 P)
|
||||
pick = { s->locker_, (*itp).second };
|
||||
break;
|
||||
}
|
||||
// force pick a locked source with CTRL key
|
||||
else if ( s->locked() && UserInterface::manager().ctrlModifier() ) {
|
||||
pick = { s->locker_, (*itp).second };
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
// no source picked
|
||||
// not a source picked
|
||||
else {
|
||||
// picked on selection handles
|
||||
if ( (*itp).first == overlay_selection_scale_ || (*itp).first == overlay_selection_rotate_ ) {
|
||||
@@ -497,9 +497,8 @@ std::pair<Node *, glm::vec2> GeometryView::pick(glm::vec2 P)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -228,8 +228,8 @@ std::pair<Node *, glm::vec2> LayerView::pick(glm::vec2 P)
|
||||
s->setLocked(true);
|
||||
pick = { nullptr, glm::vec2(0.f) };
|
||||
}
|
||||
// pick a locked source without CTRL key; cancel pick
|
||||
else if ( s->locked() && !UserInterface::manager().ctrlModifier() )
|
||||
// pick a locked source; cancel pick
|
||||
else if ( s->locked() )
|
||||
pick = { nullptr, glm::vec2(0.f) };
|
||||
}
|
||||
else
|
||||
|
||||
@@ -345,8 +345,8 @@ std::pair<Node *, glm::vec2> MixingView::pick(glm::vec2 P)
|
||||
s->setLocked(true);
|
||||
pick = { nullptr, glm::vec2(0.f) };
|
||||
}
|
||||
// pick a locked source without CTRL key; cancel pick
|
||||
else if ( s->locked() && !UserInterface::manager().ctrlModifier() ) {
|
||||
// pick a locked source ; cancel pick
|
||||
else if ( s->locked() ) {
|
||||
pick = { nullptr, glm::vec2(0.f) };
|
||||
}
|
||||
// pick on the mixing group rotation icon
|
||||
|
||||
Reference in New Issue
Block a user