Support scrolling in X and Y
This commit is contained in:
parent
5a2201537f
commit
447a86b2b1
@ -837,15 +837,26 @@ bool Editor_keyDown(int key, int modifiers)
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void Editor_scrollRow(int delta)
|
void Editor_scroll(int deltaX, int deltaY)
|
||||||
{
|
{
|
||||||
int current_row = s_editorData.trackViewInfo.rowPos;
|
int i, current_row = s_editorData.trackViewInfo.rowPos;
|
||||||
TrackViewInfo* viewInfo = &s_editorData.trackViewInfo;
|
TrackViewInfo* viewInfo = &s_editorData.trackViewInfo;
|
||||||
|
|
||||||
current_row += delta;
|
current_row += deltaY;
|
||||||
|
|
||||||
s_editorData.trackViewInfo.rowPos = eclampi(current_row, viewInfo->startRow, viewInfo->endRow);
|
s_editorData.trackViewInfo.rowPos = eclampi(current_row, viewInfo->startRow, viewInfo->endRow);
|
||||||
|
|
||||||
|
if (deltaX < 0)
|
||||||
|
{
|
||||||
|
for (i = 0; i < -deltaX; ++i)
|
||||||
|
setActiveTrack(getPrevTrack());
|
||||||
|
}
|
||||||
|
else if (deltaX > 0)
|
||||||
|
{
|
||||||
|
for (i = 0; i < deltaX; ++i)
|
||||||
|
setActiveTrack(getNextTrack());
|
||||||
|
}
|
||||||
|
|
||||||
Editor_update();
|
Editor_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ void Editor_timedUpdate();
|
|||||||
bool Editor_keyDown(int keyCode, int mod);
|
bool Editor_keyDown(int keyCode, int mod);
|
||||||
void Editor_setWindowSize(int x, int y);
|
void Editor_setWindowSize(int x, int y);
|
||||||
void Editor_menuEvent(int menuItem);
|
void Editor_menuEvent(int menuItem);
|
||||||
void Editor_scrollRow(int delta);
|
void Editor_scroll(int deltaX, int deltaY);
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|||||||
@ -150,8 +150,11 @@ NSOpenGLContext* g_context = 0;
|
|||||||
|
|
||||||
- (void)scrollWheel:(NSEvent *)theEvent
|
- (void)scrollWheel:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
float f = (float)[theEvent deltaY];
|
float x = (float)[theEvent deltaX];
|
||||||
Editor_scrollRow((int)-f);
|
float y = (float)[theEvent deltaY];
|
||||||
|
|
||||||
|
printf("%f %f\n", x, y);
|
||||||
|
Editor_scroll((int)-x, (int)-y);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user