multivalent.std.lens
Class Magnify
public
class
Magnify
extends Lens
Enlarge content by scaling
Graphics2D.
This lens composes well, as opposed to BitMagnify.
To do
- Transform coordinates within lens, so can select within.
- Separate scaling on x and y axes?
Version: $Revision: 1.2 $ $Date: 2002/02/08 14:39:12 $
public static final String ATTR_ZOOM
public static final String ATTR_ZOOMS
public static final String MSG_MAGNIFY
Create a mangify lens.
"magnifyLens".
public void restore(
ESISNode n, Map<String,Object> attr,
Layer layer)
Transform mouse coordinates to match magnified.
public boolean eventAfter(AWTEvent e, Point rel, Node obsn) {
//public boolean eventBefore(AWTEvent e, Point rel, Node obsn) {
if (super.eventBefore(e, rel, obsn)) return true;
// transform magnified space => unmag space
rel_.setLocation(rel);
//double f = zoom_/100.0;
Rectangle r = getContentBounds();
//rel.setLocation(r.x + (int)((rel.x-r.x)/f), r.y + (int)((rel.y-r.y)/f));
//System.out.println(rel_+ " => "+rel);
rel.x = ((rel.x - r.x)*100/zoom_) + r.x;
rel.y = ((rel.y - r.y)*100/zoom_) + r.y;
//return false;
return super.eventAfter(e,rel, obsn);
}
public boolean eventAfterX(AWTEvent e, Point rel, Node obsn) {
/*if (warp_) {* / rel.setLocation(rel_); //warp_=false; }
return super.eventAfter(e,rel, obsn);
}