Skip to content

Commit 5e64ceb

Browse files
author
Andrii Heonia
committed
fix pixel ratio for all examples
Signed-off-by: Andrii Heonia <andrii.heonia@here.com>
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());

finding-the-nearest-marker/demo.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
function findNearestMarker(coords) {
33
var minDist = 1000,
44
nearest_text = '*None*',
@@ -37,18 +37,14 @@ function addClickEventListenerToMap(map) {
3737
var platform = new H.service.Platform({
3838
apikey: window.apikey
3939
});
40-
var pixelRatio = window.devicePixelRatio || 1;
41-
var defaultLayers = platform.createDefaultLayers({
42-
tileSize: pixelRatio === 1 ? 256 : 512,
43-
ppi: pixelRatio === 1 ? undefined : 320
44-
});
40+
var defaultLayers = platform.createDefaultLayers();
4541

4642
//Step 2: initialize a map
4743
var map = new H.Map(document.getElementById('map'),
4844
defaultLayers.vector.normal.map,{
4945
center: {lat: 60.1697, lng:24.8292},
5046
zoom: 16,
51-
pixelRatio: pixelRatio
47+
pixelRatio: window.devicePixelRatio || 1
5248
});
5349
// add a resize listener to make sure that the map occupies the whole container
5450
window.addEventListener('resize', () => map.getViewPort().resize());

geocode-a-location-from-address/demo.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,14 @@ function onError(error) {
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 California
6662
var map = new H.Map(document.getElementById('map'),
6763
defaultLayers.vector.normal.map,{
6864
center: {lat:37.376, lng:-122.034},
6965
zoom: 15,
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());

geocode-a-location-from-structured-address/demo.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,14 @@ function onError(error) {
5959
var platform = new H.service.Platform({
6060
apikey: window.apikey
6161
});
62-
var pixelRatio = window.devicePixelRatio || 1;
63-
var defaultLayers = platform.createDefaultLayers({
64-
tileSize: pixelRatio === 1 ? 256 : 512,
65-
ppi: pixelRatio === 1 ? undefined : 320
66-
});
62+
var defaultLayers = platform.createDefaultLayers();
6763

6864
//Step 2: initialize a map - this map is centered over California
6965
var map = new H.Map(document.getElementById('map'),
7066
defaultLayers.vector.normal.map,{
7167
center: {lat:37.376, lng:-122.034},
7268
zoom: 15,
73-
pixelRatio: pixelRatio
69+
pixelRatio: window.devicePixelRatio || 1
7470
});
7571
// add a resize listener to make sure that the map occupies the whole container
7672
window.addEventListener('resize', () => map.getViewPort().resize());

interactive-basemap/demo.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
/**
33
* @param {H.Map} map A HERE Map instance within the application
44
*/
@@ -16,7 +16,7 @@ function setInteractive(map){
1616
// enable interactions for the desired map features
1717
style.setInteractive(['places', 'places.populated-places'], true);
1818

19-
// add an event listener that is responsible for catching the
19+
// add an event listener that is responsible for catching the
2020
// 'tap' event on the feature and showing the infobubble
2121
provider.addEventListener('tap', onTap);
2222
}
@@ -33,18 +33,14 @@ function setInteractive(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
4339
var map = new H.Map(document.getElementById('map'),
4440
defaultLayers.vector.normal.map, {
4541
center: {lat: 52.51477270923461, lng: 13.39846691425174},
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());
@@ -71,9 +67,9 @@ function onTap(evt) {
7167
let props = evt.target.getData().properties;
7268

7369
// create a content for the infobubble
74-
let content = '<div style="width:250px">It is a ' + props.kind + ' ' + (props.kind_detail || '') +
75-
(props.population ? '<br /> population: ' + props.population : '') +
76-
'<br /> local name is ' + props['name'] +
70+
let content = '<div style="width:250px">It is a ' + props.kind + ' ' + (props.kind_detail || '') +
71+
(props.population ? '<br /> population: ' + props.population : '') +
72+
'<br /> local name is ' + props['name'] +
7773
(props['name:ar'] ? '<br /> name in Arabic is '+ props['name:ar'] : '') + '</div>';
7874

7975
// Create a bubble, if not created yet

map-at-specified-location/demo.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ var defaultLayers = platform.createDefaultLayers();
2323
var map = new H.Map(document.getElementById('map'),
2424
defaultLayers.vector.normal.map,{
2525
center: {lat:50, lng:5},
26-
zoom: 4
26+
zoom: 4,
27+
pixelRatio: window.devicePixelRatio || 1
2728
});
2829
// add a resize listener to make sure that the map occupies the whole container
2930
window.addEventListener('resize', () => map.getViewPort().resize());

map-object-events-displayed/demo.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,14 @@ function testObjectsEvents(map, logEvent) {
8888
var platform = new H.service.Platform({
8989
apikey: window.apikey
9090
});
91-
var pixelRatio = window.devicePixelRatio || 1;
92-
var defaultLayers = platform.createDefaultLayers({
93-
tileSize: pixelRatio === 1 ? 256 : 512,
94-
ppi: pixelRatio === 1 ? undefined : 320
95-
});
91+
var defaultLayers = platform.createDefaultLayers();
9692

9793
// Step 2: initialize a map
9894
var map = new H.Map(document.getElementById('map'), defaultLayers.vector.normal.map, {
9995
// initial center and zoom level of the map
10096
center: new H.geo.Point(51, 7),
10197
zoom: 5,
102-
pixelRatio: pixelRatio
98+
pixelRatio: window.devicePixelRatio || 1
10399
});
104100
// add a resize listener to make sure that the map occupies the whole container
105101
window.addEventListener('resize', () => map.getViewPort().resize());

map-objects-event-delegation/demo.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,14 @@ function testDelegation(map) {
8888
var platform = new H.service.Platform({
8989
apikey: window.apikey
9090
});
91-
var pixelRatio = window.devicePixelRatio || 1;
92-
var defaultLayers = platform.createDefaultLayers({
93-
tileSize: pixelRatio === 1 ? 256 : 512,
94-
ppi: pixelRatio === 1 ? undefined : 320
95-
});
91+
var defaultLayers = platform.createDefaultLayers();
9692

9793
// Step 2: initialize a map
9894
var map = new H.Map(document.getElementById('map'), defaultLayers.vector.normal.map, {
9995
// initial center and zoom level of the map
10096
center: new H.geo.Point(52.51, 13.4),
10197
zoom: 10,
102-
pixelRatio: pixelRatio
98+
pixelRatio: window.devicePixelRatio || 1
10399
});
104100
// add a resize listener to make sure that the map occupies the whole container
105101
window.addEventListener('resize', () => map.getViewPort().resize());

map-scale-bar-changing-from-the-metric-system/demo.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,14 @@ function useImperialMeasurements(map, defaultLayers){
2222
var platform = new H.service.Platform({
2323
apikey: window.apikey
2424
});
25-
var pixelRatio = window.devicePixelRatio || 1;
26-
var defaultLayers = platform.createDefaultLayers({
27-
tileSize: pixelRatio === 1 ? 256 : 512,
28-
ppi: pixelRatio === 1 ? undefined : 320
29-
});
25+
var defaultLayers = platform.createDefaultLayers();
3026

3127
//Step 2: initialize a map - this map is centered over Boston.
3228
var map = new H.Map(document.getElementById('map'),
3329
defaultLayers.vector.normal.map,{
3430
center: {lat:42.3572, lng:-71.0596},
3531
zoom: 14,
36-
pixelRatio: pixelRatio
32+
pixelRatio: window.devicePixelRatio || 1
3733
});
3834
// add a resize listener to make sure that the map occupies the whole container
3935
window.addEventListener('resize', () => map.getViewPort().resize());

map-using-view-bounds/demo.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ var defaultLayers = platform.createDefaultLayers();
2525
var map = new H.Map(document.getElementById('map'),
2626
defaultLayers.vector.normal.map,{
2727
center: {lat:50, lng:5},
28-
zoom: 4
28+
zoom: 4,
29+
pixelRatio: window.devicePixelRatio || 1
2930
});
3031
// add a resize listener to make sure that the map occupies the whole container
3132
window.addEventListener('resize', () => map.getViewPort().resize());

0 commit comments

Comments
 (0)