Questions tagged [mouse-position]

197 questions
0
votes
1 answer

How to get TextBox's line from mouse position?

I have a TextBox which has many lines of text, it's being update like this: public void UpdateMessageBox(TextBox textBox, string text) { textBox.SelectionStart = 0; textBox.SelectionLength = 0; textBox.SelectedText =…
Dork
  • 1,816
  • 9
  • 29
  • 57
0
votes
1 answer

Add a function to every element that gets clientX

I'm doing a drag and drop thing. When the user grabs the element I need to add an event listener for dragenter to every element. In that listener function I need it to get and save the clientX when the mouse moves over that element. The issue I'm…
Zaper127
  • 155
  • 1
  • 2
  • 11
0
votes
0 answers

ScreenToWorldPoint offset for different resolutions in Unity 2D

I'm developing a 2D game and I need to be able to detect the mouse position in the game world. The thing is, when I'm on the editor it works just fine, but when I run the standalone and set a resolution with an aspect ratio different from the native…
0
votes
1 answer

Getting a panel within a panel with mouse position

I've been looking for this thing... It should be working yet it is not. There must be something I don't get understand or that I'm missing. It's quite a simple problem but I can't seem to solve it. I got Panel1 and Panel2 as shown in this picture.…
Senerio
  • 35
  • 1
  • 9
0
votes
1 answer

C# find mouse location over AxShockwaveFlashObject control

I have below code which gives me mouse location using Form1._MouseMove event, I also captured mouse location over pictureBox control using the same event and the same code. The Code: private void Form1_MouseMove(object sender, MouseEventArgs e) …
iѕєρєня
  • 524
  • 4
  • 14
0
votes
3 answers

Unity - Get Local Mouse Position from the center of the Gameobject clicked on

I want to get the mouse clicked position from the center of the gameobject, say a Sphere of Scale(1, 1, 1), for instance. If I click on the center of the sphere it should return the x component as zero, on clicking to the extreme left of the sphere,…
gameOne
  • 609
  • 1
  • 10
  • 22
0
votes
1 answer

Relative mouse position if element bigger than screen

How can I get the current mouse position relative to a div element that is bigger than the screen with jQuery? In my example the user can scroll around on x and y-Axis but if he clicks I want to get the mouse position relative to the divs origin,…
user3700591
  • 195
  • 2
  • 2
  • 5
0
votes
2 answers

How is it possible to get the forms mouse position when clicking inside a control?

I have a panel and have added a PictureBox to it. I have added mouse_click listeners to both the panel and the picturebox. When they are clicked i create a messagebox which tells me the mouse position. Problem: When i click the panel, i get the…
Ikky
  • 2,826
  • 14
  • 47
  • 68
0
votes
3 answers

Getting javascript mouse position relative to website prefferably without jQuery

I've found this snippet on Ajaxian, but I can't seem to use the cursor.y (or cursor.x) as a variable and when the function is called as such it does not seem to work. Is there a syntax problem or something else? function getPosition(e) { e = e…
Constructor
  • 1
  • 1
  • 3
0
votes
0 answers

Why is mouse position incorrect?

I use Windows 8.1 and an emulator for assembly 8086. I want to design a program in assembly that draws 4 squares and when user clicks on each of them paints this. For example I draw square in position (50,50) to (100,100) pixel, but when click on…
Masoud AMR
  • 134
  • 2
  • 17
0
votes
2 answers

Get Vector3 of Position Clicked on Plane

I want to click on a 3D plane with my mouse. When I do this, I want it to return a Vector3 of where I clicked. When I use: Vector3 point = Camera.main.ScreenToWorldPoint(Input.mousePosition); then, it gives me the Vector3 of the center of the…
Evorlor
  • 7,263
  • 17
  • 70
  • 141
0
votes
1 answer

WPF, EventAggregator instead timer for reading Cursor position

I have wrote a WPF application in which Singleton class reads cursor coordinates and Observer class, that uses it, to publish them in labels. In Singleton class for reading coordinates now I'm using timer. I want to replace him by EventAggregator,…
0
votes
2 answers

My coords are NaN, NaN

I am trying to get the coords of my mouse position on a canvas. but all i get back is NaN, NaN var canvasBg = document.getElementById('canvasBg'); var ctxBg = canvasBg.getContext('2d'); var mouseX; var…
lehermj
  • 916
  • 4
  • 9
  • 20
0
votes
2 answers

jQuery determine mouse position within a div

this is maybe a duplicate question but I havent seen a working solution for me My question is how can I get the mouse position within a div? I dont want the document as origin but the inner div (the pink content div) so when I move the coursor to…
oneandonlycore
  • 480
  • 6
  • 23
0
votes
2 answers

links hover and active color change depending on mouse position with Javascript

I'm using a JS script to change div background colors depending of my mouse position. $(document).mousemove(function(e){ var $width = ($(document).width())/(252 - 23); var $height = ($(document).height())/(253 - 2); var $pageX = 253 -…
mmdwc
  • 1,095
  • 6
  • 27
  • 53