onmousemove

Snap to grid mouse locking up

删除回忆录丶 提交于 2019-12-09 21:09:53
问题 I am working on an application which draws a simple dot grid. I would like the mouse to snap between the points on the grid, eventually to draw lines on the grid. I have a method which takes in the current mouse location (X,Y) and calculates the nearest grid coordinate. When I create an event and attempt to move the mouse to the new coordinate the whole system becomes jerky. The mouse doesn't snap smoothly between grid points. I have copied a code sample below to illustrate what I am

How to Show Ballon tooltip when mouse stops

Deadly 提交于 2019-12-08 04:55:08
问题 [edit] So I used one of the javascript tooltips suggested below. I got the tips to show when you stop and hide if you move. The only problem is it works when I do this: document.onmousemove = (function() { var onmousestop = function() { Tip('Click to search here'); document.getElementById('MyDiv').onmousemove = function() { UnTip(); }; }, thread; return function() { clearTimeout(thread); thread = setTimeout(onmousestop, 1500); }; })(); But I want the function to only apply to a specific div

Mouse on left of screen move image to left, same when mouse on right of screen

走远了吗. 提交于 2019-12-07 15:50:14
问题 I'm trying to get an image that is around 1920x1200px to pan around on a 800x600px browser window. So if my mouse is on the top-left of the browser window the image is alined so it's top-left margins are on the top-left of the browser window. The same goes for the bottum-right. So if the mouse is in the centre of the screen the image should be centered too. Im not sure what calculations are needed as my math is a bit rusty. Currently I'm using a bit of javascript that just moves the image

OnmouseMove not work with SetTimeOut and Alerts in Chome

白昼怎懂夜的黑 提交于 2019-12-06 13:32:22
问题 What's wrong with this code? It works in IE and FireFox, but Chrome does not work. The idea is that the function fnTimeOut will be triggered in 5 seconds after onmousemove (fnTimeOut was attach in onmousemove in document). It´s ok. But when, in Chrome, I click on the button "ok" to function fnAlert is triggered instantly. It should be shot just 5 seconds after I move the mouse ... help me please. <input type="button" onclick="alert(1);" value="ok"> <script> document.onmousemove = fnTimeOut;

Mouse on left of screen move image to left, same when mouse on right of screen

删除回忆录丶 提交于 2019-12-06 00:19:19
I'm trying to get an image that is around 1920x1200px to pan around on a 800x600px browser window. So if my mouse is on the top-left of the browser window the image is alined so it's top-left margins are on the top-left of the browser window. The same goes for the bottum-right. So if the mouse is in the centre of the screen the image should be centered too. Im not sure what calculations are needed as my math is a bit rusty. Currently I'm using a bit of javascript that just moves the image using CSS's top/left properties but without much success as it's just moving the picture around from it's

How to determine if mouse is moving clockwise or counterclockwise?

≡放荡痞女 提交于 2019-12-05 04:56:32
问题 I have an MFC appplication where the user have to move the mouse around a circle circonference with a dragging mouvement. I need to retrieve the number of degrees during this mouse drag "rotation" and I need to know if it's clockwise or counterclockwise. At first, to determine the rotation direction, I was comparing x-coordinnate between the current mouse position and the mouse position where the user clicked to initiate the dragging. That works well until the user rotate over 180 degrees.

Why does OnMouseMove fire repeatedly when the mouse is not moving in D2010?

 ̄綄美尐妖づ 提交于 2019-12-05 03:03:39
I'm porting a Delphi 5 app to D2010, and I've got a bit of a problem. On one form is a TImage component with an OnMouseMove event that's supposed to update a label whenever the mouse is moved over the image. This worked just fine in the original app, but now the OnMouseMove event fires constantly whenever the mouse is over the image, whether it's moving or not, which causes the label to flicker horribly. Does anyone know what's causing this and how to fix it? My psychic debugging sense tells me that you are on Windows, the label is a tooltip window and you are updating on every mousemove. In

OnmouseMove not work with SetTimeOut and Alerts in Chome

☆樱花仙子☆ 提交于 2019-12-04 18:11:15
What's wrong with this code? It works in IE and FireFox, but Chrome does not work. The idea is that the function fnTimeOut will be triggered in 5 seconds after onmousemove (fnTimeOut was attach in onmousemove in document). It´s ok. But when, in Chrome, I click on the button "ok" to function fnAlert is triggered instantly. It should be shot just 5 seconds after I move the mouse ... help me please. <input type="button" onclick="alert(1);" value="ok"> <script> document.onmousemove = fnTimeOut; var t = null; function fnAlert() { alert(2); } function fnTimeOut() { clearTimeout( t ); t = setTimeout(

Snap to grid mouse locking up

徘徊边缘 提交于 2019-12-04 17:04:38
I am working on an application which draws a simple dot grid. I would like the mouse to snap between the points on the grid, eventually to draw lines on the grid. I have a method which takes in the current mouse location (X,Y) and calculates the nearest grid coordinate. When I create an event and attempt to move the mouse to the new coordinate the whole system becomes jerky. The mouse doesn't snap smoothly between grid points. I have copied a code sample below to illustrate what I am attempting to do. Does anyone have any advice they could offer me as to how I can eliminate the jumpiness

Move a PictureBox with mouse

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 22:06:33
问题 I'm developing an app for windows mobile (Compact Framework 2.0). It has a WinForms with a PictureBox. I want to move the image of the PictureBox but I don't know how to do it so I choose to move the hole PictureBox. To do it I use this event: private void imagenMapa_MouseMove(object sender, MouseEventArgs e) { imagenMapa.Left = e.X; imagenMapa.Top = e.Y; this.Refresh(); } But when I move the PictureBox it blinks and moves every where. What I'm doing wrong? 回答1: The e.X and e.Y are relative