Questions tagged [mouse-position]

197 questions
4
votes
1 answer

How can I detect the mouse position anywhere on the screen?

I'm working in MATLAB and I want to get the cursor position from anywhere on the screen. I would like to continuously get the position of the cursor while the mouse is moving. However, I found that MATLAB can get the mouse position while the mouse…
user3813611
  • 43
  • 1
  • 4
4
votes
1 answer

getting position of rectangle in canvas

I'm making a software that just displays a shape in a canvas and if the user clicks that shape , it disappears and another shape is shown and so on. My question is how can I check if the user did click on the shape ? My solution is to get the…
Makram Bg
  • 111
  • 1
  • 1
  • 6
3
votes
2 answers

HTML5/Canvas Mouse Position off when placed in actual Site

I'm capturing mouse position like this mouse_move: function(e) { mousePos.x = e.pageX - vr.o.context.canvas.offsetLeft; mousePos.y = e.pageY - vr.o.context.canvas.offsetTop; }, and it has worked like a dream in all…
jondavidjohn
  • 61,812
  • 21
  • 118
  • 158
3
votes
3 answers

mouseX/Y confusion when dragging a child of a container

I've got a grid of images which are added to a imagecontainer(Sprite) in a class. When I click a button, the imagecontainer gets tweened(scaled) to 0.2 Now I would like to start dragging around the images. on mouse-down I add an enterFrame Event:…
algro
  • 639
  • 4
  • 8
  • 25
3
votes
1 answer

Getting correct mouse position in a CSS scaled canvas

I have been trying to take the logic of a couple simple MooTools operations and convert it to work with jQuery. The logic I want is for this jsfiddle what it allows is to get accurate mouse position on a canvas element with css resizing. I found the…
austinbv
  • 9,297
  • 6
  • 50
  • 82
3
votes
2 answers

Detecting position of mouse click within an image on varied screen sizes - Jquery/JavaScript

I've got an initial div called "container" which is a height:100% width:100% image of an Oklahoma map. The idea is that when the user clicks a certain section of the map (for this example, the panhandle), the div is toggled to a div which is the…
Briz
  • 548
  • 1
  • 9
  • 21
3
votes
2 answers

Write absolute mouse position in TextBox

I have the following issue: I have window with two textboxes. When I click in a textbox and then click anywhere else (even outside the window), the mouse click position should be written into the textbox. I found the MouseKeyHook library, in which a…
David P
  • 317
  • 2
  • 3
  • 9
3
votes
3 answers

How can I move an UI Image to a touch position?

I have an image on the scene. Now when I touch on my mobile device to a specific position, I want, that the image moves to this position. How can I do it? I wrote this: transform.position = Input.mousePosition; But this don't work. Ok, it's…
Johnny
  • 612
  • 3
  • 13
  • 32
3
votes
3 answers

How to move unity prefab to mouse click position?

I create an unity3d application that loads prefab and move it. I can load a cube prefab using world coordinate.I want to move this object to mouse click position. To do this work, I use below code. My object doesn't move anywhere. public…
zakjma
  • 2,030
  • 12
  • 40
  • 81
3
votes
1 answer

Mouse pointer position when pointer is not on winform

I'm able to get the mouse position when it is within the form. Here is my code- private void Form1_MouseMove(object sender, MouseEventArgs e) { lblXPosition.Text = MousePosition.X.ToString(); lblYPosition.Text =…
Code It
  • 396
  • 1
  • 6
3
votes
3 answers

Top and left value of a fixed position changed in various browsers

I am seeing a strange issue with mouse position in a page on my web application. I thought the position of a particular element on the page will be the same irrespective of the browser it is rendered in. I was hoping to use the position values from…
Alley
  • 31
  • 2
3
votes
2 answers

Python/Pygame mouse position not updating and program losing focus

I'm trying to learn Python/Pygame. I created a program that would use the Mouse position, but both when I run it from IDLE and from the Command prompt the mouse position doesn't update, and when I click on the graphic window it get into…
Enthuziast
  • 1,195
  • 1
  • 10
  • 18
3
votes
2 answers

kineticjs stage.getAbsoluteMousePosition()?

I am playing with kineticjs with a draggable and zoomable stage and I'd like to know if there is a way to get the stage.getAbsoluteMousePosition() as we can have the absolutePosition of a Node. Here is the jsfiddle showing a use case, note the…
zipp
  • 1,116
  • 13
  • 27
2
votes
1 answer

How to find the mouse position inside an element

I used this code, but it's well only for Y-coordinate $('div').mousemove(function(e){ var x = Math.floor(e.pageX - $(this).offset().left); var y = Math.floor(e.pageY - $(this).offset().top); $('.status').html(x+'…
Fifa Lan
  • 61
  • 3
2
votes
1 answer

Why does it draw far away from the cursor on a canvas?

I'll first give my code: document.documentElement.style.backgroundImage='url(\'data:image/svg+xml,
Lakshya Raj
  • 1,669
  • 3
  • 10
  • 34
1 2
3
13 14