mouse-position

How to get specific text value from a textbox based upon the mouse position

你。 提交于 2019-12-12 09:34:35
问题 I have a multi-line text box that displays some values based on data it gets given, (Generally one value per line). (For the purpose of having a tool tip popup with some 'alternative' data) I would like to get the word (or at the very least the line) that the mouse is hovering over so I can then find what alternative to display. I have a few ideas of how to do this with calculations based on the text box and font sizes but I do not what to go down this road as the sizes and fonts may change

find closest point to mouse position

血红的双手。 提交于 2019-12-12 01:59:34
问题 I've got a grid of sprites. Now I would like to drag an image on a grid-element. Therefore I need to know which x/y of the grid-element is the closest point to the mouse-position. All the grid-elements are stored in an array. How can I achieve that? 回答1: If all you need is the x,y of the closest grid then all you have to do is. var gridX:int = Math.floor(mouseX / NumberOfColumns); var gridY:int = Math.floor(mouseY / NumberOfRows); This will convert your mouse coordinates to your grid

Drag 3d object using fingers in unity3d

喜欢而已 提交于 2019-12-11 11:12:10
问题 I create a scene has an AR camera and a 3d object. When application starts, I see the object on the screen. I want to move this object using fingers. I tried many codes. But I couldn't find a nice solution for me. AR camera is tagged MainCamera . I use below code, and the result is unexpected for me. I click on object and the console output is here: How can I move 3d object to mouse click position? I don't use any marker. Vector3 vect3 = Camera.main.WorldToScreenPoint(car.transform.position);

Determine whether the mouse is over a control? (over a Control pixel range)

て烟熏妆下的殇ゞ 提交于 2019-12-11 03:44:34
问题 I'm trying to write a function that should determine whether the mouse is over a range in pixels (the pixel range of a specific Control) The problem is that the function only works for the bounds of the Form , don't work for buttons or any other control that I've tested ...what I'm missing? ''' <summary> ''' Determinates whether the mouse pointer is over a pixel range of the specified control. ''' </summary> ''' <param name="Control">The control.</param> ''' <returns> ''' <c>true</c> if mouse

event.clientX showing as 0 in firefox for dragend event

让人想犯罪 __ 提交于 2019-12-10 12:33:28
问题 function move(e,obj,but){ if(typeof(obj) === 'string'){ obj = document.getElementById(obj) ; } if(typeof(but) === 'string'){ but = document.getElementById(but) ; } //elementCoord(but) ;//get the current coords of the button & elementCoord(obj) ;//the container e = e || window.event ; var mouseX = e.clientX ; var mouseY = e.clientY ; //alert('mouseX='+mouseX+', but.XCoord '+but.XCoord) ; var diffX = Math.abs(obj.XCoord - mouseX) ; var diffY = Math.abs(obj.YCoord - mouseY) ; but

Finding Mouse Position relative to a panel

泪湿孤枕 提交于 2019-12-08 17:43:35
问题 I'm trying to get the mouse's position within a panel, as in the top left of the panel = x/y 0,0. What I have at the minute gives the position on the entire screen, so depending on where the panel (which is in a frame) is on the screen, the coordinates are different. I guess you could add to the x/y co-ordinates to account for this, but this seems like a messy solution. Can anyone help? Here's the mouseListener I'm using, which has been added to the panel. private class MouseListener extends

Mouse position on mouseover event

牧云@^-^@ 提交于 2019-12-08 16:45:42
问题 Is it possible to get the exactly mouse position in a mouseouver event of a image? If i use a function that update the mouse position on document mouse move event I can have problems with delay and this kind of thing and wouldn't get the EXACTLY position 回答1: If you are looking for a simple JS to get the cursor position for a MouseOver event, here is the sample code: <!DOCTYPE html> <html> <head> <script> function getPos(e){ x=e.clientX; y=e.clientY; cursor="Your Mouse Position Is : " + x + "

How to check if webpage page is scrolled? [duplicate]

亡梦爱人 提交于 2019-12-08 16:10:02
问题 This question already has answers here : How do I determine height and scrolling position of window in jQuery? (4 answers) Closed 5 years ago . Is there any way in javascript to check if web page has been vertically scrolled? specially for Internet Explorer? I need to get the mouse position in IE but using jQuery event e.pageY it gives correct value when page is not scrolled but when page is scrolled down then it gives wrong position. 回答1: Check out this question if you are comfortable with

How do I set the position of the mouse cursor from a Console app in C#?

自作多情 提交于 2019-12-07 03:38:43
问题 I've found many articles on how to set the mouse position in a C# windows forms project - I want to do this in a console application. How can I set the absolute mouse position from a C# windows console application? Thanks! Hint: it's not Console.setCursorPosition, that only sets the position of the text cursor in the console. 回答1: Inside your console application, add a reference to System.Windows.Forms.dll and use the other techniques you've read about. The choice of console vs windows exe

Move an image according to the mouse cordinates using jquery

家住魔仙堡 提交于 2019-12-06 02:49:47
I am trying to develop a HTML5 white board. I want the users viewing the board to know where exactly the presenter is pointing within the screen. I am able to collect the mouse movements using this jquery function. But even if i succeed to pass this values to other clients using php, how can I emulate it? Is it possible to move a small pointer image, based on the co-ordinates obtained from the presenter? Is there any functions or snippets from which I cant get started? Will this be very hardware intensive task that normal people may have issue? Is this the best way to achieve what I am trying