mouse

How to limit cursor movement in WPF based app?

浪尽此生 提交于 2019-12-11 03:28:50
问题 I'm working with a WPF app, more specifically a Canvas with draggable elements. Once an item is being dragged, I'd like to limit the scope of cursor movement to inside the canvas where the items are being dragged about. The event which can start a drag is shown below private void WidgetCanvas_PreviewHeaderLeftMouseDown(object sender, MouseButtonEventArgs e) { e.Handled = true; ... logic to figure out if this is a valid drag, blah blah blah ... this.IsDragging = true; // TODO: clip the

GLUT mouse button down

让人想犯罪 __ 提交于 2019-12-11 03:20:13
问题 I would like to zoom in on an object for as long as I hold the right mouse button down. The issue right now is that I have to click it every time I want to zoom. Is there a way I can modify my code so that it will zoom while I hold the button, rather than clicking it? void mouse(int button, int state, int x, int y) { // Save the left button state if (button == GLUT_LEFT_BUTTON) { leftMouseButtonDown = (state == GLUT_DOWN); zMovement += 0.1f; } else if (button == GLUT_RIGHT_BUTTON) {

How to constrain rotation from mouse input in unity 5?

狂风中的少年 提交于 2019-12-11 03:05:37
问题 I have a very basic script to move the camera from the mouse position, but I want to constrain the rotation of the z axis to some values. With the code below it all works fine, but the camera can be rotated fully on the z axis, I want to limit it to 20 and -40. I have tried to use mathf.clamp but that didn't work and when printed to the console it only printed out the right most value in the mathf.clamp. I also tried using an if statement to see if the rotation was over the limit, and then to

How to disable Opera mouse gestures?

一世执手 提交于 2019-12-11 02:58:34
问题 I'm working on a browser game, where you use right click also. It works fine, but in Opera it's unplayable because of mouse gestures. How can I disable it on my website? 回答1: In the Menu: Tools > Preferences... (Ctrl+F12) Uncheck shortcut options in the Dialog: Advanced > Shortcuts > Enable mouse gestures Advanced > Shortcuts > Enable single-key shortcuts 来源: https://stackoverflow.com/questions/8520880/how-to-disable-opera-mouse-gestures

Getting a line that has the coordinates defined by the mouse location

两盒软妹~` 提交于 2019-12-11 02:39:47
问题 I'm trying to make a little graphics program that has a circle of diameter 100 on the screen and from the center of it, a line is coming out of it that is always attached to the mouse pointer until such time that the user does a click, and then the line is permanently drawn. It's exactly like MSPaint's line, except that starting point is always the center of the circle. I tried a few things that DON'T work. I can get the line to appear only after a mouse-click. That's not what I want. I want

How to hide mouse pointer in GTK C

假装没事ソ 提交于 2019-12-11 02:29:27
问题 I have an application which I have made using gtk and c. It runs on full screen mode and displays data on a label. I need to hide the mouse pointer as soon as the application starts and then unhide it when the application stops. How to do it. This is my main window: GtkWidget *window = NULL; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_size_request((window),640,480); gtk_widget_realize (window); gtk_window_fullscreen((GtkWindow*)window); 回答1: Phew, that was a rabbit hole of

Detecting a mouse click / mouse up in NetLogo

孤人 提交于 2019-12-11 02:26:20
问题 Using mouse-down? for mouse actions in NetLogo often results in the action happening too many times. For example, if you want to let users click to create new turtles, you could hook a forever button up to a procedure like: to add-turtle if mouse-down? [ crt 1 [ setxy mouse-xcor mouse-ycor ] ] end The problem is that this usually results in many turtles being created per click. I'd like to do something like: to add-turtle if mouse-clicked? [ crt 1 [ setxy mouse-xcor mouse-ycor ] ] end Where

Pygame: Mouse Specific Axis Detection

为君一笑 提交于 2019-12-11 01:55:43
问题 How can I detect ONLY the X axis, for example? maus_x = 0 maus_y = 0 pygame.mouse.get_pos(maus_x, maus_y) while not done: for event in pygame.event.get(): if event.type == pygame.MOUSEMOTION: if maus_x < wx_coord: angle += 10 In theory, this "pygame.mouse.get_pos" returns a tuple (x, y). But, I'm defining there a variable to represent the x and y in this tuple. The thing is, when I move the mouse (pygame.MOUSEMOTION), when I do what is written in "maus_x < wx_coord:", it executes the function

Point-triangle intersection in 3d from mouse coordinates?

我的梦境 提交于 2019-12-11 01:09:19
问题 I know how to test intersection between a point and a triangle. ...But i dont get it, how i can move the starting position of the point onto the screen plane precisely by using my mouse coordinates, so the point angle should change depending on where mouse cursor is on the screen, also this should work perfectly no matter which perspective angle i am using in my OpenGL application, so the point angle would be different on different perspective angles... gluPerspective() is the function im

Visual studio 2015 keystroke with mouse button

半腔热情 提交于 2019-12-11 00:56:21
问题 I've just installed the Setpoint logitech software on a new PC with windows server 2012. I've assigned to one of the buttons of my mouse the keystroke Ctrl + Tab , which supposed to switch between open files on visual studio but it is not working! If i press on the button on chrome, it switch tabs, but on VS it does nothing... If I press Ctrl + Tab myself in VS the file will be switched... I've used this keystrokes many times in diffrent PC's with diffrent enviroment on visual studio 2013 and