Sequencer - Finished wheel support
+ "Temporary" horizontal wheel support + Fixed bad bounds on vertical wheel
This commit is contained in:
parent
b4a46264f2
commit
702bf2bee8
4 changed files with 32 additions and 9 deletions
1
TODO
1
TODO
|
@ -32,7 +32,6 @@ Sync / inputs:
|
||||||
* Support for overrides
|
* Support for overrides
|
||||||
* Fix the various remaining issues
|
* Fix the various remaining issues
|
||||||
* Zooming issues on the right side
|
* Zooming issues on the right side
|
||||||
* Mouse wheel
|
|
||||||
* Add curve display
|
* Add curve display
|
||||||
|
|
||||||
Misc:
|
Misc:
|
||||||
|
|
|
@ -12,9 +12,13 @@
|
||||||
// Data
|
// Data
|
||||||
static double g_Time = 0.0f;
|
static double g_Time = 0.0f;
|
||||||
static bool g_MousePressed[3] = { false, false, false };
|
static bool g_MousePressed[3] = { false, false, false };
|
||||||
|
static float g_MouseHorizWheel = 0.0f;
|
||||||
static float g_MouseWheel = 0.0f;
|
static float g_MouseWheel = 0.0f;
|
||||||
static GLuint g_FontTexture = 0;
|
static GLuint g_FontTexture = 0;
|
||||||
|
|
||||||
|
#warning fix this if/when ocornut integrates the patch
|
||||||
|
/*static*/ float ImGuiIO_MouseHorizWheel = 0.0f;
|
||||||
|
|
||||||
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
|
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
|
||||||
// If text or lines are blurry when integrating ImGui in your engine:
|
// If text or lines are blurry when integrating ImGui in your engine:
|
||||||
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
|
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
|
||||||
|
@ -115,6 +119,10 @@ bool ImGui_ImplSdl_ProcessEvent(SDL_Event* event)
|
||||||
{
|
{
|
||||||
case SDL_MOUSEWHEEL:
|
case SDL_MOUSEWHEEL:
|
||||||
{
|
{
|
||||||
|
if (event->wheel.x > 0)
|
||||||
|
g_MouseHorizWheel = 1;
|
||||||
|
if (event->wheel.x < 0)
|
||||||
|
g_MouseHorizWheel = -1;
|
||||||
if (event->wheel.y > 0)
|
if (event->wheel.y > 0)
|
||||||
g_MouseWheel = 1;
|
g_MouseWheel = 1;
|
||||||
if (event->wheel.y < 0)
|
if (event->wheel.y < 0)
|
||||||
|
@ -273,8 +281,9 @@ void ImGui_ImplSdl_NewFrame(SDL_Window *window ,
|
||||||
io.MouseDown[2] = g_MousePressed[2] || (mouseMask & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
|
io.MouseDown[2] = g_MousePressed[2] || (mouseMask & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
|
||||||
g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;
|
g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;
|
||||||
|
|
||||||
|
ImGuiIO_MouseHorizWheel = g_MouseHorizWheel;
|
||||||
io.MouseWheel = g_MouseWheel;
|
io.MouseWheel = g_MouseWheel;
|
||||||
g_MouseWheel = 0.0f;
|
g_MouseHorizWheel = g_MouseWheel = 0.0f;
|
||||||
|
|
||||||
// Hide OS mouse cursor if ImGui is drawing it
|
// Hide OS mouse cursor if ImGui is drawing it
|
||||||
SDL_ShowCursor(io.MouseDrawCursor ? 0 : 1);
|
SDL_ShowCursor(io.MouseDrawCursor ? 0 : 1);
|
||||||
|
|
|
@ -20,3 +20,7 @@ IMGUI_API bool ImGui_ImplSdl_ProcessEvent(SDL_Event* event);
|
||||||
// Use if you want to reset your rendering device without losing ImGui state.
|
// Use if you want to reset your rendering device without losing ImGui state.
|
||||||
IMGUI_API void ImGui_ImplSdl_InvalidateDeviceObjects();
|
IMGUI_API void ImGui_ImplSdl_InvalidateDeviceObjects();
|
||||||
IMGUI_API bool ImGui_ImplSdl_CreateDeviceObjects();
|
IMGUI_API bool ImGui_ImplSdl_CreateDeviceObjects();
|
||||||
|
|
||||||
|
|
||||||
|
#warning fix this if/when ocornut integrates the patch
|
||||||
|
extern float ImGuiIO_MouseHorizWheel;
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include "ui-sequencer.hh"
|
#include "ui-sequencer.hh"
|
||||||
#include "ui-utilities.hh"
|
#include "ui-utilities.hh"
|
||||||
|
|
||||||
|
#include "ui-imgui-sdl.hh"
|
||||||
|
|
||||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||||
#include <imgui_internal.h>
|
#include <imgui_internal.h>
|
||||||
|
|
||||||
|
@ -634,14 +636,22 @@ void T_SyncViewImpl_::sequencerWidget( ) noexcept
|
||||||
if ( io.KeyShift ) {
|
if ( io.KeyShift ) {
|
||||||
zoomLevel = ImSaturate( zoomLevel + .025 * io.MouseWheel );
|
zoomLevel = ImSaturate( zoomLevel + .025 * io.MouseWheel );
|
||||||
} else {
|
} else {
|
||||||
vScroll = ImMax( 0.f ,
|
vScroll = ImClamp( vScroll - 3.f * io.MouseWheel ,
|
||||||
ImMin( vScroll - 3.f * io.MouseWheel ,
|
0.f ,
|
||||||
totalHeight - bbDisplay.GetHeight( ) ) );
|
ImMax( 0.f , totalHeight - bbDisplay.GetHeight( ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( bbDisplay.Contains( io.MousePos ) ) {
|
if ( bbDisplay.Contains( io.MousePos ) ) {
|
||||||
displayTooltips( mTime );
|
displayTooltips( mTime );
|
||||||
}
|
}
|
||||||
|
if ( ImGuiIO_MouseHorizWheel != 0 ) {
|
||||||
|
startPos = ImClamp(
|
||||||
|
sync.durationUnits( )
|
||||||
|
* ( startPixel - 20.f * ImGuiIO_MouseHorizWheel )
|
||||||
|
/ totalPixels ,
|
||||||
|
0.f , sync.durationUnits( ) );
|
||||||
|
checkLockMode = true;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -662,6 +672,9 @@ void T_SyncViewImpl_::sequencerWidget( ) noexcept
|
||||||
zoomLevel = ( ppu - BarWidth ) / ( BarWidth - width / u ) + 1;
|
zoomLevel = ( ppu - BarWidth ) / ( BarWidth - width / u ) + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if ( zoomInProgress && io.MouseDown[ 1 ] ) {
|
||||||
|
curZoomPixel = mPixels;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( selPointDnD && handlePointDrag( mPixels , io.MouseDown[ 0 ] ) ) {
|
if ( selPointDnD && handlePointDrag( mPixels , io.MouseDown[ 0 ] ) ) {
|
||||||
|
@ -679,10 +692,8 @@ void T_SyncViewImpl_::sequencerWidget( ) noexcept
|
||||||
sync.setTime( mTime );
|
sync.setTime( mTime );
|
||||||
}
|
}
|
||||||
if ( io.MouseDown[ 1 ] ) {
|
if ( io.MouseDown[ 1 ] ) {
|
||||||
if ( !zoomInProgress ) {
|
firstZoomPixel = mPixels;
|
||||||
firstZoomPixel = mPixels;
|
zoomInProgress = true;
|
||||||
zoomInProgress = true;
|
|
||||||
}
|
|
||||||
curZoomPixel = mPixels;
|
curZoomPixel = mPixels;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue