[OpenMap Users] ZoomOutMouseMode

From: Ben Podoll <benjamin.podoll_at_und.edu>
Date: Tue, 31 Aug 2004 10:36:29 -0500

I wrote a simple ZoomOutMouseMode that seems to work for me:


import java.awt.Cursor;

import java.awt.event.MouseEvent;

import com.bbn.openmap.MapBean;

import com.bbn.openmap.event.CoordMouseMode;


public class ZoomOutMouseMode extends CoordMouseMode {


 public final static transient String modeID = "ZoomOut";

 protected float multiplyScaleBy;


 //Default constructor to zoom out 1.5x

 public ZoomOutMouseMode() {

     this(true, 1.5f);



 //A simple mouse mode to zoom out on a mouse press

 public ZoomOutMouseMode(boolean shouldConsumeEvents, float multiplyScaleBy)

     super(modeID, shouldConsumeEvents);

     this.multiplyScaleBy = multiplyScaleBy;




 //Do a quick zoom out when the mouse is pressed

 public void mousePressed(MouseEvent e) {


     if (!mouseSupport.fireMapMousePressed(e) && e.getSource() instanceof
MapBean) {

        MapBean mapBean = (MapBean)e.getSource();

        mapBean.setScale(mapBean.getScale() * multiplyScaleBy);





[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Aug 31 2004 - 11:37:32 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:05 EDT