drag

Google Line Chart: drag to adjust value

依然范特西╮ 提交于 2019-12-03 03:58:00
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 an event or a way to attach an event in the API without much success. Has anyone managed to do

How to create the drag and slide effect from this website?

浪尽此生 提交于 2019-12-03 03:24:49
If you drag and release quickly from the horizontal menu, the menu will auto slide for a distance. It seems to slide more the faster you drag and release. Source -> appear.dk How do i achieve this effect? Has it got to do with some complex formulaes? This technique is called kinetic scrolling (you simulate kinetic energy). Since the dawn of the iphone this technique has been hyped, though it can be used on mobile devices with great benefit, I would refrain from using it inside a website (like all other sorts of scrolling) However, here's an easy to use jquery plugin: Here you go Overscroll

Simple drag and drop code

橙三吉。 提交于 2019-12-03 02:39:07
Im struggling with seemingly a simple javascript exercise, writing a vanilla drag and drop. I think Im making a mistake with my 'addeventlisteners', here is the code: var ele = document.getElementsByClassName ("target")[0]; var stateMouseDown = false; //ele.onmousedown = eleMouseDown; ele.addEventListener ("onmousedown" , eleMouseDown , false); function eleMouseDown () { stateMouseDown = true; document.addEventListener ("onmousemove" , eleMouseMove , false); } function eleMouseMove (ev) { do { var pX = ev.pageX; var pY = ev.pageY; ele.style.left = pX + "px"; ele.style.top = pY + "px"; document

'drag' move a uibutton so it acts like uiScrollView

左心房为你撑大大i 提交于 2019-12-02 07:40:08
问题 I need to slide a uibutton up and down the screen (Y only). It needs to be confined to an area. I want to be able to click on it and drag or flick it, just like a uiScrollView. The reason it is different to a uiScrollView is that you have to start on the button, as opposed to anywhere inside a uiScrollView! 回答1: You can move a view by using touch moved event. There is a sample tutorial MoveMe by Apple which drags a view and after releasing the touch animate the view. Check specially the touch

'drag' move a uibutton so it acts like uiScrollView

僤鯓⒐⒋嵵緔 提交于 2019-12-02 07:19:59
I need to slide a uibutton up and down the screen (Y only). It needs to be confined to an area. I want to be able to click on it and drag or flick it, just like a uiScrollView. The reason it is different to a uiScrollView is that you have to start on the button, as opposed to anywhere inside a uiScrollView! You can move a view by using touch moved event. There is a sample tutorial MoveMe by Apple which drags a view and after releasing the touch animate the view. Check specially the touch events (touchesBegan, touchesMoved, touchesEnded) in MoveMeView.m to get the idea how they have moved

When dragging an Imageview goes outside the screen

巧了我就是萌 提交于 2019-12-02 05:59:05
I want to implement a movable imageView when it is drag. The dragging is working perfectly alright. But when i drag to the end , the imageView goes out of the screen. How can i make the movable of the imageview only inside the screen ? This is my OnTouch listerner : public boolean onTouch(View view, MotionEvent event) { switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: dX = view.getX() - event.getRawX(); dY = view.getY() - event.getRawY(); lastAction = MotionEvent.ACTION_DOWN; break; case MotionEvent.ACTION_MOVE: view.setY(event.getRawY() + dY); view.setX(event.getRawX() + dX);

How can I drag images with the mouse cursor in Java GUI?

大憨熊 提交于 2019-12-02 04:42:56
问题 // my code that calls upon n images in a directory to be placed on the JPanel public void imageAdder(int n, String name){ BufferedImage myPic = null; for (int i = 0; i <= n; i++){ try { myPic = ImageIO.read(new File("Images/" + name + i + ".jpg")); } catch (Exception e){ System.out.println("no file man cmon"); } JLabel picLabel = new JLabel(new ImageIcon(myPic)); // picLabel.setBounds(mouseX, mouseY, 100, 50); // picLabel.addMouseMotionListener(this); // picLabel.addMouseListener(this);

Drag rectangle on JFrame in Java

最后都变了- 提交于 2019-12-02 02:46:49
I want to draw rectangle based on mousedrag event. if user dragging the mouse, then the rectangle on the applet should increase or decrease basing on current mouse coordinates. i have the following code. in the following code i am using SelectionArea class which extends a canvas on which i am performing drawing operation. i am using image variable in this class for double buffering to reduce flickering and to save the applet's previous state(i.e drawing content of applet) but the code is working fine if i draw first rectangle. if i start to draw second rectangle the previously drawn rectangle

How can I drag images with the mouse cursor in Java GUI?

不羁岁月 提交于 2019-12-02 00:52:00
// my code that calls upon n images in a directory to be placed on the JPanel public void imageAdder(int n, String name){ BufferedImage myPic = null; for (int i = 0; i <= n; i++){ try { myPic = ImageIO.read(new File("Images/" + name + i + ".jpg")); } catch (Exception e){ System.out.println("no file man cmon"); } JLabel picLabel = new JLabel(new ImageIcon(myPic)); // picLabel.setBounds(mouseX, mouseY, 100, 50); // picLabel.addMouseMotionListener(this); // picLabel.addMouseListener(this); canvas.add(picLabel); }} I read about the class DragSource and how there's a method that drags things of

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

ⅰ亾dé卋堺 提交于 2019-12-02 00:45:29
问题 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