Skip to content

Commit a8e5316

Browse files
committed
updated singleWorldView doc
added example for single world view Signed-off-by: Tim Deubler <tim.deubler@here.com>
1 parent eaf3cc6 commit a8e5316

File tree

4 files changed

+62
-1
lines changed

4 files changed

+62
-1
lines changed

packages/display/src/MapOptions.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ export interface MapOptions {
149149
* - `true`: Restricts repetition on both the latitude (Y-axis) and longitude (X-axis).
150150
* - `false`: Allows infinite repetition on both axes.
151151
* - `'latitude'`: Restricts repetition only on the latitude (Y-axis), allowing infinite panning on the X-axis.
152-
* - `'both'`: Restricts repetition on both axes (latitude and longitude).
152+
* - `'both'`: Restricts repetition on both latitude and longitude axes.
153+
*
154+
* When set to `true` or `'latitude'`, zooming out is limited to prevent the map from repeating, allowing it to cover the entire visible area without repetition.
153155
*
154156
* @default false
155157
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no">
5+
<title>XYZ Maps Example: World Repetition Modes</title>
6+
<style type="text/css">
7+
#map {
8+
position: absolute;
9+
overflow: hidden;
10+
top: 0;
11+
left: 0;
12+
width: 100%;
13+
height: 100%;
14+
}
15+
</style>
16+
</head>
17+
<body>
18+
<div id="map"></div>
19+
</body>
20+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import {MVTLayer} from '@here/xyz-maps-core';
2+
import {Map} from '@here/xyz-maps-display';
3+
4+
// This example demonstrates the `singleWorldView` option,
5+
// which controls whether the map repeats infinitely when zoomed out.
6+
// It has the following options:
7+
8+
// - `true`: Restricts repetition on both latitude (Y-axis) and longitude (X-axis).
9+
// - `false`: Allows infinite repetition on both axes.
10+
// - `'latitude'`: Restricts repetition only on the latitude (Y-axis), allowing infinite panning on the X-axis.
11+
// - `'both'`: Restricts repetition on both latitude and longitude axes.
12+
13+
// When set to `true` or `'latitude'`, zooming out is limited to prevent the map from repeating, allowing it to cover the entire visible area without repetition.
14+
15+
// In this example, `singleWorldView: true` ensures that the world is displayed only once at the maximum zoom-out level,
16+
// and repetition is restricted on both axes (latitude and longitude).
17+
18+
const display = new Map(document.getElementById('map'), {
19+
zoomlevel: 2,
20+
center: {
21+
longitude: -122.48024,
22+
latitude: 37.77326
23+
},
24+
layers: [
25+
new MVTLayer({
26+
min: 1,
27+
max: 20,
28+
remote: {
29+
url: 'https://vector.hereapi.com/v2/vectortiles/base/mc/{z}/{x}/{y}/omv?apikey=' + YOUR_API_KEY
30+
}
31+
})
32+
],
33+
// Restricts repetition on both latitude and longitude axes. Zoom-out is limited to prevent the map from repeating.
34+
singleWorldView: true
35+
});

packages/playground/examples/examples.json

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
{
6868
"file": "./display/custom_lightning.html",
6969
"docs": "interfaces/core.layerstyle.html#lights"
70+
},
71+
{
72+
"file": "./display/world_repetition_modes.html",
73+
"docs": "interfaces/display.mapoptions.html#singleworldview"
7074
}
7175
],
7276
"Editor": [

0 commit comments

Comments
 (0)