MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / drag_pan

Method drag_pan

lib/mpl_toolkits/mplot3d/axes3d.py:1852–1887  ·  view source on GitHub ↗
(self, button, key, x, y)

Source from the content-addressed store, hash-verified

1850 self.get_figure(root=True).canvas.draw_idle()
1851
1852 def drag_pan(self, button, key, x, y):
1853 # docstring inherited
1854
1855 # Get the coordinates from the move event
1856 p = self._pan_start
1857 (xdata, ydata), (xdata_start, ydata_start) = p.trans_inverse.transform(
1858 [(x, y), (p.x, p.y)])
1859 self._sx, self._sy = xdata, ydata
1860 # Calling start_pan() to set the x/y of this event as the starting
1861 # move location for the next event
1862 self.start_pan(x, y, button)
1863 du, dv = xdata - xdata_start, ydata - ydata_start
1864 dw = 0
1865 if key == 'x':
1866 dv = 0
1867 elif key == 'y':
1868 du = 0
1869 if du == 0 and dv == 0:
1870 return
1871
1872 # Transform the pan from the view axes to the data axes
1873 R = np.array([self._view_u, self._view_v, self._view_w])
1874 R = -R / self._box_aspect * self._dist
1875 duvw_projected = R.T @ np.array([du, dv, dw])
1876
1877 # Calculate pan distance in transformed coordinates for non-linear scales
1878 minx, maxx, miny, maxy, minz, maxz = self._get_scaled_limits()
1879 dx = (maxx - minx) * duvw_projected[0]
1880 dy = (maxy - miny) * duvw_projected[1]
1881 dz = (maxz - minz) * duvw_projected[2]
1882
1883 # Compute new limits in transformed coordinates
1884 self._set_lims_from_transformed(
1885 minx + dx, maxx + dx,
1886 miny + dy, maxy + dy,
1887 minz + dz, maxz + dz)
1888
1889 def _calc_view_axes(self, eye):
1890 """

Callers 2

_on_moveMethod · 0.95
_set_view_from_bboxMethod · 0.95

Calls 4

_get_scaled_limitsMethod · 0.95
transformMethod · 0.45
start_panMethod · 0.45

Tested by

no test coverage detected