drag

Constraining window position to desktop working area

▼魔方 西西 提交于 2019-12-07 19:41:17
问题 I want to allow a user to drag my Win32 window around only inside the working area of the desktop. In other words, they shouldn't be able to have any part of the window extend outside the monitor(s) nor should the window overlap the taskbar. I'd like to do it in a way that does cause any stuttering. Handling WM_MOVE messages and calling MoveWindow() to reposition the window if it goes off works, but I don't like the flickering effect that's caused by MoveWindow(). I also tried handling WM

Dragging JPanel

我的梦境 提交于 2019-12-07 19:16:09
问题 I've got a problem when trying to drag a JPanel. If I implement it purely in MouseDragged as: public void mouseDragged(MouseEvent me) { me.getSource().setLocation(me.getX(), me.getY()); } I get a weird effect of the moved object bouncing between two positions all the time (generating more "dragged" events). If I do it in the way described in this post, but with: public void mouseDragged(MouseEvent me) { if (draggedElement == null) return; me.translatePoint(this.draggedXAdjust, this

Change cursor over HTML5 Canvas when dragging in Chrome

两盒软妹~` 提交于 2019-12-07 18:54:50
问题 I was looking at how to change the cursor over an HTML5 canvas when dragging the mouse... Came across this: Change cursor over HTML5 Canvas when dragging the mouse seemed logical that an :active pseudo-selector would do the trick... When I used it on my page, however, the cursor set by the rule in the :active pseudo-selector was ignored, instead showing the text selection cursor. In firefox, this behavior is not present - it obeys the cursor property I set. Here's an example to demonstrate

Dragging on force layout prevents other mouseup listeners

对着背影说爱祢 提交于 2019-12-07 14:21:35
问题 I want to enable dragging in a d3.js force layout. When dragging a circle and release the mouse button, I want to call a specific function via callback, like this: this.force = d3.layout.force() .nodes(this.nodes) .size([this.width, this.height]); // enable dragging this.circle .call(this.force.drag) .on("dragend", function() { console.log("You should see this, when releasing a circle."); }) .on("mouseup.drag",function(d,i) { console.log("Or see this."); }); Unfortunately the event is never

XNA Game does not update while “dragging” window, any event handlers?

懵懂的女人 提交于 2019-12-07 13:37:09
问题 I'm new with XNA and C#, and I've come to the point in my XNA project where I need event handlers to predict when the game loses focus so that I can sync music and visuals once it gains focus again. But I got one problem; the game does not "update" while being dragged, but I can't seem to find an suitable event listener for this. I've tried: System.Windows.Forms.Control.FromHandle(Window.Handle).Move += new EventHandler(DeactivateGame); This one calls "DeactivateGame" tons of times while

Mouseup not working after mousemove on img

最后都变了- 提交于 2019-12-07 03:06:33
问题 I'm trying to do a simple drag script. The idea is to save the position when the mouse is down, update the view while the mouse is moving, and stop when mouse is up. Problem, mouseup event isn't working properly. See the code: var target = $('a') var pos = 0; var dragging = false; $(document).mousedown(function(e) { pos=e.pageX; dragging = true }) $(document).mouseup(function() { dragging = false }) $(document).mousemove(function(e) { if(dragging){ target.css('left', e.pageX-pos); } }) ​ Why

Gesture recognizer within a UIScrollview

大兔子大兔子 提交于 2019-12-06 16:54:09
问题 I've got a scroller within my view and got several images inside this scroller. I'd like to drag and drop these images out (and into) my scroller. I implemented a LongPressGestureRecognizer. I also would like to know (by code) which image got longpressed. I thought I fixed this last one by using CGRectContainsPoint. However my code is not reacting to the CGRectContainsPoint. It still Logs "fail". - (void)viewDidLoad{ //scroller properties scroller.contentSize = CGSizeMake(1300, 130); scroller

Java Application : mouseDragged Event isn't Executed Often Enough

大兔子大兔子 提交于 2019-12-06 16:11:02
Is there a way to make the mouseDragged Event be called more Often ( In my Case, Drawing a Color? I need it for Smooth Drawing, because right now, if you move too fast, it doesn't Draw All my Path. Also, I have an 2D Array Storing the Color of the Pixel, so that's also Problematic if I try to solve by problem by another Way, that's why I thought Increasing the mouseDragged Frequency would be the Best thing to Do Thanks If you want smooth drawing, you'd likely have to interpolate the data yourself. If you get an event at (3,3) and another at (10,10) you can figure the slope between the two, and

Change cursor over HTML5 Canvas when dragging in Chrome

两盒软妹~` 提交于 2019-12-06 15:24:01
I was looking at how to change the cursor over an HTML5 canvas when dragging the mouse... Came across this: Change cursor over HTML5 Canvas when dragging the mouse seemed logical that an :active pseudo-selector would do the trick... When I used it on my page, however, the cursor set by the rule in the :active pseudo-selector was ignored, instead showing the text selection cursor. In firefox, this behavior is not present - it obeys the cursor property I set. Here's an example to demonstrate the behavior. Any idea how to fix this in chrome? Loktar Working Fiddle Add the following for Chrome to

C# WPF DragMove without Window_LocationChanged()

余生颓废 提交于 2019-12-06 12:56:17
I implemented something in Windows Forms similar to DragMove but with boundaries set to 10 units of the margins of the primary screen. When switching over to WPF I found this thread to be useful in achieving the same result. However, since this is a post-move event, what happens is that if my window is dragged beyond the boundaries I set, it "jumps" back. I would like to avoid this effect as it looks terrible. Is there a simple way to avoid the window to be moved outside a given area without using the LocationChanged event? I basically want to restrict the movement of the window before it