MCPcopy Create free account
hub / github.com/arrayfire/forge / mouseButtonHandler

Method mouseButtonHandler

src/backend/opengl/glfw/window.cpp:340–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340void Widget::mouseButtonHandler(int pButton, int pAction, int pMods)
341{
342 double x, y;
343 glfwGetCursorPos(mWindow, &x, &y);
344 mLastXPos = float(x);
345 mLastYPos = float(y);
346
347 mButton = -1;
348 if (pAction == GLFW_PRESS) {
349 switch(pButton) {
350 case GLFW_MOUSE_BUTTON_LEFT : mButton = GLFW_MOUSE_BUTTON_LEFT ; break;
351 case GLFW_MOUSE_BUTTON_RIGHT : mButton = GLFW_MOUSE_BUTTON_RIGHT ; break;
352 case GLFW_MOUSE_BUTTON_MIDDLE: mButton = GLFW_MOUSE_BUTTON_MIDDLE; break;
353 }
354 }
355 if (pMods == GLFW_MOD_ALT || pMods == GLFW_MOD_CONTROL) {
356 mButton += 10 * pMods;
357 }
358 // reset UI transforms upon mouse middle click
359 if (pButton == GLFW_MOUSE_BUTTON_MIDDLE && pMods == GLFW_MOD_CONTROL && pAction == GLFW_PRESS) {
360 setCellViewMatrix(float(x), float(y), IDENTITY);
361 setCellOrientationMatrix(float(x), float(y), IDENTITY);
362 }
363}
364
365void Widget::pollEvents()
366{

Callers 1

WidgetMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected