drag

Calculate initial velocity to move a set distance with inertia

故事扮演 提交于 2019-12-30 03:26:08
问题 I want to move something a set distance. However in my system there is inertia/drag/negative accelaration. I'm using a simple calculation like this for it: v = oldV + ((targetV - oldV) * inertia) Applying that over a number of frames makes the movement 'ramp up' or decay, eg: v = 10 + ((0 - 10) * 0.25) = 7.5 // velocity changes from 10 to 7.5 this frame So I know the distance I want to travel and the acceleration, but not the initial velocity that will get me there. Maybe a better explanation

Creating OnDragListener for Google Map v2 Fragment

梦想与她 提交于 2019-12-29 20:58:09
问题 I’m trying to setup an onDrag Listener for a google map fragment, but can’t get the drag event to fire. Since the map doesn't support drag events directly, I'm trying to implement a drag listener for the View. I know about the onMarkerDrag event, but that does me no good since I'm not trying to move markers around. The reason for trapping map drag events is twofold: First to detect if the user has panned the map. If they haven't, I like to keep their location on the screen, and animate to

d3.js scatter plot - zoom/drag boundaries, zoom buttons, reset zoom, calculate median

半世苍凉 提交于 2019-12-29 06:58:07
问题 I've built a d3.js scatter plot with zoom/pan functionality. You can see the full thing here (click 'Open in a new window' to see the whole thing): http://bl.ocks.org/129f64bfa2b0d48d27c9 There are a couple of features that I've been unable to figure out, that I'd love a hand with it if someone can point me in the right direction: I want to apply X/Y zoom/pan boundaries to the area, so that you can't drag it below a certain point (e.g. zero). I've also made a stab at creating Google Maps

Jquery ui, call start drag manually

我们两清 提交于 2019-12-29 05:20:34
问题 In Jquery UI I can configure an element as draggable by invoking $("#drag").draggable(); But is there a way to start and stop the drag functions manually from another function? Ie someOtherFunction = function() { $("#drag").startdrag(); } yetAnotherFunction = function() { $("#drag").stopdrag(); } 回答1: Answers above seem overcomplicated. $('.nonDraggableObjectWhichTriggersDrag').mousedown(function(e) { $('.draggableObject').trigger(e); }); 回答2: Drag start is started via script looking at mouse

Drag UIButton without it shifting to center [Swift 3]

♀尐吖头ヾ 提交于 2019-12-28 18:50:10
问题 So I found out how to make a button draggable using the UIPanGestureRecognizer. But the only way I know how to do it is by storing and dragging the button by the center. The problem with this is if you try and drag the button from a corner, the button instantly shifts from the corner to the center. What I'm looking for is a solution that would keep my finger on a selected place while moving without instantly locking onto the center. The code I'm currently using: func buttonDrag(pan:

Adobe AIR 3.2 Glitch

我只是一个虾纸丫 提交于 2019-12-25 08:24:18
问题 I just finished a successful build of my program last night. Then, I get up this morning, and after an update fro Adobe AIR 3.1 to AIR 3.2, I find THIS bug! The same build under 3.1 works perfectly. However, as soon as 3.2 is installed, the following code after stopDrag fails silently. Mind you, it only fails in the packed and installed AIR application. It works perfectly when I test it inside of Adobe Flash Professional CS5.5 WHAT is going on? Here's the code I'm dealing with. Again, this

Excel repeat cells

那年仲夏 提交于 2019-12-25 06:59:28
问题 I need and approach for this: A B C 1 house 1 house 2 car 1 car 3 boy 1 boy 4 2 house 5 2 car 2 boy 3 house 3 car 3 boy … I want to make a function that when I drag it down I get this result. 回答1: In C1 enter: =ROUNDUP(ROW()/3,0) & " " & INDEX(B:B,IF(MOD(ROW(),3)=0,3,MOD(ROW(),3))) and copy down 回答2: Please try: =INDIRECT("A"&FLOOR(1+(ROW()-1)/3,1))&" "&INDIRECT("B"&MOD(ROW()-1,3)+1) 来源: https://stackoverflow.com/questions/27108739/excel-repeat-cells

HTML5 Drag & Drop : How to remove class added in dragenter in all parent when drop event executed (so dragleave is not executed for removing it)

那年仲夏 提交于 2019-12-25 06:00:09
问题 I Have div included in another parent div that are both allowed for "drop". In the example a class named "red" is added to all droppable object in dragenter event. So if I enter the mouse durring drag in child element both child and parent will get "red" class. When I abort the drag&drop or if I leave elements during operation, the dragleave event will remove the added "red" class. The problem is when I drop the element into child there are two options : Option 1 : event.stopPropagation() is

Draw a triangle using mouse drag (how can I move the previous drawn triangle using mouse drag)

橙三吉。 提交于 2019-12-25 04:49:15
问题 How to move a triangle to a new location using mouse drag (which was previous drawn using mouse drag)? ... java.util.List<Polygon> triangles = new LinkedList<Polygon>(); Point startDrag, endDrag, midPoint; Polygon triangle; ... public PaintSurface() { this.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { startDrag = new Point(e.getX(), e.getY()); endDrag = startDrag; repaint(); }//end mousePressed public void mouseReleased(MouseEvent e) { ... int[] xs = {

d3 drag behavior not working properly on html elements

蓝咒 提交于 2019-12-25 02:59:42
问题 I want to show multiple charts in a table, each chart is a separate svg, generated with d3. The height of each chart has to be easily adjustable - and I want that to be done in a similar manner as you adjust the 4 panels (html, javaScript, css, output) in jsFiddle, by dragging the mouse over a border between those panels - in my case it's only horizontal borders. I'd like to use d3.behavior.drag(). When the border (a div in a td of the table, or something like that) is dragged, the height of