mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
Support for horizontal mouse wheel
This commit is contained in:
parent
9fa5d092ff
commit
d539c8613e
@ -124,7 +124,8 @@ private:
|
||||
// True if the cursor is actually hidden right now via system calls.
|
||||
bool _display_hide_cursor;
|
||||
|
||||
SInt32 _wheel_delta;
|
||||
SInt32 _wheel_hdelta;
|
||||
SInt32 _wheel_vdelta;
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
|
@ -627,7 +627,8 @@ osxGraphicsWindow::osxGraphicsWindow(GraphicsPipe *pipe,
|
||||
|
||||
_cursor_hidden = false;
|
||||
_display_hide_cursor = false;
|
||||
_wheel_delta = 0;
|
||||
_wheel_hdelta = 0;
|
||||
_wheel_vdelta = 0;
|
||||
|
||||
if (osxdisplay_cat.is_debug())
|
||||
osxdisplay_cat.debug() << "osxGraphicsWindow::osxGraphicsWindow() -" <<_ID << "\n";
|
||||
@ -1510,20 +1511,36 @@ void osxGraphicsWindow::SystemPointToLocalPoint(Point &qdGlobalPoint)
|
||||
GetEventParameter(event, kEventParamMouseLocation,typeQDPoint, NULL, sizeof(Point),NULL , (void*) &qdGlobalPoint);
|
||||
SystemPointToLocalPoint(qdGlobalPoint);
|
||||
|
||||
if (wheelAxis == kEventMouseWheelAxisX)
|
||||
{
|
||||
set_pointer_in_window((int)qdGlobalPoint.h, (int)qdGlobalPoint.v);
|
||||
_wheel_hdelta += this_wheel_delta;
|
||||
SInt32 wheel_scale = osx_mouse_wheel_scale;
|
||||
while (_wheel_hdelta > wheel_scale) {
|
||||
_input_devices[0].button_down(MouseButton::wheel_left());
|
||||
_input_devices[0].button_up(MouseButton::wheel_left());
|
||||
_wheel_hdelta -= wheel_scale;
|
||||
}
|
||||
while (_wheel_hdelta < -wheel_scale) {
|
||||
_input_devices[0].button_down(MouseButton::wheel_right());
|
||||
_input_devices[0].button_up(MouseButton::wheel_right());
|
||||
_wheel_hdelta += wheel_scale;
|
||||
}
|
||||
}
|
||||
if (wheelAxis == kEventMouseWheelAxisY)
|
||||
{
|
||||
set_pointer_in_window((int)qdGlobalPoint.h, (int)qdGlobalPoint.v);
|
||||
_wheel_delta += this_wheel_delta;
|
||||
_wheel_vdelta += this_wheel_delta;
|
||||
SInt32 wheel_scale = osx_mouse_wheel_scale;
|
||||
while (_wheel_delta > wheel_scale) {
|
||||
while (_wheel_vdelta > wheel_scale) {
|
||||
_input_devices[0].button_down(MouseButton::wheel_up());
|
||||
_input_devices[0].button_up(MouseButton::wheel_up());
|
||||
_wheel_delta -= wheel_scale;
|
||||
_wheel_vdelta -= wheel_scale;
|
||||
}
|
||||
while (_wheel_delta < -wheel_scale) {
|
||||
while (_wheel_vdelta < -wheel_scale) {
|
||||
_input_devices[0].button_down(MouseButton::wheel_down());
|
||||
_input_devices[0].button_up(MouseButton::wheel_down());
|
||||
_wheel_delta += wheel_scale;
|
||||
_wheel_vdelta += wheel_scale;
|
||||
}
|
||||
}
|
||||
result = noErr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user