Skip to content

Commit 5e64ceb

Browse files
author
Andrii Heonia
committed
fix pixel ratio for all examples
Signed-off-by: Andrii Heonia <[email protected]>
1 parent a9649bb commit 5e64ceb

File tree

42 files changed

+119
-228
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+119
-228
lines changed

capture-map-area/demo.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ var map = new H.Map(mapContainer, defaultLayers.vector.normal.map, {
3838
// initial center and zoom level of the map
3939
zoom: 16,
4040
// Champs-Elysees
41-
center: {lat: 48.869145, lng: 2.314298}
41+
center: {lat: 48.869145, lng: 2.314298},
42+
pixelRatio: window.devicePixelRatio || 1
4243
});
4344
// add a resize listener to make sure that the map occupies the whole container
4445
window.addEventListener('resize', () => map.getViewPort().resize());

change-style-at-runtime/demo.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
/**
33
* The function add the "change" event listener to the map's style
44
* and modifies colors of the map features within that listener.
@@ -22,7 +22,7 @@ function changeFeatureStyle(map){
2222
// see the Developer's guide
2323
parkConfig.layers.landuse.park.draw.polygons.color = '#2ba815'
2424
parkConfig.layers.landuse.builtup.draw.polygons.color = '#676d67'
25-
25+
2626
// merge the configuration back to the base layer configuration
2727
parkStyle.mergeConfig(parkConfig);
2828
}
@@ -41,18 +41,14 @@ function changeFeatureStyle(map){
4141
var platform = new H.service.Platform({
4242
apikey: window.apikey
4343
});
44-
var pixelRatio = window.devicePixelRatio || 1;
45-
var defaultLayers = platform.createDefaultLayers({
46-
tileSize: pixelRatio === 1 ? 256 : 512,
47-
ppi: pixelRatio === 1 ? undefined : 320
48-
});
44+
var defaultLayers = platform.createDefaultLayers();
4945

5046
//Step 2: initialize a map
5147
var map = new H.Map(document.getElementById('map'),
5248
defaultLayers.vector.normal.map, {
5349
center: {lat: 52.51477270923461, lng: 13.39846691425174},
5450
zoom: 13,
55-
pixelRatio: pixelRatio
51+
pixelRatio: window.devicePixelRatio || 1
5652
});
5753
// add a resize listener to make sure that the map occupies the whole container
5854
window.addEventListener('resize', () => map.getViewPort().resize());

circle-on-the-map/demo.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
/**
33
* Adds a circle over New Delhi with a radius of 1000 metres onto the map
44
*
@@ -33,18 +33,14 @@ function addCircleToMap(map){
3333
var platform = new H.service.Platform({
3434
apikey: window.apikey
3535
});
36-
var pixelRatio = window.devicePixelRatio || 1;
37-
var defaultLayers = platform.createDefaultLayers({
38-
tileSize: pixelRatio === 1 ? 256 : 512,
39-
ppi: pixelRatio === 1 ? undefined : 320
40-
});
36+
var defaultLayers = platform.createDefaultLayers();
4137

4238
//Step 2: initialize a map - this map is centered over New Delhi
4339
var map = new H.Map(document.getElementById('map'),
4440
defaultLayers.vector.normal.map, {
4541
center: {lat:28.6071, lng:77.2127},
4642
zoom: 13,
47-
pixelRatio: pixelRatio
43+
pixelRatio: window.devicePixelRatio || 1
4844
});
4945
// add a resize listener to make sure that the map occupies the whole container
5046
window.addEventListener('resize', () => map.getViewPort().resize());

context_menu/demo.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ var defaultLayers = platform.createDefaultLayers();
9595
// Step 2: initialize a map
9696
var map = new H.Map(document.getElementById('map'), defaultLayers.vector.normal.map, {
9797
center: {lat: 52.55006203880433, lng: 13.27548854220585},
98-
zoom: 9
98+
zoom: 9,
99+
pixelRatio: window.devicePixelRatio || 1
99100
});
100101

101102
// Step 3: make the map interactive

custom-cluster-theme/demo.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,13 @@ var platform = new H.service.Platform({
146146
apikey: window.apikey,
147147
useHTTPS: true
148148
});
149-
var pixelRatio = window.devicePixelRatio || 1;
150-
var defaultLayers = platform.createDefaultLayers({
151-
tileSize: pixelRatio === 1 ? 256 : 512,
152-
ppi: pixelRatio === 1 ? undefined : 320
153-
});
149+
var defaultLayers = platform.createDefaultLayers();
154150

155151
// Step 2: initialize a map
156152
var map = new H.Map(document.getElementById('map'), defaultLayers.vector.normal.map, {
157153
center: new H.geo.Point(50.426467222414374, 6.3054632497803595),
158154
zoom: 6,
159-
pixelRatio: pixelRatio
155+
pixelRatio: window.devicePixelRatio || 1
160156
});
161157
// add a resize listener to make sure that the map occupies the whole container
162158
window.addEventListener('resize', () => map.getViewPort().resize());

custom-tile-overlay/demo.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ var defaultLayers = platform.createDefaultLayers();
6363
// Step 2: initialize a map
6464
var map = new H.Map(document.getElementById('map'), defaultLayers.vector.normal.map, {
6565
center: new H.geo.Point(52.515, 13.405),
66-
zoom: 14
66+
zoom: 14,
67+
pixelRatio: window.devicePixelRatio || 1
6768
});
6869
// add a resize listener to make sure that the map occupies the whole container
6970
window.addEventListener('resize', () => map.getViewPort().resize());

custom-zooming-into-bounds/demo.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,14 @@ function setUpCustomZooming(map) {
6262
var platform = new H.service.Platform({
6363
apikey: window.apikey
6464
});
65-
var pixelRatio = window.devicePixelRatio || 1;
66-
var defaultLayers = platform.createDefaultLayers({
67-
tileSize: pixelRatio === 1 ? 256 : 512,
68-
ppi: pixelRatio === 1 ? undefined : 320
69-
});
65+
var defaultLayers = platform.createDefaultLayers();
7066

7167
// Step 2: initialize a map
7268
var map = new H.Map(document.getElementById('map'), defaultLayers.vector.normal.map, {
7369
// initial center and zoom level of the map
7470
center: new H.geo.Point(41.4822, -81.6697),
7571
zoom: 4,
76-
pixelRatio: pixelRatio
72+
pixelRatio: window.devicePixelRatio || 1
7773
});
7874
// add a resize listener to make sure that the map occupies the whole container
7975
window.addEventListener('resize', () => map.getViewPort().resize());

display-kml-on-map/demo.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ var defaultLayers = platform.createDefaultLayers();
4040
// Step 2: initialize a map
4141
var map = new H.Map(document.getElementById('map'), defaultLayers.vector.normal.map, {
4242
zoom: 2.5,
43-
center: {lat: 48.30432303555956, lng: -104.94466241321628}
43+
center: {lat: 48.30432303555956, lng: -104.94466241321628},
44+
pixelRatio: window.devicePixelRatio || 1
4445
});
4546
// add a resize listener to make sure that the map occupies the whole container
4647
window.addEventListener('resize', () => map.getViewPort().resize());

draggable-marker/demo.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
/**
33
* Adds a draggable marker to the map..
44
*
@@ -56,18 +56,14 @@ function addDraggableMarker(map, behavior){
5656
var platform = new H.service.Platform({
5757
apikey: window.apikey
5858
});
59-
var pixelRatio = window.devicePixelRatio || 1;
60-
var defaultLayers = platform.createDefaultLayers({
61-
tileSize: pixelRatio === 1 ? 256 : 512,
62-
ppi: pixelRatio === 1 ? undefined : 320
63-
});
59+
var defaultLayers = platform.createDefaultLayers();
6460

6561
//Step 2: initialize a map - this map is centered over Boston
6662
var map = new H.Map(document.getElementById('map'),
6763
defaultLayers.vector.normal.map,{
6864
center: {lat:42.35805, lng:-71.0636},
6965
zoom: 12,
70-
pixelRatio: pixelRatio
66+
pixelRatio: window.devicePixelRatio || 1
7167
});
7268
// add a resize listener to make sure that the map occupies the whole container
7369
window.addEventListener('resize', () => map.getViewPort().resize());

example-template/demo.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ var map = new H.Map(mapContainer, defaultLayers.vector.normal.map, {
4040
// initial center and zoom level of the map
4141
zoom: 16,
4242
// Champs-Elysees
43-
center: {lat: 48.869145, lng: 2.314298}
43+
center: {lat: 48.869145, lng: 2.314298},
44+
pixelRatio: window.devicePixelRatio || 1
4445
});
4546
// add a resize listener to make sure that the map occupies the whole container
4647
window.addEventListener('resize', () => map.getViewPort().resize());

0 commit comments

Comments
 (0)