diff --git a/GeometryView.cpp b/GeometryView.cpp index 5160053..4ee5e20 100644 --- a/GeometryView.cpp +++ b/GeometryView.cpp @@ -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); } diff --git a/LayerView.cpp b/LayerView.cpp index 37a3e68..dcfbade 100644 --- a/LayerView.cpp +++ b/LayerView.cpp @@ -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 () diff --git a/MixingView.cpp b/MixingView.cpp index fce2c3a..e4be714 100644 --- a/MixingView.cpp +++ b/MixingView.cpp @@ -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); } diff --git a/TextureView.cpp b/TextureView.cpp index 3ad9cb9..707187b 100644 --- a/TextureView.cpp +++ b/TextureView.cpp @@ -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); } diff --git a/View.cpp b/View.cpp index 980d9d5..e3a4cc1 100644 --- a/View.cpp +++ b/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); +} diff --git a/View.h b/View.h index 4fbce43..b3e320f 100644 --- a/View.h +++ b/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; diff --git a/defines.h b/defines.h index be78859..0530fa9 100644 --- a/defines.h +++ b/defines.h @@ -40,7 +40,7 @@ #define GEOMETRY_MIN_SCALE 0.4f #define GEOMETRY_MAX_SCALE 7.0f #define LAYER_DEFAULT_SCALE 0.6f -#define LAYER_MIN_SCALE 0.4f +#define LAYER_MIN_SCALE 0.25f #define LAYER_MAX_SCALE 1.7f #define LAYER_PERSPECTIVE 2.0f #define LAYER_BACKGROUND 2.f