Skip to main content

Whether the global map is drawn repeatedly

Whether the global map is drawn repeatedly

show
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8" />
<title>Whether the global map is drawn repeatedly</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<style>
body {
margin: 0;
padding: 0;
}

#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}

.btn-group {
position: absolute;
top: 20px;
left: 20px;
}
</style>
<script src="https://delivery.mapmost.com/cdn/sdk/webgl/v9.16.0/mapmost-webgl-min.js"></script>
</head>

<body>
<div id="map"></div>
<div class="btn-group">
<button onClick="whetherRedraw(this)">Cancel redraw</button>
</div>
<script>
let map = new mapmost.Map({
container: "map",
style: "<your style url>",
center: [120.72541613154851, 31.31171803927643],
zoom: 0,
pitch: 0,
bearing: 0,
renderWorldCopies:true, //default is true
userId: '***', // Authorization code
})
function whetherRedraw(e) {
if (e.innerHTML === 'Cancel repeated drawing') {
map.setRenderWorldCopies(false)
e.innerHTML = 'Resume repeated drawing'
} else if (e.innerHTML === 'Resume repeated drawing') {
map.setRenderWorldCopies(true)
e.innerHTML = 'Cancel repeated drawing';
}
}
</script>
</body>

</html>