drag

Google Line Chart: drag to adjust value

删除回忆录丶 提交于 2019-12-03 12:49:29
问题 I've recently dropped use of Graphael and and extensions package Ico. I think it's still a great library, it just needs better documentation and a proper API before it can be widely adopted. I've converted the areas with charting to use Google Charts and can't seem to find a way to do one particular feature I used graphael for: drag support. One of my line charts needs to be editable, meaning that individual dots on the line can be dragged up and down to adjust value. I've been trying to find

D3 force layout: making pan on drag (zoom) smoother

元气小坏坏 提交于 2019-12-03 12:43:50
I've got a d3.js static force layout graph that can get rather big (sometimes parts of it are clipped), so I'd like to let the user pan the whole graph by dragging. I don't think I need dragging of individual nodes, I've got a feeling that's just going to be confusing, but would like to make it possible to show the parts of the graph that are clipped by the svg boundaries. I've got a minimal example at http://bl.ocks.org/3811811 which uses visF.append("rect") .attr("class", "background") .attr("width", width) .attr("height", height) .call(d3.behavior.zoom().on("zoom", redrawVisF)); function

Drag & Drop - DataTransfer object

ε祈祈猫儿з 提交于 2019-12-03 12:22:40
I'm building a simple drag n' drop uploader and I'm wondering why I can't see the file(s) I drop when I console.log(e) (DragEvent) and look at the DragEvent.dataTransfer.files it shows up empty, but... if I console.log(e.dataTransfer.files) it will show the dropped file(s). //CODE <!DOCTYPE html> <html> <head> <script> document.addEventListener("DOMContentLoaded", init); function init(){ var dropbox = document.getElementById('dropbox'); dropbox.addEventListener('dragover', drag.over); dropbox.addEventListener('drop', drag.drop); } var drag = { "over": function(e){ e.preventDefault(); }, "drop"

Resizing Handles on a Rotated Element

时光总嘲笑我的痴心妄想 提交于 2019-12-03 12:01:23
I'm trying to put resizing handles on the four corners of a rectangle, which can be dragged to resize the rectangle. What I'm having trouble with is calculating the new width, new height, and new points of the rectangle after I've dragged one of the rectangle's points. If the rectangle were not rotated, this would obviously be very easy because the width and height would change by the same amout as the mouse's offsetX and offsetY. However, this rectangle CAN be rotated, so offsetX and offsetY don't match up to the changes in width/height. In the image above, I've represented information that I

android drag view smooth

早过忘川 提交于 2019-12-03 11:24:43
I have to drag some views on screen. I am modifying their position by changing left and top of their layout parameters from motion event on ACTION_MOVE from touch listener. Is there a way to "drag" items more smooth? Because tis kind of "dragging" is no smooth at all... Here is the code public boolean onTouch(View view, MotionEvent motionEvent) { switch (motionEvent.getAction()) { case MotionEvent.ACTION_DOWN: dx = (int) motionEvent.getX(); dy = (int) motionEvent.getY(); break; case MotionEvent.ACTION_MOVE: int x = (int) motionEvent.getX(); int y = (int) motionEvent.getY(); RelativeLayout

On Drag Listener multiple IF statements

…衆ロ難τιáo~ 提交于 2019-12-03 09:02:10
I'm making a Letter Drag n Drop game (kinda like Guess the Brand) where you have an image and you have to drag the letters into layouts to form the correct answer. At the top, I have Four layouts (layoutAnsw A to D), and in the bottom I have Four buttons (btnTop A to D) I have the OnTouchListener and OnDragListener working fine, except one single thing. What happens when I have more than one similar character (letter)? For example in this image: As you can see, I have to "A" letters that need to be dragged, and I want to do it regardless of which one you put first. In my code I managed to get

Draggable window with pyqt4

此生再无相见时 提交于 2019-12-03 08:51:01
just a simple question: I'm using pyqt4 to render a simple window. Here's the code, I post the whole thing so it easier to explain. from PyQt4 import QtGui, QtCore, Qt import time import math class FenixGui(QtGui.QWidget): def __init__(self): super(FenixGui, self).__init__() # setting layout type hboxlayout = QtGui.QHBoxLayout(self) self.setLayout(hboxlayout) # hiding title bar self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # setting window size and position self.setGeometry(200, 200, 862, 560) self.setAttribute(Qt.Qt.WA_TranslucentBackground) self.setAutoFillBackground(False) # creating

jquery html 5 dragstart .on('dragstart',function(e){}) e.dataTransfer.setData() doesn't work

和自甴很熟 提交于 2019-12-03 05:34:13
chrome throw err: Cannot call method 'setData' of undefined, I find the e is not equal to window.event(it havn't propert dataTransfer);both has very big different I find both almost equal in the click event. I used http://code.jquery.com/jquery-latest.js . I don't use drag feature,I just want know why. it is new feature in html 5,jquery still behind of it ?. or jquery team don't want support it?? or some other reason In the callback function you get a jQuery wrapper over a native event. Use the originalEvent property of passed argument: $('...').on('dragstart', function (event) { event

Drag object in Unity 2D

半世苍凉 提交于 2019-12-03 05:28:47
I have looked for an object dragging script for Unity 2D. I have found a good method on the internet, but it seems it's just working in Unity 3D. It's not good for me as I'm making a 2D game and it's not colliding with the "walls" in that way. I have tried to rewrite it to 2D, but I have crashed into errors, with Vectors. I would be very glad if you could help me rewrite it to 2D. Here's the code what's working in 3D: using UnityEngine; using System.Collections; [RequireComponent(typeof(BoxCollider))] public class Drag : MonoBehaviour { private Vector3 screenPoint; private Vector3 offset; void

Google Map Api v3 drag event on map

拈花ヽ惹草 提交于 2019-12-03 04:05:16
问题 I am using google map v3 api. I need to detect the drag event on the map. Be it the drag on the map to move to a nearby geographical location or a drag on the marker. I need some javascript function to run when either of the events occur. 回答1: Both Map objects and Marker objects have drag events, although you probably want dragend so that you can do something when a user is done dragging rather than do something while a user is dragging. So you could do something like this: google.maps.event