mouseevent

Drawing SVG with Mouse

白昼怎懂夜的黑 提交于 2019-12-04 14:25:46
问题 I having be exploring several options for building an open-source HTML5 based application like Sketch, which will basically be vector based app for creating UI screens etc. I saw several great JS Libraries like http://snapsvg.io, http://paperjs.orgetc... And creating a static SVG element is as simple as below: var s = Snap("#svg"); // Lets create big circle in the middle: var bigCircle = s.circle(150, 150, 100); What I am not having clue about is, binding the job to mouse move event. So if

How to simulate mouse move and mouse click on Mac using C or C++

一个人想着一个人 提交于 2019-12-04 12:57:21
I am trying to simulate mouse move and mouse click on Mac using C or C++. But unfortunately I don't find any Libraries for the same. I have seen windows.h (works only for Windows) and also swinput (works for linux) Is there anything like that for Mac? CGPostMouseEvent has been deprecated in SnowLeopard. You can replace it with something like CGEventRef mouseDownEv = CGEventCreateMouseEvent (NULL,kCGEventLeftMouseDown,pt,kCGMouseButtonLeft); CGEventPost (kCGHIDEventTap, mouseDownEv); CGEventRef mouseUpEv = CGEventCreateMouseEvent (NULL,kCGEventLeftMouseUp,pt,kCGMouseButtonLeft); CGEventPost

canvas get points on mouse events

非 Y 不嫁゛ 提交于 2019-12-04 12:54:58
I am having the following function to get the mouse click positions(coordinates). $('#myCanvas').on('click', function(e) { event = e; event = event || window.event; var canvas = document.getElementById('myCanvas'), x = event.pageX - canvas.offsetLeft, y = event.pageY - canvas.offsetTop; alert(x + ' ' + y); }); I need to get the mouse point on clicking a position and also secound mouse point position after draging the same. ie., mousedown point and mouseup points. Try a little different setup: var canvas = myCanvas; //store canvas outside event loop var isDown = false; //flag we use to keep

Using Linux virtual mouse driver

让人想犯罪 __ 提交于 2019-12-04 12:19:05
I am trying to implement a virtual mouse driver according to the Essential Linux device Drivers book. There is a user space application, which generates coordinates as well as a kernel module. See: Virtual mouse driver and userspace application code and also a step by step on how to use this driver. 1.) I compile the code of the user space application and driver. 2.) Next i checked dmesg output and have, input: Unspecified device as /class/input/input32 Virtual Mouse Driver Initialized 3.) The sysfs node was created properly during initialization (found in /sys/devices/platform/vms/coordinates

WPF RepeatButton MouseUp

与世无争的帅哥 提交于 2019-12-04 12:16:51
Is there a way to get the MouseUpevent on the repeatbutton to fire when the button is not pressed anymore? I am trying to use the MouseMove event to track the position of the mouse while the button is pressed, but neither MouseDown nor MouseUp fire an event for the left mouse button. Any ideas or advice as to what can be done? Thank you It appears that the repeat button is marking the event as handled internally. You can use the PreviewMouseLeftButtonUp tunneling event to catch the event before RepeatButton marks it as handled: <RepeatButton x:Name="bob" PreviewMouseLeftButtonUp="bob_MouseUp"

Is there a way to make controls transparent to mouse events in WPF?

倾然丶 夕夏残阳落幕 提交于 2019-12-04 09:04:55
问题 Is there a way that I can let mouse events pass through to controls behind? 回答1: Sure, just set IsHitTestVisible="False" on the control. Mouse events will pass through it. 回答2: I usually solve these kind of issues by adding handlers of child controls to the parent at construction. This way the 'click'-event for example activates a method that raises the 'click'-event of the parent. 来源: https://stackoverflow.com/questions/4226770/is-there-a-way-to-make-controls-transparent-to-mouse-events-in

Detect user scroll attempt when overflow is hidden

二次信任 提交于 2019-12-04 08:08:49
"scroll" does not fire when content is overflow: hidden . "wheel" fires for wheel mouses but not on a magic trackpad or magic mouse . How can I detect the mouse interaction of attempting to scroll in this scenario? You can get the mouse coordinates and other properties like movement easily. Using that position you can choose when trigger an wheel event or just make the script to scroll the page. check this fiddle (not mine) to get inspired 来源: https://stackoverflow.com/questions/32512924/detect-user-scroll-attempt-when-overflow-is-hidden

Show popup if the mouse is hovered over an element for a period of time

為{幸葍}努か 提交于 2019-12-04 05:47:04
I'm wondering how to show a popup/tipbox when a mouse has been hovered over an element for a period of time, e.g. pseudo code: if mouseover if hovered for more than 2 seconds --> show popup/tipbox else ---> cancel mouseover else if mouseout --> reset timer/cancel mouseover I've done this so far, but it doesn't work effectively, if I hover and move the mouse quickly, it will still show the popup/tipbox. $('a[rel=tip]').live('mouseover mouseout', function(e) { if(e.type == 'mouseover') { var mouseTime = setTimeout(function() { $('.tipbox').slideDown('fast'); }, 1000); } else if(e.type ==

Changing value of boolean when mouse cursor hovers over a JButton

孤街浪徒 提交于 2019-12-04 05:33:56
问题 I have a button that will change from black to gray when you hover over, I do this with setRolloverIcon(ImageIcon); . Is there any easy way to make a boolean equals to true while the mouse cursor hovers over the JButton or would I have to use a MouseMotionListener to check the position of the mouse cursor? 回答1: Is there any easy way to make a boolean equals to true while the mouse cursor hovers over the JButton you can to add ChangeListener to ButtonModel , e.g. JButton.getModel()

WPF StackPanel with Click AND DoubleClick

旧巷老猫 提交于 2019-12-04 05:13:01
I need to be able to handle the double click and single click event on the WPF StackPanel. But there is no such thing as the StackPanel's DoubleClick Event. I want to do 2 different operations in these 2 EventHandlers. Any idea how to do that? Thank you The best way is to right your own mouse button handler with a timeout - if the event is fired again within the timeout period, then fire your doubleclick message, otherwise call the single click handler. Here's some sample code ( Edit: originally found here ): /// <summary> /// For double clicks /// </summary> public class MouseClickManager {