pan

Implement panning while keeping nodes draggable in d3 force layout

我与影子孤独终老i 提交于 2019-12-08 07:20:57
问题 I use the d3.layout.force to visualize graph structures. And I want both node dragging feature and panning feature. (By 'panning', I mean something like google maps behavior.) As shown in several d3 examples, nodes can be made draggable by nodes.call(force.drag) . And panning can be implemented by d3.behavior.drag . However, it seems they can not be used simultaneously. Here is a code example: var width = 400, height = 300; var svg = d3.select('body').append('svg').attr({width: width, height:

Real coordinates for graph inside viewport relative to mouse coordinates

独自空忆成欢 提交于 2019-12-08 05:27:59
问题 As I have specified in the title, I have started to work on a simple application what contains in the main frame window, a double buffered panel. Inside this panel some graphics can be drawn, let's consider this panel is a simple viewport for the elements drawn inside. Two functionalities were added here, pan and zoom what can scale transform and translate transform inside paint event using a delta updated on MouseDown and Move events and OnMouseWheel for updating the scale transform. The

prevent ios7 pan gesture to pop view controller

女生的网名这么多〃 提交于 2019-12-07 08:39:19
iOS 7 has introduced pan gesture to popViewController. It introductes problems with the sidebar that I am using so I want to prevent this new function of ios7. How can I cancel that behaviour? Thanks in advance You can use yourNavigationController.interactivePopGestureRecognizer.enabled = NO; 来源: https://stackoverflow.com/questions/18975060/prevent-ios7-pan-gesture-to-pop-view-controller

Real coordinates for graph inside viewport relative to mouse coordinates

大城市里の小女人 提交于 2019-12-06 15:18:53
As I have specified in the title, I have started to work on a simple application what contains in the main frame window, a double buffered panel. Inside this panel some graphics can be drawn, let's consider this panel is a simple viewport for the elements drawn inside. Two functionalities were added here, pan and zoom what can scale transform and translate transform inside paint event using a delta updated on MouseDown and Move events and OnMouseWheel for updating the scale transform. The real problem has arrived after trying to add a functionality to support creation of a Node (graphic

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

iOS核心动画高级技巧-5

你说的曾经没有我的故事 提交于 2019-12-05 23:13:21
9. 图层时间 图层时间 时间和空间最大的区别在于,时间不能被复用 -- 弗斯特梅里克 在上面两章中,我们探讨了可以用 CAAnimation 和它的子类实现的多种图层动画。动画的发生是需要持续一段时间的,所以计时对整个概念来说至关重要。在这一章中,我们来看看 CAMediaTiming ,看看Core Animation是如何跟踪时间的。 9.1 CAMediaTiming协议 CAMediaTiming`协议 CAMediaTiming 协议定义了在一段动画内用来控制逝去时间的属性的集合, CALayer 和 CAAnimation 都实现了这个协议,所以时间可以被任意基于一个图层或者一段动画的类控制。 持续和重复 我们在第八章“显式动画”中简单提到过duration( CAMediaTiming 的属性之一), duration 是一个 CFTimeInterval 的类型(类似于 NSTimeInterval 的一种双精度浮点类型),对将要进行的动画的一次迭代指定了时间。 这里的一次迭代是什么意思呢? CAMediaTiming 另外还有一个属性叫做 repeatCount ,代表动画重复的迭代次数。如果 duration 是2, repeatCount 设为3.5(三个半迭代),那么完整的动画时长将是7秒。 一个开发者,有一个学习的氛围跟一个交流圈子特别重要

How can I pan an image larger than its container correctly using jQuery?

风流意气都作罢 提交于 2019-12-05 21:51:37
问题 I'm creating quite a cool image viewer but am stuck in one particular part: panning the image when zoomed in. It seems a trivial problem and I've tried out pretty much all answers to similar questions on SO, but each time, something isn't working right. I need a fresh pair of eyes. I've temporarily opened a URL on my dev server. Have a look at this page: [URL closed] Next, move up your mouse wheel to trigger the zoom. Here we are. Once zoomed in, click and drag to try and pan the image. It is

Move HTML5 Canvas with a background image

末鹿安然 提交于 2019-12-05 07:13:45
问题 I want to visualize a huge diagram that is drawn in a HTML5 canvas. As depicted below, let’s imagine the world map, it’s impossible to visualize it all at the same time with a “decent” detail. Therefore, in my canvas I would like to be able to pan over it using the mouse to see the other countries that are not visible. Does anyone know how to implement this sort of panning in a HTML5 canvas? Another feature would be the zoom in and out. I've seen a few examples but I couldn't get them working

matplotlib 中pan(平移)和zoom(缩放)功能的探索

你说的曾经没有我的故事 提交于 2019-12-05 01:06:30
为matplotlib生成的子图添加编辑条,我们导入NavigationToolbar2QT from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT 继承关系:    其中,NavigationToolbar2是实现NavigationToolbar2QT有关编辑条的主要实现类,下面对NavigationToolbar2进行详细分析。涉及zoom功能的有四个函数: zoom, press_zoom, drag_zoom, release_zoom zoom() 鼠标按下事件绑定 press_zoom(),鼠标释放事件绑定 release_zoom(), press_zoom() 判断是鼠标左键还是右键触发的点击事件,存入self._button_pressed中(1: 左键;2: 右键)。 关键代码分析: 将鼠标点击的坐标(x, y)、figure中的axes对象,i(含义不明), axes对象的rect(xmin , xmax, ymin, ymax)append到self._xypress中,代码如下: self._xypress.append((x, y, a, i, a._get_view())) 鼠标点击事件绑定_switch_on_zoom_mode()以确认zoom缩放模式(左键缩小

【iOS】Swipe与Pan区别分析

孤人 提交于 2019-12-04 17:32:08
  By definition, a swipe gesture is necessarily also a pan gesture -- both involve translational movement of touch points. The difference is in the recognizer semantics: a pan recognizer looks for the beginning of translational movement and continues to report movement in any direction over time, while a swipe recognizer makes an instantaneous decision as to whether the user's touches moved linearly in the required direction.   根据定义,滑动手势也必然是平移手势 - 都涉及触摸点的平移运动。不同之处在于识别器语义:平移识别器查找平移运动的开始并继续报告随时间在任何方向上的移动,而滑动识别器立即决定用户的触摸是否在所需方向上线性移动。   By default, no two recognizers will recognize the same