drag

Jquery ui, call start drag manually

孤者浪人 提交于 2019-11-29 01:56:42
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(); } Answers above seem overcomplicated. $('.nonDraggableObjectWhichTriggersDrag').mousedown(function(e) { $('.draggableObject').trigger(e); }); Drag start is started via script looking at mouse events. mouse down followed by a mouse move. If you can simulate those mouse movements via Javascript (I don't

WPF Listbox auto scroll while dragging

孤街浪徒 提交于 2019-11-28 21:11:08
I have a WPF app that has a ListBox . The drag mechanism is already implemented, but when the list is too long and I want to move an item to a position not visible I can't. For example, the screen shows 10 items. And I have 20 items. If I want to drag the last item to the first position I must drag to the top and drop. Scroll up and drag again. How can I make the ListBox auto scroll? Artur Carvalho Got it. Used the event DragOver of the ListBox , used the function found here to get the scrollviewer of the listbox and after that its just a bit of juggling with the Position. private void

Drag objects in canvas

孤人 提交于 2019-11-28 17:58:36
Im looking for an easy to use method of assigning drag behavior to multiple objects (images, shapes etc) in canvas. Does anyone have a good way or know of any libraries for dragging objects around? Thanks Creating your own mouse events takes a little work - ideally you should either create or use some kind of mini-library. I'm thinking of creating something like this in the near future. Anyway, I created a drag and drop demo on jsFiddle showing how to drag images - you can view it here . You can create draggable images like this: var myImage = new DragImage(sourcePath, x, y); Let me know if

JavaScript Drag & Select functionality done right

雨燕双飞 提交于 2019-11-28 17:48:17
问题 I'm trying to write a drag & select functionality using HTML & JavaScript. By that I mean that there will be a set of objects with arbitrary absolute positions. I want to be able drag the cursor over the area where they are laid out. Think of it as an RTS strategy (selecting units) or alternatively any vector graphics editor (selecting objects for moving them around and editing). First of all I'm aware of things that come up in the first few pages of Google & SO. Therefore I'm by no means

How to mimic two-finger scroll/drag gesture on ios simulator?

你说的曾经没有我的故事 提交于 2019-11-28 16:49:21
I have a scroll page that I specified two fingers minimum. It works on my device, but don't know how to mimic this gesture on Simulator. I can mimic one-finger scroll without problem. I've tried option/ctrl/shift etc, but couldn't get it work. Maybe my combination is wrong. Anyone knows how? Thanks. Joe C Holding the "Alt/Option" key and dragging simulates multi-touch pinch-to-zoom. Holding "Alt/Option + Shift" and dragging simulates multi-touch scrolling. There is a nice table with all the supported gestures in the iOS Simulator User Guide from Apple. Here is the extract for the two-finger

Drag an image only horizontally or vertically in android?

こ雲淡風輕ζ 提交于 2019-11-28 13:37:42
问题 I want to control the dragging way of the image in android. It should be moved only in one direction. How can i control it? 回答1: First, put a ScrollView inside a HorizontalScrollView , and the ImageView inside the innermost ScrollView. Hierarchy will look like this: LinearLayout (ROOT) | +-- ScrollView (V) | +-- LinearLayout (1) | +-- HorizontalScrollView (H) | +-- LinearLayout (2) | +-- ImageView And let me explain: (V) scrolls in vertical direction only. (H) scrolls in horizontal direction

Drag and move a picture inside a JLabel with mouseclick

折月煮酒 提交于 2019-11-28 13:06:25
I have an image inside a JLabel. JLabel label = new JLabel(new ImageIcon("C:\\image.jpg")); label.setSize(300,300); I want the following functionality. -I click on a location inside the JLabel (on the image). -With the mousebutton pressed, I can change the location of the image within the JLabel. (I drag the picture to different positions within the JLabel) Well, this means that in many instances the picture will be cropped and outside of view. Please tell me how to implement this functionality? What are the correct event listeners to add to my JLabel? This is a basic example... It works by

What's preserving local offset in this d3.drag example?

限于喜欢 提交于 2019-11-28 09:18:46
问题 When dragging any circle in this d3 example, what prevents the circle's center from snapping to the mouse? In other words: when you initiate a circle drag by clicking somewhere near the outer edges of the circle , what in the code preserves the offset (relative to the circle's center) that's implied at drag start? I see these .attr() calls: .attr("cx", d.x = d3.event.x) .attr("cy", d.y = d3.event.y) But I expect d3.event.x (and .y ) to be the coordinates of the mouse — without accounting for

how to use correct dragging of a view on android

丶灬走出姿态 提交于 2019-11-28 08:49:41
it seems that there are a lot of solutions of how to use dragging of views on android . however, they are either too slow or buggy. a known solution is to have a framelayout , and the view simply changes its layoutParams as it moves using the OnTouchListener ,as described here: http://www.anddev.org/novice-tutorials-f8/android-drag-and-drop-of-normal-views-not-bitmaps-t13404.html however, if the view is an imageView , when reaching the most right (or most bottom) side of the framelayout , the image shrinks . another possible solution is to use the canvas in order to show the dragged content ,

getting the position of an image after drag in android

大兔子大兔子 提交于 2019-11-28 05:25:06
问题 hi i need to drag an image in my app and ia m doing that using following code <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ImageView android:id="@+id/imageView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/csf6a4_flipped" android:scaleType="matrix" > </ImageView> </FrameLayout> and package com.example