mousemove

How can I get the mouse coordinates relative to a parent div? Javascript

天大地大妈咪最大 提交于 2020-01-01 04:14:07
问题 I currently have a div structured with other elements inside of it. Something similar to below; <div id="container" style="position: relative; width: 500px; height: 500px;"> <div style="position: absolute; left: 50px; top: 50px;"></div> <div style="position: absolute; left: 100px; top: 100px;"></div> </div> I am trying to get the mouse position relative to the div with the id container . So far I have this; function onMousemove(event) { x = event.offsetX; y = event.offsetY; }; var elem =

How to prevent ggplot hoverOpts messages to go off screen with css

心已入冬 提交于 2019-12-31 05:27:12
问题 When running the demo App below, the problem I run into is that hover messages for the bottom part of the plot end up running off the screen. Does anybody know if there is a way to adjust the position so that the entire message always falls within the screen boundaries (l,r,t,b)? require('shiny') require('ggplot2') library(DT) ui <- pageWithSidebar( headerPanel("Hover off the page"), sidebarPanel(width = 2 ), mainPanel( tags$head( tags$style(' #my_tooltip { position: absolute; pointer-events

Moveable/draggable <div>

三世轮回 提交于 2019-12-27 16:41:17
问题 This is my updated and modified script, it works completely, except I would like to universalize it... observe the **** how can I make it so that I don't have to do function(e){BOX.Draggable.elemen = e.target || e.srcElement; elementDraggable(e); everytime I need to use the dragable function for a different element? window.onload = addListeners; var BOX = function(){ return{ Draggable: function(){} }; }(); function addListeners(){ document.getElementById('div').addEventListener('contextmenu',

Moveable/draggable <div>

*爱你&永不变心* 提交于 2019-12-27 16:40:13
问题 This is my updated and modified script, it works completely, except I would like to universalize it... observe the **** how can I make it so that I don't have to do function(e){BOX.Draggable.elemen = e.target || e.srcElement; elementDraggable(e); everytime I need to use the dragable function for a different element? window.onload = addListeners; var BOX = function(){ return{ Draggable: function(){} }; }(); function addListeners(){ document.getElementById('div').addEventListener('contextmenu',

getting mouse position of different control

妖精的绣舞 提交于 2019-12-25 05:37:10
问题 I have a panel (panel2) inside another panel (panel1). I want to get mouse position of panel1, but when I move my mouse over panel2, the following code stops working. private void panel1_MouseMove(object sender, MouseEventArgs e) { label1.Text = "Offset: " + e.X + " x " + e.Y; } How can I get it to read the mouse arguments, even if the mouse is over panel2? Thanks! EDIT: panel2 is located at center x=100, y=100 of panel1. if I move my mouse on panel2 left top corner it gives me coordinates

Navbar that Appears When Mouse Moves and Disappears when Still

半城伤御伤魂 提交于 2019-12-25 03:06:20
问题 I would like to have my navigation bar only appear when the mouse is moved, and otherwise not be seen. It is fixed positioned. I tried using $( "html" ).mousemove(function() { etc... But it seems to register even when I leave the mouse completely still that the mouse is moved. What may make this a little tricky is that I want the navbar to appear when the mouse is moved anywhere in the document, not just in the navbar area. Whenever the mouse is not moved, the navbar should not be visible.

Move form without border through a panel

北城余情 提交于 2019-12-25 02:23:01
问题 I been searching around for a solution for my problem but for now I wasn't able to get any sucessfull code for what I want to do. So, I have a form without border that is filled with 2 custom panels, so there is no way to the user click on the frame, thinking in that, I implement a code that when user click on a panel, this will call a function on my form that recive by parameter the event of the mouse. This is the code of my Panel (note that both of my panels in the frame are the same class,

Python overlay window [closed]

限于喜欢 提交于 2019-12-25 01:15:29
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . In a Python program I want to draw a (possibly shaped) overlay window under the mouse pointer, that should follow it (I already have the code to get its new coordinates on mousemove) and must not interfere with

Getting “maximum recursion depth exceeded” with Python turtle mouse move

北城以北 提交于 2019-12-24 21:23:21
问题 This code should utilize mouse motion events to draw a dot at the current mouse position: import turtle def motion(event): x, y = event.x, event.y turtle.goto(x-300, 300-y) turtle.dot(5, "red") turtle.pu() turtle.setup(600, 600) turtle.hideturtle() canvas = turtle.getcanvas() canvas.bind("<Motion>", motion) The code works as expected for a few seconds or longer if the mouse is moved very slowly. Then it throws: >>> ====================== RESTART: C:/code/turtle_move.py ======================

“Ghost” MouseMove event in WinForms

断了今生、忘了曾经 提交于 2019-12-23 09:56:05
问题 I have a custom control that updates two NumericUpDowns with the current mouse coordinates by handling the MouseMove event. However I have experienced a strange case where the MouseMove event is fired even when this should not happen (I have turned off my wireless mouse and disabled the trackpad). So, MouseMove happens even if the mouse does not move. I've made a simple check and verified that between these "ghost" MouseMove events the position of the mouse pointer does not change. I