合作手势
启用特定语言的合作手势,查看其在全屏模式下的行为;
<!DOCTYPE html>
<html lang="en">
<head>
<title>合作手势</title>
<meta property="og:description" content="启用特定语言的合作手势,查看其在全屏模式下的行为" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.5.0/dist/maplibre-gl.css' />
<script src='https://unpkg.com/maplibre-gl@5.5.0/dist/maplibre-gl.js'></script>
<style>
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script>
const map = new maplibregl.Map({
container: 'map',
style: 'https://demotiles.maplibre.org/style.json',
center: [-74.5, 40],
cooperativeGestures: true,
locale: {
'CooperativeGesturesHandler.WindowsHelpText': '使用Ctrl + 滚轮进行地图缩放',
'CooperativeGesturesHandler.MacHelpText': '使用⌘ + 滚轮进行地图缩放',
'CooperativeGesturesHandler.MobileHelpText': '使用双指操作地图',
},
zoom: 4
});
map.addControl(new maplibregl.FullscreenControl());
</script>
</body>
</html>