drag

Move (drag/pan) and zoom object (image or div) in pure js

时间秒杀一切 提交于 2019-12-06 12:13:21
问题 I'm working on a little script that makes an object (div or img) moveable and zoomable within a given frame. However I came across a few problems I'm not really sure of, because I'm a javascript beginner - so explanation of why those problems occure would be appreciated. Problems: Calling the functions start_drag() , while_drag() and stop_drag() returns undefined - why is that? What should be returned? The dragging and moving of the image does not work correctly - instead of clicking the

Reordering items in a QTreeWidget with Drag and Drop in PyQt

倾然丶 夕夏残阳落幕 提交于 2019-12-06 09:19:48
I have a QTreeWidget with what I thought all the proper settings setup in order to be able to reorder items by dragging them around. It can work, at times, but more often than not I drag an item into another one and it either disappears or becomes a child. Is there anyway to prevent this from happening so you don't lose items you're trying to reorder? I figured you could achieve this within Qt Designer. I have dragDrop mode set to InternalMove and defaultDropAction set to MoveAction, but I'm not even certain of both of those are what I need to be adjusting. Thanks in advance! You can add flags

Disable drag of JFrame

雨燕双飞 提交于 2019-12-06 09:04:31
I want to ask how to make frame can not drag when the application is running? And then how to disable maximize, minimize button (title bar)? I'm using JFrame . Just add the below line it removes the window decorations like close maximise and minimise(titlebar). This itself disables the dragging only with mouse events. frame.setUndecorated(true); hoang nguyen You can use a JWindow instead of a JFrame . There is no title bar, so the user won't be able to move it. setResizable(false); setUndecorated(true); getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); 来源: https://stackoverflow

Java Swing JScrollPane line number glitch

僤鯓⒐⒋嵵緔 提交于 2019-12-06 05:25:06
I have a simple JEditorPane inside a JScrollPane that displays line numbers on the left side. It works great except when you move the window off screen and pull it back again, it looks the this when you stop dragging: any ideas? Should I need to be listening for a move/drag event and calling repaint/revalidate somewhere? Thought it might be something obvious, but here is some code. I am using the JSyntaxPane. public EditorPanel() { this.setLayout(new BorderLayout()); PythonSyntaxKit.initKit(); codeEditor = new JEditorPane(); JScrollPane scrPane = new JScrollPane(codeEditor); Dimension d = new

Restricting a 3D object mouse drag movement to a plane in JavaFX

杀马特。学长 韩版系。学妹 提交于 2019-12-06 02:33:08
问题 I'm using JavaFX to move 3D cubes around by mouse drag. The cube should stay on the plane spanned by x and z axis. My solution works fairly well, however if I move the cube too fast with my mouse or when it encounters an object with a certain depth (y-Axis), it is assumed, that the mouse is moving on the y-Axis and the cube starts jumping forward or backwards. Is there a way to restrict the mouse to the xz-plane? A more complicated solution would be projecting the y length back to the xz

Drag scrolling in a GTK+ app

♀尐吖头ヾ 提交于 2019-12-06 02:21:50
问题 I am working on a GTK+ application that uses goocanvas to display a graph on screen. I am having problems coming up with a good way to implement drag scrolling. Currently the app saves the coordinates where the user clicked and then in a "motion-notify" signal callback, does goo_canvas_scroll_to() to the new position. The problem is that drawing is somewhat slow, and with each pixel moved by the mouse, I get the callback invoked once. This makes the drawing lag behind when dragging the graph

Border around a form with rounded corner in c++ builder XE

别等时光非礼了梦想. 提交于 2019-12-06 02:12:32
问题 I have made a C++ Builder XE form with rounded corner with the help of the following code BorderStyle = bsNone; void __fastcall TForm1::FormCreate(TObject *Sender) { HRGN frmrgn; frmrgn = CreateRoundRectRgn (0, 0, ClientWidth, ClientHeight,12,12); SetWindowRgn(Handle,frmrgn,true); } It looks cool but the border is missing, I tried many thing but not get good result so please help me to draw border of color RGB(96,96,96) And I want to make whole form dragable. 回答1: 1. Painting a dark grey

Constraining window position to desktop working area

瘦欲@ 提交于 2019-12-06 00:16:24
I want to allow a user to drag my Win32 window around only inside the working area of the desktop. In other words, they shouldn't be able to have any part of the window extend outside the monitor(s) nor should the window overlap the taskbar. I'd like to do it in a way that does cause any stuttering. Handling WM_MOVE messages and calling MoveWindow() to reposition the window if it goes off works, but I don't like the flickering effect that's caused by MoveWindow(). I also tried handling WM_MOVING which prevents the need to call MoveWindow() by altering the destination rectangle before the move

Mouseup not working after mousemove on img

不想你离开。 提交于 2019-12-05 09:05:29
I'm trying to do a simple drag script. The idea is to save the position when the mouse is down, update the view while the mouse is moving, and stop when mouse is up. Problem, mouseup event isn't working properly. See the code: var target = $('a') var pos = 0; var dragging = false; $(document).mousedown(function(e) { pos=e.pageX; dragging = true }) $(document).mouseup(function() { dragging = false }) $(document).mousemove(function(e) { if(dragging){ target.css('left', e.pageX-pos); } }) ​ Why mouseup works with a "a" tag: http://jsfiddle.net/leyou/c3TrG/1/ And why mouseup doesn't work with a

分享一个HTML5的drag and drop API实现的图片拖拽分组效果

…衆ロ難τιáo~ 提交于 2019-12-05 07:33:59
日期:2012-4-17 来源: GBin1.com 在线演示 本地下载 今 天我们介绍HTML5的拖拽功能。基本目前所有的现代浏览器(Firefox,Chrome,Safari,或者Opera)都支持这个实用的功能。这意 味着我们可以考虑在我们的项目和网站中使用这个功能。更重要的是代码编写非常简单。我们这里将使用拖拽API开发一个图片的分组排序功能 ,希望能够给大家比较直观的使用感受。希望大家喜欢! HTML标签 <div class="albums"> <div class="album" id="drop_1" droppable="true"><h2>Album 1</h2></div> <div class="album" id="drop_2" droppable="true"><h2>Album 1</h2></div> <div class="album" id="drop_3" droppable="true"><h2>Album 3</h2></div> </div> <div style="clear:both"></div> <div class="gallery"> <a id="1" draggable="true"><img src="images/1.jpg"></a> <a id="2" draggable="true"><img src=