mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-20 06:39:59 +01:00
Added Mouse wheel input on all sliders.
mouse wheel performs minimal increment to adjust precisely values of sliders in source panels.
This commit is contained in:
@@ -263,6 +263,7 @@ void ImGuiVisitor::visit(Shader &n)
|
||||
|
||||
void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
std::ostringstream oss;
|
||||
ImGui::PushID(std::to_string(n.id()).c_str());
|
||||
|
||||
@@ -283,8 +284,14 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
float val = log10f(n.gamma.w);
|
||||
if ( ImGui::SliderFloat("##Gamma", &val, -1.f, 1.f, "%.3f", 2.f) )
|
||||
n.gamma.w = powf(10.f, val);
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
val = CLAMP(val + 0.001f * io.MouseWheel, -1.f, 1.f);
|
||||
n.gamma.w = powf(10.f, val);
|
||||
oss << "Gamma " << std::setprecision(3) << val;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()){
|
||||
oss << "Gamma " << std::setprecision(2) << val;
|
||||
oss << "Gamma " << std::setprecision(3) << val;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
@@ -299,8 +306,13 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
///
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderFloat("##Brightness", &n.brightness, -1.0, 1.0, "%.3f", 2.f);
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
n.brightness = CLAMP(n.brightness + 0.001f * io.MouseWheel, -1.f, 1.f);
|
||||
oss << "Brightness " << std::setprecision(3) << n.brightness;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()){
|
||||
oss << "Brightness " << std::setprecision(2) << n.brightness;
|
||||
oss << "Brightness " << std::setprecision(3) << n.brightness;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
@@ -315,8 +327,13 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
///
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderFloat("##Contrast", &n.contrast, -1.0, 1.0, "%.3f", 2.f);
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
n.contrast = CLAMP(n.contrast + 0.001f * io.MouseWheel, -1.f, 1.f);
|
||||
oss << "Contrast " << std::setprecision(3) << n.contrast;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()){
|
||||
oss << "Contrast " << std::setprecision(2) << n.contrast;
|
||||
oss << "Contrast " << std::setprecision(3) << n.contrast;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
@@ -331,8 +348,13 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
///
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderFloat("##Saturation", &n.saturation, -1.0, 1.0, "%.3f", 2.f);
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
n.saturation = CLAMP(n.saturation + 0.001f * io.MouseWheel, -1.f, 1.f);
|
||||
oss << "Saturation " << std::setprecision(3) << n.saturation;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()){
|
||||
oss << "Saturation " << std::setprecision(2) << n.saturation;
|
||||
oss << "Saturation " << std::setprecision(3) << n.saturation;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
@@ -346,9 +368,14 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
/// HUE SHIFT
|
||||
///
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderFloat("##Hue", &n.hueshift, 0.0, 1.0);
|
||||
ImGui::SliderFloat("##Hue", &n.hueshift, 0.0, 1.0, "%.3f");
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
n.hueshift = CLAMP(n.hueshift + 0.001f * io.MouseWheel, 0.f, 1.f);
|
||||
oss << "Hue shift " << std::setprecision(3) << n.hueshift;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()){
|
||||
oss << "Hue shift " << std::setprecision(2) << n.hueshift;
|
||||
oss << "Hue shift " << std::setprecision(3) << n.hueshift;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
@@ -366,6 +393,11 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
if (ImGui::SliderFloat("##Posterize", &posterized, 257.f, 1.f, posterized > 256.f ? "Full range" : "%.0f colors", 0.5f)) {
|
||||
n.nbColors = posterized > 256 ? 0.f : posterized;
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
n.nbColors = CLAMP( n.nbColors + io.MouseWheel, 1.f, 257.f);
|
||||
if (n.nbColors == 0) oss << "Full range"; else oss << n.nbColors;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()){
|
||||
std::ostringstream oss;
|
||||
oss << "Posterize ";
|
||||
@@ -387,6 +419,11 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
if (ImGui::SliderFloat("##Threshold", &threshold, 0.f, 1.f, threshold < 0.001f ? "None" : "%.3f") ){
|
||||
n.threshold = threshold < 0.001f ? 0.f : threshold;
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
n.threshold = CLAMP(n.threshold + 0.001f * io.MouseWheel, 0.f, 1.f);
|
||||
if (n.threshold < 0.001f) oss << "None"; else oss << std::setprecision(3) << n.threshold;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()){
|
||||
oss << "Threshold ";
|
||||
if (n.threshold < 0.001f) oss << "None"; else oss << std::setprecision(3) << n.threshold;
|
||||
@@ -647,7 +684,8 @@ void ImGuiVisitor::visit (MediaSource& s)
|
||||
// icon (>) to open player
|
||||
if ( s.playable() ) {
|
||||
ImGui::SetCursorPos(top);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
|
||||
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
||||
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
top.x += ImGui::GetFrameHeight();
|
||||
}
|
||||
@@ -737,7 +775,8 @@ void ImGuiVisitor::visit (SessionFileSource& s)
|
||||
// icon (>) to open player
|
||||
if ( s.playable() ) {
|
||||
ImGui::SetCursorPos(top);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
|
||||
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
||||
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
top.x += ImGui::GetFrameHeight();
|
||||
}
|
||||
@@ -788,7 +827,8 @@ void ImGuiVisitor::visit (SessionGroupSource& s)
|
||||
// icon (>) to open player
|
||||
if ( s.playable() ) {
|
||||
ImGui::SetCursorPos(top);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
|
||||
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
||||
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
}
|
||||
}
|
||||
@@ -821,7 +861,8 @@ void ImGuiVisitor::visit (RenderSource& s)
|
||||
// icon (>) to open player
|
||||
if ( s.playable() ) {
|
||||
ImGui::SetCursorPos(top);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
|
||||
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
||||
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
top.x += ImGui::GetFrameHeight();
|
||||
}
|
||||
@@ -848,6 +889,9 @@ void ImGuiVisitor::visit (PassthroughFilter&)
|
||||
|
||||
void ImGuiVisitor::visit (DelayFilter& f)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
std::ostringstream oss;
|
||||
|
||||
// if (ImGuiToolkit::IconButton(ICON_FILTER_DELAY)) {
|
||||
// f.setDelay(0.f);
|
||||
// Action::manager().store("Delay 0 s");
|
||||
@@ -857,8 +901,13 @@ void ImGuiVisitor::visit (DelayFilter& f)
|
||||
float d = f.delay();
|
||||
if (ImGui::SliderFloat("##Delay", &d, 0.f, 2.f, "%.2f s"))
|
||||
f.setDelay(d);
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
d = CLAMP( d + 0.01f * io.MouseWheel, 0.f, 2.f);
|
||||
f.setDelay(d);
|
||||
oss << "Delay " << std::setprecision(3) << d << " s";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
std::ostringstream oss;
|
||||
oss << "Delay " << std::setprecision(3) << d << " s";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
@@ -892,6 +941,8 @@ void ImGuiVisitor::visit (ResampleFilter& f)
|
||||
|
||||
void list_parameters_(ImageFilter &f, std::ostringstream &oss)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
std::map<std::string, float> filter_parameters = f.program().parameters();
|
||||
for (auto param = filter_parameters.begin(); param != filter_parameters.end(); ++param)
|
||||
{
|
||||
@@ -901,6 +952,12 @@ void list_parameters_(ImageFilter &f, std::ostringstream &oss)
|
||||
if (ImGui::SliderFloat( "##ImageFilterParameterEdit", &v, 0.f, 1.f, "%.2f")) {
|
||||
f.setProgramParameter(param->first, v);
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
v = CLAMP( v + 0.01f * io.MouseWheel, 0.f, 1.f);
|
||||
f.setProgramParameter(param->first, v);
|
||||
oss << " : " << param->first << " " << std::setprecision(3) << v;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
oss << " : " << param->first << " " << std::setprecision(3) <<param->second;
|
||||
Action::manager().store(oss.str());
|
||||
@@ -1014,6 +1071,7 @@ void ImGuiVisitor::visit (EdgeFilter& f)
|
||||
|
||||
void ImGuiVisitor::visit (AlphaFilter& f)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
std::ostringstream oss;
|
||||
oss << "Alpha ";
|
||||
|
||||
@@ -1042,6 +1100,13 @@ void ImGuiVisitor::visit (AlphaFilter& f)
|
||||
if (ImGui::SliderFloat( "##Threshold", &t, 0.f, 1.f, "%.2f")) {
|
||||
f.setProgramParameter("Threshold", t);
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
t = CLAMP( t + 0.01f * io.MouseWheel, 0.f, 1.f);
|
||||
f.setProgramParameter("Threshold", t);
|
||||
oss << AlphaFilter::operation_label[ f.operation() ];
|
||||
oss << " : " << "Threshold" << " " << std::setprecision(3) << t;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
oss << AlphaFilter::operation_label[ f.operation() ];
|
||||
oss << " : " << "Threshold" << " " << std::setprecision(3) << t;
|
||||
@@ -1061,6 +1126,13 @@ void ImGuiVisitor::visit (AlphaFilter& f)
|
||||
if (ImGui::SliderFloat( "##Tolerance", &v, 0.f, 1.f, "%.2f")) {
|
||||
f.setProgramParameter("Tolerance", v);
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
v = CLAMP( v + 0.01f * io.MouseWheel, 0.f, 1.f);
|
||||
f.setProgramParameter("Tolerance", v);
|
||||
oss << AlphaFilter::operation_label[ f.operation() ];
|
||||
oss << " : " << "Tolerance" << " " << std::setprecision(3) << v;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
oss << AlphaFilter::operation_label[ f.operation() ];
|
||||
oss << " : " << "Tolerance" << " " << std::setprecision(3) << v;
|
||||
@@ -1198,7 +1270,8 @@ void ImGuiVisitor::visit (CloneSource& s)
|
||||
// icon (>) to open player
|
||||
if ( s.playable() ) {
|
||||
ImGui::SetCursorPos(top);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
|
||||
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
||||
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
}
|
||||
|
||||
@@ -1248,7 +1321,8 @@ void ImGuiVisitor::visit (PatternSource& s)
|
||||
// icon (>) to open player
|
||||
if ( s.playable() ) {
|
||||
ImGui::SetCursorPos(top);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
|
||||
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
||||
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
}
|
||||
}
|
||||
@@ -1292,7 +1366,8 @@ void ImGuiVisitor::visit (DeviceSource& s)
|
||||
// icon (>) to open player
|
||||
if ( s.playable() ) {
|
||||
ImGui::SetCursorPos(top);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
|
||||
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
||||
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
}
|
||||
|
||||
@@ -1324,7 +1399,8 @@ void ImGuiVisitor::visit (NetworkSource& s)
|
||||
// icon (>) to open player
|
||||
if ( s.playable() ) {
|
||||
ImGui::SetCursorPos(top);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
|
||||
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
||||
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
}
|
||||
}
|
||||
@@ -1411,7 +1487,8 @@ void ImGuiVisitor::visit (MultiFileSource& s)
|
||||
// icon (>) to open player
|
||||
if ( s.playable() ) {
|
||||
ImGui::SetCursorPos(top);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
|
||||
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
||||
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
top.x += ImGui::GetFrameHeight();
|
||||
}
|
||||
@@ -1465,7 +1542,8 @@ void ImGuiVisitor::visit (GenericStreamSource& s)
|
||||
// icon (>) to open player
|
||||
if ( s.playable() ) {
|
||||
ImGui::SetCursorPos(top);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
|
||||
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
||||
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
}
|
||||
}
|
||||
@@ -1493,7 +1571,8 @@ void ImGuiVisitor::visit (SrtReceiverSource& s)
|
||||
// icon (>) to open player
|
||||
if ( s.playable() ) {
|
||||
ImGui::SetCursorPos(top);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PLAY_CIRCLE, "Open in Player"))
|
||||
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
||||
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1425,6 +1425,7 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
|
||||
Source *s = Mixer::manager().currentSource();
|
||||
if (s || !(*p_mode & SourceToolbar_autohide) ) {
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
std::ostringstream info;
|
||||
const glm::vec3 out = Mixer::manager().session()->frame()->resolution();
|
||||
const char *tooltip_lock[2] = {"Width & height not linked", "Width & height linked"};
|
||||
@@ -1434,7 +1435,6 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
|
||||
//
|
||||
if (*p_border > 0) {
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImVec2 window_pos = ImVec2((*p_border & 1) ? io.DisplaySize.x * 0.5 : WINDOW_TOOLBOX_DIST_TO_BORDER,
|
||||
(*p_border & 2) ? io.DisplaySize.y - WINDOW_TOOLBOX_DIST_TO_BORDER : WINDOW_TOOLBOX_DIST_TO_BORDER);
|
||||
ImVec2 window_pos_pivot = ImVec2((*p_border & 1) ? 0.5f : 0.0f, (*p_border & 2) ? 1.0f : 0.0f);
|
||||
@@ -1469,8 +1469,14 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
|
||||
ImGui::SetNextItemWidth(sliderwidth);
|
||||
if ( ImGui::DragFloat("##Alpha", &v, 0.1f, 0.f, 100.f, "%.1f%%") )
|
||||
s->call(new SetAlpha(v*0.01f), true);
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
v = CLAMP(v + 0.1f * io.MouseWheel, 0.f, 100.f);
|
||||
s->call(new SetAlpha(v*0.01f), true);
|
||||
info << "Alpha " << std::fixed << std::setprecision(3) << v*0.01f;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
if ( ImGui::IsItemDeactivatedAfterEdit() ) {
|
||||
info << "Alpha " << std::fixed << std::setprecision(3) << v;
|
||||
info << "Alpha " << std::fixed << std::setprecision(3) << v*0.01f;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
|
||||
@@ -1487,19 +1493,44 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
|
||||
info << "Position " << std::setprecision(3) << n->translation_.x << ", " << n->translation_.y;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
float vec[2] = { n->translation_.x * out.y * 0.5f, n->translation_.y * out.y * 0.5f};
|
||||
// Position X
|
||||
v = n->translation_.x * out.y * 0.5f;
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
ImGui::SetNextItemWidth( 2.f * sliderwidth);
|
||||
if ( ImGui::DragFloat2("##Pos", vec, 1.0f, -MAX_SCALE * out.x, MAX_SCALE * out.x, "%.0fpx") ) {
|
||||
n->translation_.x = vec[0] / (0.5f * out.y);
|
||||
n->translation_.y = vec[1] / (0.5f * out.y);
|
||||
ImGui::SetNextItemWidth( sliderwidth);
|
||||
if ( ImGui::DragFloat("##PosX", &v, 1.0f, -MAX_SCALE * out.x * 0.5f, MAX_SCALE * out.x * 0.5f, "%.0fpx") ) {
|
||||
n->translation_.x = v / (0.5f * out.y);
|
||||
s->touch();
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
v += io.MouseWheel;
|
||||
n->translation_.x = v / (0.5f * out.y);
|
||||
s->touch();
|
||||
info << "Position " << std::setprecision(3) << n->translation_.x << ", " << n->translation_.y;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
if ( ImGui::IsItemDeactivatedAfterEdit() ){
|
||||
info << "Position " << std::setprecision(3) << n->translation_.x << ", " << n->translation_.y;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
// Position Y
|
||||
v = n->translation_.y * out.y * 0.5f;
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
ImGui::SetNextItemWidth( sliderwidth);
|
||||
if ( ImGui::DragFloat("##PosY", &v, 1.0f, -MAX_SCALE * out.y * 0.5f, MAX_SCALE * out.y * 0.5f, "%.0fpx") ) {
|
||||
n->translation_.y = v / (0.5f * out.y);
|
||||
s->touch();
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
v += io.MouseWheel;
|
||||
n->translation_.y = v / (0.5f * out.y);
|
||||
s->touch();
|
||||
info << "Position " << std::setprecision(3) << n->translation_.x << ", " << n->translation_.y;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
if ( ImGui::IsItemDeactivatedAfterEdit() ){
|
||||
info << "Position " << std::setprecision(3) << n->translation_.x << ", " << n->translation_.y;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
ImGui::Text("|");
|
||||
|
||||
@@ -1527,6 +1558,15 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
|
||||
s->touch();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f && v > 10.f){
|
||||
v += io.MouseWheel;
|
||||
n->scale_.x = v / out.x;
|
||||
if (*p_mode & SourceToolbar_linkar)
|
||||
n->scale_.y = n->scale_.x / ar_scale;
|
||||
s->touch();
|
||||
info << "Scale " << std::setprecision(3) << n->scale_.x << " x " << n->scale_.y;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
if ( ImGui::IsItemDeactivatedAfterEdit() ){
|
||||
info << "Scale " << std::setprecision(3) << n->scale_.x << " x " << n->scale_.y;
|
||||
Action::manager().store(info.str());
|
||||
@@ -1548,6 +1588,15 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
|
||||
s->touch();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f && v > 10.f){
|
||||
v += io.MouseWheel;
|
||||
n->scale_.y = v / out.y;
|
||||
if (*p_mode & SourceToolbar_linkar)
|
||||
n->scale_.x = n->scale_.y * ar_scale;
|
||||
s->touch();
|
||||
info << "Scale " << std::setprecision(3) << n->scale_.x << " x " << n->scale_.y;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
if ( ImGui::IsItemDeactivatedAfterEdit() ){
|
||||
info << "Scale " << std::setprecision(3) << n->scale_.x << " x " << n->scale_.y;
|
||||
Action::manager().store(info.str());
|
||||
@@ -1573,6 +1622,13 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
|
||||
n->rotation_.z = v_deg * (2.f*M_PI) / 360.0f;
|
||||
s->touch();
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f){
|
||||
v_deg = CLAMP(v_deg + 0.01f * io.MouseWheel, -180.f, 180.f);
|
||||
n->rotation_.z = v_deg * (2.f*M_PI) / 360.0f;
|
||||
s->touch();
|
||||
info << "Angle " << std::setprecision(3) << n->rotation_.z * 180.f / M_PI;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
if ( ImGui::IsItemDeactivatedAfterEdit() ) {
|
||||
info << "Angle " << std::setprecision(3) << n->rotation_.z * 180.f / M_PI;
|
||||
Action::manager().store(info.str());
|
||||
@@ -1629,8 +1685,14 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
|
||||
ImGui::SetNextItemWidth(sliderwidth);
|
||||
if ( ImGui::DragFloat("##Alpha", &v, 0.1f, 0.f, 100.f, "%.1f%%") )
|
||||
s->call(new SetAlpha(v*0.01f), true);
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
v = CLAMP(v + 0.1f * io.MouseWheel, 0.f, 100.f);
|
||||
s->call(new SetAlpha(v*0.01f), true);
|
||||
info << "Alpha " << std::fixed << std::setprecision(3) << v*0.01f;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
if ( ImGui::IsItemDeactivatedAfterEdit() ) {
|
||||
info << "Alpha " << std::fixed << std::setprecision(3) << v;
|
||||
info << "Alpha " << std::fixed << std::setprecision(3) << v*0.01f;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
@@ -1643,13 +1705,39 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
|
||||
//
|
||||
// POSITION COORDINATES
|
||||
//
|
||||
float vec[2] = { n->translation_.x * out.y * 0.5f, n->translation_.y * out.y * 0.5f};
|
||||
ImGui::SetNextItemWidth(sliderwidth);
|
||||
if ( ImGui::DragFloat2("##Pos", vec, 1.0f, -MAX_SCALE * out.x, MAX_SCALE * out.x, "%.0fpx") ) {
|
||||
n->translation_.x = vec[0] / (0.5f * out.y);
|
||||
n->translation_.y = vec[1] / (0.5f * out.y);
|
||||
// Position X
|
||||
v = n->translation_.x * out.y * 0.5f;
|
||||
ImGui::SetNextItemWidth( 3.06f * ImGui::GetTextLineHeightWithSpacing() );
|
||||
if ( ImGui::DragFloat("##PosX", &v, 1.0f, -MAX_SCALE * (0.5f * out.x), MAX_SCALE * (0.5f * out.x), "%.0fpx") ) {
|
||||
n->translation_.x = v / (0.5f * out.x);
|
||||
s->touch();
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
v += io.MouseWheel;
|
||||
n->translation_.x = v / (0.5f * out.x);
|
||||
s->touch();
|
||||
info << "Position " << std::setprecision(3) << n->translation_.x << ", " << n->translation_.y;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
if ( ImGui::IsItemDeactivatedAfterEdit() ){
|
||||
info << "Position " << std::setprecision(3) << n->translation_.x << ", " << n->translation_.y;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
// Position Y
|
||||
v = n->translation_.y * out.y * 0.5f;
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
ImGui::SetNextItemWidth( 3.05f * ImGui::GetTextLineHeightWithSpacing() );
|
||||
if ( ImGui::DragFloat("##PosY", &v, 1.0f, -MAX_SCALE * (0.5f * out.y), MAX_SCALE * (0.5f * out.y), "%.0fpx") ) {
|
||||
n->translation_.y = v / (0.5f * out.y);
|
||||
s->touch();
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
v += io.MouseWheel;
|
||||
n->translation_.y = v / (0.5f * out.y);
|
||||
s->touch();
|
||||
info << "Position " << std::setprecision(3) << n->translation_.x << ", " << n->translation_.y;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
if ( ImGui::IsItemDeactivatedAfterEdit() ){
|
||||
info << "Position " << std::setprecision(3) << n->translation_.x << ", " << n->translation_.y;
|
||||
Action::manager().store(info.str());
|
||||
@@ -1678,6 +1766,15 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
|
||||
s->touch();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f && v > 10.f){
|
||||
v += io.MouseWheel;
|
||||
n->scale_.x = v / out.x;
|
||||
if (*p_mode & SourceToolbar_linkar)
|
||||
n->scale_.y = n->scale_.x / ar_scale;
|
||||
s->touch();
|
||||
info << "Scale " << std::setprecision(3) << n->scale_.x << " x " << n->scale_.y;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
if ( ImGui::IsItemDeactivatedAfterEdit() ){
|
||||
info << "Scale " << std::setprecision(3) << n->scale_.x << " x " << n->scale_.y;
|
||||
Action::manager().store(info.str());
|
||||
@@ -1699,6 +1796,15 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
|
||||
s->touch();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f && v > 10.f){
|
||||
v += io.MouseWheel;
|
||||
n->scale_.y = v / out.y;
|
||||
if (*p_mode & SourceToolbar_linkar)
|
||||
n->scale_.x = n->scale_.y * ar_scale;
|
||||
s->touch();
|
||||
info << "Scale " << std::setprecision(3) << n->scale_.x << " x " << n->scale_.y;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
if ( ImGui::IsItemDeactivatedAfterEdit() ){
|
||||
info << "Scale " << std::setprecision(3) << n->scale_.x << " x " << n->scale_.y;
|
||||
Action::manager().store(info.str());
|
||||
@@ -1721,6 +1827,13 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
|
||||
n->rotation_.z = v_deg * (2.f*M_PI) / 360.0f;
|
||||
s->touch();
|
||||
}
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f){
|
||||
v_deg = CLAMP(v_deg + 0.01f * io.MouseWheel, -180.f, 180.f);
|
||||
n->rotation_.z = v_deg * (2.f*M_PI) / 360.0f;
|
||||
s->touch();
|
||||
info << "Angle " << std::setprecision(3) << n->rotation_.z * 180.f / M_PI;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
if ( ImGui::IsItemDeactivatedAfterEdit() ) {
|
||||
info << "Angle " << std::setprecision(3) << n->rotation_.z * 180.f / M_PI;
|
||||
Action::manager().store(info.str());
|
||||
|
||||
Reference in New Issue
Block a user