mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 10:49:59 +01:00
More freedom of grab translation for all views
This commit is contained in:
@@ -186,7 +186,7 @@ void GeometryView::resize ( int scale )
|
||||
scene.root()->scale_.y = z;
|
||||
|
||||
// Clamp translation to acceptable area
|
||||
glm::vec3 border(scene.root()->scale_.x * 1.5, scene.root()->scale_.y * 1.5, 0.f);
|
||||
glm::vec3 border(2.f * Mixer::manager().session()->frame()->aspectRatio(), 2.f, 0.f);
|
||||
scene.root()->translation_ = glm::clamp(scene.root()->translation_, -border, border);
|
||||
}
|
||||
|
||||
|
||||
@@ -217,9 +217,8 @@ void LayerView::resize ( int scale )
|
||||
scene.root()->scale_.y = z;
|
||||
|
||||
// Clamp translation to acceptable area
|
||||
glm::vec3 border_left(scene.root()->scale_.x * -2.f, scene.root()->scale_.y * -1.f, 0.f);
|
||||
glm::vec3 border_right(scene.root()->scale_.x * 8.f, scene.root()->scale_.y * 8.f, 0.f);
|
||||
scene.root()->translation_ = glm::clamp(scene.root()->translation_, border_left, border_right);
|
||||
glm::vec3 border(2.f, 1.f, 0.f);
|
||||
scene.root()->translation_ = glm::clamp(scene.root()->translation_, -border, border * 2.f);
|
||||
}
|
||||
|
||||
int LayerView::size ()
|
||||
|
||||
@@ -250,7 +250,8 @@ void MixingView::resize ( int scale )
|
||||
scene.root()->scale_.y = z;
|
||||
|
||||
// Clamp translation to acceptable area
|
||||
glm::vec3 border(scene.root()->scale_.x * 1.f, scene.root()->scale_.y * 1.f, 0.f);
|
||||
glm::vec2 res = resolution();
|
||||
glm::vec3 border(2.3f * res.x/res.y, 2.3f, 0.f);
|
||||
scene.root()->translation_ = glm::clamp(scene.root()->translation_, -border, border);
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ void TextureView::resize ( int scale )
|
||||
scene.root()->scale_.y = z;
|
||||
|
||||
// Clamp translation to acceptable area
|
||||
glm::vec3 border(scene.root()->scale_.x * 1.5, scene.root()->scale_.y * 1.5, 0.f);
|
||||
glm::vec3 border(2.f * Mixer::manager().session()->frame()->aspectRatio(), 2.f, 0.f);
|
||||
scene.root()->translation_ = glm::clamp(scene.root()->translation_, -border, border);
|
||||
}
|
||||
|
||||
|
||||
6
View.cpp
6
View.cpp
@@ -287,3 +287,9 @@ void View::lock(Source *s, bool on)
|
||||
Action::manager().store(s->name() + std::string(": unlock."));
|
||||
}
|
||||
|
||||
|
||||
glm::vec2 View::resolution() const
|
||||
{
|
||||
const ImGuiIO& io = ImGui::GetIO();
|
||||
return glm::vec2(io.DisplaySize.x, io.DisplaySize.y);
|
||||
}
|
||||
|
||||
3
View.h
3
View.h
@@ -88,6 +88,9 @@ public:
|
||||
// left-right [-1 1] and up-down [1 -1] action from arrow keys
|
||||
virtual void arrow (glm::vec2) {}
|
||||
|
||||
// resolution on screen
|
||||
glm::vec2 resolution() const;
|
||||
|
||||
// accessible scene
|
||||
Scene scene;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user