89 |
view2d.render(vs, plane, into, into, box2paper); |
view2d.render(vs, plane, into, into, box2paper); |
90 |
} |
} |
91 |
|
|
92 |
/** Cause the changes to the zooming and panning variables |
protected void setZoomPan(VobScene vs, int mainFrame) { |
|
* to be shown in the given vobscene. |
|
|
* This changes the parameters of the coordinate systems |
|
|
* created by render(). |
|
|
*/ |
|
|
private void setZoomPan(VobScene vs, int mainFrame) { |
|
93 |
vs.coords.setOrthoBoxParams(box2paper, 0, |
vs.coords.setOrthoBoxParams(box2paper, 0, |
94 |
panX-boxw/zoom/2, panY-boxh/zoom/2, |
panX-boxw/zoom/2, panY-boxh/zoom/2, |
95 |
1/zoom, 1/zoom, boxw, boxh); |
1/zoom, 1/zoom, boxw, boxh); |
96 |
} |
} |
97 |
|
|
|
public void keystroke(String s) { |
|
|
// XXX |
|
|
} |
|
98 |
|
|
|
// Mouse press state |
|
|
// x, y, buttons |
|
|
private int [] m_state = null; |
|
99 |
private float m_state_zoom = -1; |
private float m_state_zoom = -1; |
|
private float pan[] = new float[2]; |
|
|
|
|
|
|
|
|
public boolean mouse(MouseEvent e, VobScene oldVobScene) { |
|
|
if (e.getID() == MouseEvent.MOUSE_PRESSED) { |
|
|
m_state = new int[]{ e.getX(), e.getY(), e.getModifiers()}; |
|
|
m_state_zoom = zoom; |
|
|
pan[0] = panX; pan[1] = panY; |
|
100 |
|
|
101 |
return false; |
protected void readMouseState(MouseEvent e, VobScene oldVobScene) { |
102 |
} |
super.readMouseState(e, oldVobScene); |
103 |
if (m_state == null) throw new Error("Mouse state not found!"); |
m_state_zoom = zoom; |
104 |
|
} |
105 |
|
|
106 |
|
public boolean doMouse(MouseEvent e, VobScene oldVobScene) { |
107 |
// let's zoom!! |
// let's zoom!! |
108 |
if (m_state[2] == e.BUTTON3_MASK) { |
if (m_state[2] == e.BUTTON3_MASK) { |
109 |
zoom = m_state_zoom * (float) |
zoom = m_state_zoom * (float) |
113 |
return true; |
return true; |
114 |
} |
} |
115 |
|
|
116 |
// Move by dragging with button 1 |
return super.doMouse(e, oldVobScene); |
|
if(m_state[2] == e.BUTTON1_MASK && |
|
|
e.getID() == MouseEvent.MOUSE_DRAGGED) { |
|
|
panX = pan[0] + (m_state[0] - e.getX())/zoom; |
|
|
panY = pan[1] + (m_state[1] - e.getY())/zoom; |
|
|
clipPan(); |
|
|
|
|
|
setZoomPan(oldVobScene, box2screen); |
|
|
return true; |
|
|
} |
|
|
|
|
|
// Move around by clicking |
|
|
if(m_state[2] == e.BUTTON1_MASK && |
|
|
e.getID() == MouseEvent.MOUSE_CLICKED){ |
|
|
mouseMoveClick(e.getX(), e.getY(), oldVobScene); |
|
|
return false; |
|
|
} |
|
|
|
|
|
if(dbg) pa("nothing!"); |
|
|
return false; |
|
117 |
} |
} |
118 |
|
|
119 |
|
protected float getZoom() { return zoom; } |
120 |
} |
} |