drag

How to drag an image to move it smoothly on screen, with ActionScript?

ⅰ亾dé卋堺 提交于 2019-12-01 21:00:38
I was thinking this is a simple task, but I'm wrong. I used a sprite to display an image, and when user drag it(MOUSE_DOWN and MOUSE_MOVE), I got the position in MOUSE_MOVE and calculated the offsets: var current: Point = new Point(event.localX, event.localY); sprite.x = current.x - start.x; sprite.y = current.y - start.y; It works but not smooth. Is there a better solution? UPDATE After a day of debugging, I finally found the reason. Bigger fps can make it smoother, but it's not the key of this question. The key is I should use stage to listen MOUSE_MOVE , not the image itself. And when

Overflow hidden and input text scrolling in Google Chrome

血红的双手。 提交于 2019-12-01 19:34:31
问题 Here is my code snippet: http://jsfiddle.net/7CuBV/6/ If i click and drag over the input text field, I get the div with overflow:hidden scrolling as it would do with overflow:auto. If I set overflow:hidden on a div, I want the scrolling to be locked as other browsers do. The curious thing is that if I set padding:0px on the input field, the issue on Chrome does not occur anymore. Is it a Google Chrome bug? Any workaround to make it work without the use of Javascript? EDIT: This behaviour

C#: How to drag a from by the form and its controls?

岁酱吖の 提交于 2019-12-01 17:09:56
问题 I use the following code to drag a borderless form, by clicking and dragging the form itself. It works, but it doesn't for when you click and drag a control located on the form. I need to be able to drag it when clicked on some of the controls but not others - drag by labels, but don't by buttons and text boxes. How do I do it? protected override void WndProc(ref Message m) { base.WndProc(ref m); const int WM_NCHITTEST = 0x84; const int HTCLIENT = 0x1; const int HTCAPTION = 0x2; if (m.Msg ==

C#: How to drag a from by the form and its controls?

坚强是说给别人听的谎言 提交于 2019-12-01 17:04:33
I use the following code to drag a borderless form, by clicking and dragging the form itself. It works, but it doesn't for when you click and drag a control located on the form. I need to be able to drag it when clicked on some of the controls but not others - drag by labels, but don't by buttons and text boxes. How do I do it? protected override void WndProc(ref Message m) { base.WndProc(ref m); const int WM_NCHITTEST = 0x84; const int HTCLIENT = 0x1; const int HTCAPTION = 0x2; if (m.Msg == WM_NCHITTEST && (int)m.Result == HTCLIENT) m.Result = (IntPtr)HTCAPTION; } Actually, I found the

replace mousemove by mousedrag?

♀尐吖头ヾ 提交于 2019-12-01 14:53:26
The title explains it all.I am facing problem when it comes to providing drag event.I tried replacing mousemove by mousedown,may be mousedown fires once and settles down,but it dint help.How can i programmatically do this. In case you want to refer what code i am trying to manipulate you can refer this code .Else ignore it. <script> $(document).ready(function () { $(".toolImage").mouseover(function () { $(this).parent(".toolTip").find(".toolTipDesc").css("display", "block"); }); $(".toolImage").mouseleave(function () { $(this).parent(".toolTip").find(".toolTipDesc").css("display", "none"); });

Xcode iOS push down button and drag then up on a second button

若如初见. 提交于 2019-12-01 12:20:24
Lets say I wan't to add 1 to an integer. This will only be done when I push down on a UIButton and then release my finger on another UIButton . A drag combo. Whats the easiest way I can make an IBAction occur out of a combo? This could be done with touch coordinates or maybe just UIButtons and IBActions . How do I create a 2-button combo with IBActions Try implementing the button you wish to touch down on as a "Touch Down", "Touch Up Inside", and "Touch Up Outside" button. UIButtons can respond to many differing types of events Touch Cancel Touch Down Touch Down Repeat Touch Drag Enter Touch

how to drag object

狂风中的少年 提交于 2019-12-01 08:43:10
i want to drag a box and i want my mouse cursor to be where i clicked in a rectangle while im draging rectangle. i tried this code and i got bunch of errors when i tried to drag. import objectdraw.*; import java.awt.*; public class TouchWindow extends WindowController { private FilledRect a; private boolean b; private Location c; private int x; private int y; public void begin() { b=false; a=new FilledRect(0,0,50,50,canvas); } public void onMouseClick(Location pt) { if(a.contains(pt)) { b=true; pt=c; } } public void onMouseDrag(Location pt2) { if(b==true) { x=(int)c.getX()-(int)pt2.getX(); y=

How to change cursor when dropping into Java application

早过忘川 提交于 2019-12-01 07:01:20
问题 I'm having some problems I just can't figure out... I'm writing a Swing Java application with a JList that accepts drag-and-drops. I want to change the cursor while dragging a file or folder from my system over the Java application. 回答1: I've found it myself... Thanks Clinton for answering though. Here's what I've used: first create the JList... You all know how to do that... Then I've added a setDropTarget: lstFiles.setDropTarget(new DropTarget() { @Override public synchronized void drop

Drag-select with ListBox

核能气质少年 提交于 2019-12-01 04:02:09
问题 I have a simple implementation of a ListView in WPF that allows me to select multiple items in the list by holding the mouse button and dragging over the items. However, while holding the mouse button down, when I move the mouse outside the ListView , something strange happens with the selection. Ideally, I would just want the selection to remain the same, but instead it quickly cycles through all the selected items, leaving only the last item selected. Here's the code, have any ideas? public

Moving object with mouse

落花浮王杯 提交于 2019-12-01 04:00:15
问题 I use Qt and I want to move some object with mouse. For example, user clicks on object and drag this object to another place of window. How I can do it? I tried mouseMoveEvent: void QDropLabel::mouseMoveEvent(QMouseEvent *ev) { this->move(ev->pos()); } but unfortunately object moves very strange way. It jumps from place to place. QDropLabel inherits QLabel. Also it has given a pixmap. I tried to do it with different objects, but result is same. 回答1: Your movable widget must have a QPoint