Skip to content

Commit 6c28b7c

Browse files
authored
Merge pull request #79 from thekid/feature/map-interactions
Explicitely set map interactions
2 parents 5c60608 + eafd340 commit 6c28b7c

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

src/main/handlebars/content.handlebars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ parent: feed
2727
{{count item.views '' '(Eine Ansicht)' '(# Ansichten)'}}
2828
</div>
2929

30-
<div id="map" tabindex="1">
30+
<div id="map" tabindex="0">
3131
<div class="popup"></div>
3232
</div>
3333

src/main/handlebars/journey.handlebars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ parent: feed
2929
</div>
3030
{{> partials/images in=journey first='true' style='overview'}}
3131

32-
<div id="map" tabindex="1">
32+
<div id="map" tabindex="0">
3333
<div class="popup"></div>
3434
</div>
3535

src/main/handlebars/journeys.handlebars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{{/with}}
1212
{{/inline}}
1313
{{#*inline "main"}}
14-
<div id="map" class="full" tabindex="1">
14+
<div id="map" class="full" tabindex="0">
1515
<div class="popup"></div>
1616
</div>
1717

src/main/js/mapping.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,19 @@ class Mapping {
2828

2929
/** Escape input for use in HTML */
3030
html(input) {
31-
return input.replace(/[<>&]/g, c => '&#' + c.charCodeAt(0) + ';');
31+
return input?.replace(/[<>&]/g, c => '&#' + c.charCodeAt(0) + ';');
3232
}
3333

3434
/** Project this map on to a given DOM element */
3535
project($element, connect) {
3636
const map = new ol.Map({
37+
interactions: [
38+
new ol.interaction.DragPan(),
39+
new ol.interaction.PinchZoom(),
40+
new ol.interaction.MouseWheelZoom({condition: event => event.originalEvent.ctrlKey}),
41+
new ol.interaction.KeyboardPan(),
42+
new ol.interaction.KeyboardZoom(),
43+
],
3744
target: $element,
3845
layers: [new ol.layer.Tile({source: new ol.source.OSM()})]
3946
});

0 commit comments

Comments
 (0)