mouse

How can I simulate a mouse click at a certain position on the screen?

别说谁变了你拦得住时间么 提交于 2019-12-17 08:24:18
问题 What I want to do is to manipulate the mouse. It will be a simple macro for my own purposes. So it will move my mouse to certain position on the screen and click like I am clicking with certain interval. 回答1: Here's a code that is using unmanaged functions to simulate mouse clicks : //This is a replacement for Cursor.Position in WinForms [System.Runtime.InteropServices.DllImport("user32.dll")] static extern bool SetCursorPos(int x, int y); [System.Runtime.InteropServices.DllImport("user32.dll

Most modern method of getting mouse position within a canvas in native JavaScript [duplicate]

你说的曾经没有我的故事 提交于 2019-12-17 06:51:26
问题 This question already has answers here : How do I get the coordinates of a mouse click on a canvas element? (22 answers) Closed 7 months ago . First, I know this question has been asked many times. However, the answers provided are not consistent and a variety of methods are used to get the mouse position. A few examples: Method 1: canvas.onmousemove = function (event) { // this object refers to canvas object Mouse = { x: event.pageX - this.offsetLeft, y: event.pageY - this.offsetTop } }

Javascript: Capture mouse wheel event and do not scroll the page?

帅比萌擦擦* 提交于 2019-12-17 06:47:08
问题 I'm trying to prevent a mousewheel event captured by an element of the page to cause scrolling. I expected false as last parameter to have the expected result, but using the mouse wheel over this "canvas" element still causes scrolling: this.canvas.addEventListener('mousewheel', function(event) { mouseController.wheel(event); }, false); Outside of this "canvas" element, the scroll needs to happen. Inside, it must only trigger the .wheel() method. What am I doing wrong? 回答1: You can do so by

jQuery Set Mouse Position (not cursor position)

六眼飞鱼酱① 提交于 2019-12-17 06:13:28
问题 I have a link that, when clicked, I would like it to move the position of the mouse to the right (or anywhere within the viewport, for that matter). in code it would probably look similar to the following: $('a#expand').click(function(e){ $(document) .mouseXPos(e.pageX + 50) .mouseYPos(e.pageY + 50); }); Chaining might not be necessary, of course, but a similar 'set mouse position' functionality is what I am after. I've seen solutions to move the cursor position to a certain spot in the text,

Can't make work ScrollWheel map in vim

 ̄綄美尐妖づ 提交于 2019-12-14 03:15:07
问题 I have a little problem with mapping vim shortcuts for my mouse wheel. I can't make this work : set mouse=a set nowrap noremap <C-ScrollWheelUp> 3zh noremap <C-ScrollWheelDown> 3zl On the other hand, the following is working (but not convenient, i just tested it to see if ScrollWheelUp/Down was working) : set mouse=a set nowrap noremap <ScrollWheelUp> 3zh noremap <ScrollWheelDown> 3zl What is my problem ? 来源: https://stackoverflow.com/questions/17083641/cant-make-work-scrollwheel-map-in-vim

VirtualBox Keystroke gets random changes

喜你入骨 提交于 2019-12-14 02:44:00
问题 I have a school project about it security. My job is it to customize a hardware mouse with a usb hub and a teensy to program it. The code on the teensy gets executed when it gets dark (light dependent resistor). The code takes some files on the win7 vm and upload them to an Apache2 server hosted on a kali vm (via cmd commands in win7 vm). Everything works fine in vmware, but I have to use virtualbox for my project. My problem is now that in virtualbox the cmd commands randomly changes with

java : right click event

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 23:53:41
问题 on TableHeader, I try to make a right click with the mouse as follow : tableHeader.click(MouseEvent.BUTTON3); but this is not working, have you any idea/suggestion ? thanks, 回答1: if it is because you want to show a popupmenu then you can do it like this:: popupMenu.show(tableHeader, 0, 0); if it is because you want to get into a mouselistener like: class MyMouseListener implements MouseListener{ @Override public void mouseReleased(MouseEvent arg0) { if(SwingUtilities.isRightMouseButton(arg0))

Drawing lines by dragging the mouse in matlab

二次信任 提交于 2019-12-13 18:22:01
问题 I want to draw a set of disconnected lines on top of an image by dragging the mouse while pressing the left button. However, if I click on a previously drawn line to specify the starting point of the next line, the callback function is not being called and I don't get the point. Here is my code: function main_test S.fH = figure('menubar','none'); im = imread( 'image.jpg' ); S.aH = axes; S.iH = imshow( im ); hold on axis image; X = []; Y = []; set(S.aH,'ButtonDownFcn',@startDragFcn) set(S.iH,

How do I make something Rotate towards mouse?

痴心易碎 提交于 2019-12-13 17:31:07
问题 I am trying to solve a question which has been bugging me for a while, can someone explain to me how to make the *red rectangle face/aim towards my mouse and explain to me how it works it would be awesome!!! Here is the Fiddle var canvas = document.getElementById('canvas'); var context = canvas.getContext('2d'); var player = { x: 200, y: 200, } drawPlayer = function(something) { context.beginPath(); context.fillStyle = "blue"; context.arc(something.x, something.y, 30, 0, 2 * Math.PI); context

Rotate an object towards mouse position and fire some bullet

痴心易碎 提交于 2019-12-13 17:21:20
问题 Problem I have a GameObject in my scene and I want that GameObject to rotate so it faces my mouse when I click it. After the rotation it's supposed to move in the direction it is now facing. However it almost works. Example For instance lets say the hypotenuse is: 4.592912 and the adjacent is: 3.042814, then i take MathF.Cos(adjacent/hypotenuse) = 0.6625021, now i take MathF.Acos(0.6625021) * MathF.Rad2Deg = 37.95857 GIF from the scene: Code float mouseX, mouseY; float playerX, playerY; float