function showZoom(a,r) {
z = a.getZoom(); // get current zoom setting
r[Math.round((r.length-1)*Math.log(z)/Math.log(16))].checked = true;
// indicate zoom setting
}
function zoomin(a,r) {
z = a.getZoom(); // get current zoom setting
f = a.getZoomFactor(); // get zoom factor
a.zoom(z*f); // set new zoom
showZoom(a,r);
a.render(); // now display it
}
function fixedZoom(a,f) {
a.zoom(f); // set fix zoom factor
a.render(); // now display it
}
function pan(a) {
if (a.getZoom() > 1) {
a.setModifiers(5,1);
// set modifiers to meta+shift (force pan)
}
}
function scroll(a,x,y) {
z = a.getZoom(); // get current zoom setting
a.scroll(50*x/z,50*y/z);
// scroll distance depends on zoom setting
a.render(); // now display it
}
function zoomout(a,r) {
z = a.getZoom(); // get current zoom setting
f = a.getZoomFactor(); // get zoom factor
a.zoom(z/f); // set new zoom
showZoom(a,r)
a.render(); // now display it
}
function zoomreset(a,r) {
a.zoom(1); // reset zoom to 1
showZoom(a,r)
a.render(); // now display it
}
function mouseMode(a,m) {
if (m == 0)
a.setModifiers(0,0)
else if (m == 1)
a.setModifiers(0,2)
else if (m == 2)
a.setModifiers(4,2)
else if (m == 3) {
a.setModifiers(1,2)
}
}
function find(a,t) {
n = a.findText(t); // search for text, returns image name
if (n > '') {
l = a.getLayer(); // get the layer
c = a.getComponent(); // get component number
z = a.getZoom(); // get zoom setting
x = a.getX(l,n,c); // get x-position of component
y = a.getY(l,n,c); // get y-position of component
a.zoom(z,x,y); // position to component
}
a.render();
}
function findText(a,t) {
if ( t > '' ) find(a,t);
}
// this function handles events from applet "afr".
function afrEvent(task,device,ev) {
showZoom(document.afr,document.nav.zoom)
}
|