55 |
|
|
56 |
######## Actions to control pan of main nodes etc. |
######## Actions to control pan of main nodes etc. |
57 |
|
|
58 |
class PanMover(vob.mouse.RelativeAdapter, |
class ScrollWheelPan(vob.input.RelativeAxisListener): |
59 |
vob.input.RelativeAxisListener): |
"""Scroll vertically using the scroll wheel. |
60 |
def changedRelative(self, x,y='foo'): |
""" |
61 |
# grrr.. pythonism, overloading of own method is sicknes |
def changedRelative(self, d): |
|
if y=='foo': return self._changedRelative(x) |
|
62 |
f = getMainNode().getFocus() |
f = getMainNode().getFocus() |
63 |
fX, fY = f.getPanX(), f.getPanY() |
fX, fY = f.getPanX(), f.getPanY() |
64 |
f.setPan(fX-x/f.zoom, |
f.setPan(fX, fY-d/f.zoom) |
65 |
fY-y/f.zoom) |
getMainNode().setZoomPan(getOldVS()) |
66 |
getMainNode().chgFast(getOldVS(), -1) |
|
67 |
def _changedRelative(self, d): |
class Pan_Fastest(vob.mouse.RelativeAdapter): |
68 |
f = getMainNode().getFocus() |
"""Pan quickly with an ad hoc formula. |
69 |
fY = f.getPanY() |
""" |
70 |
f.setPan(0, fY-d/f.zoom) |
def changedRelative(self, x,y): |
71 |
getMainNode().chgFast(getOldVS(), -1) |
mainNode = getMainNode() |
72 |
|
f = mainNode.getFocus() |
73 |
|
if isinstance(mainNode, ff.view.buoy.FisheyeMainNode2D): |
74 |
|
x *= 2 |
75 |
|
y *= 2 |
76 |
|
fX, fY = f.getPanX(), f.getPanY() |
77 |
|
f.setPan(fX-x/f.zoom, |
78 |
|
fY-y/f.zoom) |
79 |
|
mainNode.setZoomPan(getOldVS()) |
80 |
|
|
81 |
|
class Pan_BestQuality(vob.mouse.MouseDragListener): |
82 |
|
"""General panning. |
83 |
|
|
84 |
|
This class uses the real coordsys which is a great |
85 |
|
advantage for fisheye views, yielding a nicer-quality |
86 |
|
motion. |
87 |
|
|
88 |
|
This is slow because getXYHit is currently slow - it |
89 |
|
creates the vobscene's internal coordsyses twice |
90 |
|
and there's a lot of them currently. |
91 |
|
|
92 |
|
When we move to |
93 |
|
""" |
94 |
|
def startDrag(self, x,y): |
95 |
|
self.oldxy = getMainNode().getXYHit(getOldVS(), x, y) |
96 |
|
p('old', self.oldxy) |
97 |
|
def drag(self, x, y): |
98 |
|
mainNode = getMainNode() |
99 |
|
curxy = mainNode.getXYHit(getOldVS(), x, y) |
100 |
|
f = mainNode.getFocus() |
101 |
|
fX, fY = f.getPanX(), f.getPanY() |
102 |
|
f.setPan(fX-(curxy[0] - self.oldxy[0]), |
103 |
|
fY-(curxy[1] - self.oldxy[1])) |
104 |
|
mainNode.setZoomPan(getOldVS()) |
105 |
|
|
106 |
class BrowseClick(vob.mouse.MouseClickListener): |
class BrowseClick(vob.mouse.MouseClickListener): |
107 |
def clicked(self, x, y): |
def clicked(self, x, y): |
112 |
fenPDF.animation.regenerateVS() |
fenPDF.animation.regenerateVS() |
113 |
|
|
114 |
|
|
115 |
class ZoomPan(vob.input.RelativeAxisListener): |
class Zoom(vob.input.RelativeAxisListener): |
116 |
def changedRelative(self, x): |
def changedRelative(self, x): |
117 |
getMainNode().changeZoom(x) |
getMainNode().changeZoom(x) |
118 |
getMainNode().chgFast(getOldVS(), -1) |
getMainNode().chgFast(getOldVS(), -1) |