Skip to content

Instantly share code, notes, and snippets.

@ecaldwell
Created October 10, 2020 14:39
Show Gist options
  • Save ecaldwell/73efb1888e791d32fb5df4df83ac6a7d to your computer and use it in GitHub Desktop.
Save ecaldwell/73efb1888e791d32fb5df4df83ac6a7d to your computer and use it in GitHub Desktop.
Smooth scrolling with the ArcGIS JS API
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<title>
Intro to MapView - Create a 2D map | Sample | ArcGIS API for JavaScript
4.17
</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link
rel="stylesheet"
href="https://js.arcgis.com/4.17/esri/themes/light/main.css"
/>
<script src="https://js.arcgis.com/4.17/"></script>
<script>
require(["esri/Map", "esri/views/MapView"], function (Map, MapView) {
var map = new Map({
basemap: "topo-vector"
});
var view = new MapView({
container: "viewDiv",
map: map,
zoom: 4,
center: [15, 65], // longitude, latitude
constraints: {
lods: []
}
});
view.on("mouse-wheel", function() {
console.log("scale:", view.scale);
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment