mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-13 11:19:58 +01:00
Cosmetics in views and GUI
This commit is contained in:
@@ -396,16 +396,21 @@ void ImGuiVisitor::visit (Source& s)
|
|||||||
// preview
|
// preview
|
||||||
float preview_width = ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
|
float preview_width = ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN;
|
||||||
float width = preview_width;
|
float width = preview_width;
|
||||||
glm::vec2 size = s.frame()->projectionArea() * glm::vec2( s.frame()->aspectRatio(), 1.f);
|
float height = width / s.frame()->aspectRatio();
|
||||||
float height = width * size.y / size.x;
|
if (height > 230) {
|
||||||
if (height > 200) {
|
height = 230;
|
||||||
height = 200;
|
width = height * s.frame()->aspectRatio();
|
||||||
width = height * size.x / size.y;
|
|
||||||
}
|
}
|
||||||
ImGui::Image((void*)(uintptr_t) s.frame()->texture(), ImVec2(width, height));
|
ImGui::Image((void*)(uintptr_t) s.frame()->texture(), ImVec2(width, height));
|
||||||
|
|
||||||
ImVec2 pos = ImGui::GetCursorPos(); // remember where we were...
|
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
|
// toggle enable/disable image processing
|
||||||
bool on = s.imageProcessingEnabled();
|
bool on = s.imageProcessingEnabled();
|
||||||
ImGui::SetCursorPos( ImVec2(preview_width + 15, pos.y -ImGui::GetFrameHeight() ) );
|
ImGui::SetCursorPos( ImVec2(preview_width + 15, pos.y -ImGui::GetFrameHeight() ) );
|
||||||
|
|||||||
@@ -111,6 +111,9 @@ uint Selection::size()
|
|||||||
|
|
||||||
Source *Selection::front()
|
Source *Selection::front()
|
||||||
{
|
{
|
||||||
|
if (selection_.empty())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
return selection_.front();
|
return selection_.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ void RotateToCallback::update(Node *n, float dt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BounceScaleCallback::BounceScaleCallback(float duration) : UpdateCallback(),
|
BounceScaleCallback::BounceScaleCallback(float scale) : UpdateCallback(),
|
||||||
duration_(duration), progress_(0.f), initialized_(false)
|
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
|
// calculate amplitude of movement
|
||||||
progress_ += dt / duration_;
|
progress_ += dt / duration_;
|
||||||
|
|
||||||
n->scale_.x = initial_scale_.x + (initial_scale_.x * 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 * 0.05f) * sin(M_PI * progress_);
|
n->scale_.y = initial_scale_.y + (initial_scale_.y * scale_) * sin(M_PI * progress_);
|
||||||
|
|
||||||
// end of movement
|
// end of movement
|
||||||
if ( progress_ > 1.f) {
|
if ( progress_ > 1.f) {
|
||||||
|
|||||||
@@ -55,12 +55,13 @@ public:
|
|||||||
class BounceScaleCallback : public UpdateCallback
|
class BounceScaleCallback : public UpdateCallback
|
||||||
{
|
{
|
||||||
float duration_;
|
float duration_;
|
||||||
|
float scale_;
|
||||||
float progress_;
|
float progress_;
|
||||||
bool initialized_;
|
bool initialized_;
|
||||||
glm::vec3 initial_scale_;
|
glm::vec3 initial_scale_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BounceScaleCallback(float duration = 100.f);
|
BounceScaleCallback(float scale = 0.05f);
|
||||||
void update(Node *n, float dt);
|
void update(Node *n, float dt);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
12
View.cpp
12
View.cpp
@@ -419,6 +419,9 @@ std::pair<Node *, glm::vec2> MixingView::pick(glm::vec2 P)
|
|||||||
else
|
else
|
||||||
anim = new RotateToCallback(SIGN(slider_root_->rotation_.z) * M_PI, 500.f);
|
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
|
// reset & start animation
|
||||||
slider_root_->update_callbacks_.clear();
|
slider_root_->update_callbacks_.clear();
|
||||||
slider_root_->update_callbacks_.push_back(anim);
|
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) )
|
// else if ( Mixer::manager().concealed(s) )
|
||||||
// info << "Stashed";
|
// info << "Stashed";
|
||||||
else
|
else
|
||||||
info << "Inactive";
|
info << "Inactive " << ICON_FA_EYE_SLASH;
|
||||||
|
|
||||||
// store action in history
|
// store action in history
|
||||||
current_action_ = s->name() + ": " + info.str();
|
current_action_ = s->name() + ": " + info.str();
|
||||||
@@ -2055,6 +2058,13 @@ void AppearanceView::adjustBackground()
|
|||||||
|
|
||||||
Source *AppearanceView::getEditOrCurrentSource()
|
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
|
// get current source
|
||||||
Source *_source = Mixer::manager().currentSource();
|
Source *_source = Mixer::manager().currentSource();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user