use of ol.interaction.MouseWheelZoom in project gwt-ol3 by TDesjardins.
the class MapEventsExample method show.
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show()
*/
@Override
public void show(String exampleId) {
// create a OSM-layer
XyzOptions osmSourceOptions = OLFactory.createOptions();
Osm osmSource = new Osm(osmSourceOptions);
LayerOptions osmLayerOptions = OLFactory.createOptions();
osmLayerOptions.setSource(osmSource);
Tile osmLayer = new Tile(osmLayerOptions);
// create a view
View view = new View();
Coordinate centerCoordinate = new Coordinate(-0.1275, 51.507222);
Coordinate transformedCenterCoordinate = Projection.transform(centerCoordinate, DemoConstants.EPSG_4326, DemoConstants.EPSG_3857);
view.setCenter(transformedCenterCoordinate);
view.setZoom(10);
// create the map
MapOptions mapOptions = OLFactory.createOptions();
mapOptions.setTarget(exampleId);
mapOptions.setView(view);
Map map = new Map(mapOptions);
map.addLayer(osmLayer);
// add some controls
map.addControl(new ScaleLine());
DemoUtils.addDefaultControls(map.getControls());
Attribution attribution = new Attribution();
attribution.setCollapsed(true);
map.addControl(attribution);
// clear default interactions
map.getInteractions().clear();
// add some interactions
map.addInteraction(new DragPan());
map.addInteraction(new KeyboardPan());
map.addInteraction(new KeyboardZoom());
map.addInteraction(new MouseWheelZoom());
// add event handlers
map.addDoubleClickListener(evt -> Window.alert("double click at " + evt.getCoordinate().getX() + ", " + evt.getCoordinate().getX()));
map.addMapZoomListener(evt -> GWT.log("onZoom"));
map.addMapZoomEndListener(evt -> GWT.log("onMapZoomEnd"));
}
Aggregations