/// <summary> /// マウスの中ボタンでクリックしたときの処理です /// </summary> /// <param name="mouseEvent"></param> protected void OnMouseMiddleClick(MouseEvent mouseEvent) { if (MouseMiddleClick != null) { MouseMiddleClick.Invoke(this, mouseEvent); } }
//this gets called by GLFW (unmanaged code) private void MouseCallback(int btn, int action, int mods) { //scroll (3 was chosen by me, not glfw) if (btn == 3) { MouseScrolled.Invoke(action, this); MouseScrollDirection = action; return; } //left click if (btn == 0 && action == 1) { if (leftLifted) { MouseLeftClick.Invoke(MousePosition, this); MouseLeftClickScaled.Invoke(MousePositionScaled, this); iLastLeft = MousePosition; leftClickToggle = true; } leftLifted = false; } if (btn == 0 && action == 0) { leftLifted = true; MouseLeftRelease.Invoke(MousePosition, this); MouseLeftReleaseScaled.Invoke(MousePositionScaled, this); return; } //right click if (btn == 1 && action == 1) { if (rightLifted) { MouseRightClick.Invoke(MousePosition, this); MouseRightClickScaled.Invoke(MousePositionScaled, this); iLastRight = MousePosition; rightClickToggle = true; } rightLifted = false; return; } if (btn == 1 && action == 0) { rightLifted = true; MouseRightRelease.Invoke(MousePosition, this); MouseRightReleaseScaled.Invoke(MousePositionScaled, this); return; } //middle click if (btn == 2 && action == 1) { if (middleLifted) { MouseMiddleClick.Invoke(MousePosition, this); MouseMiddleClickScaled.Invoke(MousePositionScaled, this); } middleLifted = false; return; } if (btn == 2 && action == 0) { middleLifted = true; MouseMiddleRelease.Invoke(MousePosition, this); MouseMiddleReleaseScaled.Invoke(MousePositionScaled, this); return; } }