Skip to content

Commit 1c6f767

Browse files
authored
Merge pull request #189 from Dataport/fix/zoom-overlay
Adjust overlay mechanic for macOS devices
2 parents 0bcbe9a + 5215618 commit 1c6f767

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

packages/core/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- Fix: Move basic documentation of `layers` from `@polar/plugin-layer-chooser` to `@polar/core`.
1414
- Fix: Adjust documentation to properly describe optionality of configuration parameters.
1515
- Fix: Add package `events` as a dependency to fix issue with `xml2js`. See https://github.com/Leonidas-from-XIV/node-xml2js/issues/697 for more information.
16+
- Fix: Adjust overlay to properly be displayed on macOS devices.
1617
- Chore: Update dependencies to latest versions.
1718

1819
## 1.4.1

packages/core/src/components/MapContainer.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class="polar-map-overlay"
77
>
88
<template v-if="noControlOnZoom">
9-
{{ $t('common:overlay.noControlOnZoom') }}
9+
{{ $t(overlayLocale) }}
1010
</template>
1111
<template v-else-if="oneFingerPan">
1212
{{ $t('common:overlay.oneFingerPan') }}
@@ -58,6 +58,8 @@ import MapUi from './MapUi.vue'
5858
// NOTE: OpenLayers styles need to be imported as the map resides in the shadow DOM
5959
import 'ol/ol.css'
6060
61+
const isMacOS = navigator.userAgent.indexOf('Mac') !== -1
62+
6163
export default Vue.extend({
6264
components: {
6365
MapUi,
@@ -91,6 +93,9 @@ export default Vue.extend({
9193
'moveHandle',
9294
'moveHandleActionButton',
9395
]),
96+
overlayLocale() {
97+
return `common:overlay.${isMacOS ? 'noCommandOnZoom' : 'noControlOnZoom'}`
98+
},
9499
renderMoveHandle() {
95100
return (
96101
this.moveHandle !== null && this.hasWindowSize && this.hasSmallWidth
@@ -203,9 +208,9 @@ export default Vue.extend({
203208
}
204209
}
205210
},
206-
wheelEffect({ ctrlKey }) {
211+
wheelEffect(event: WheelEvent) {
207212
clearTimeout(this.noControlOnZoomTimeout)
208-
this.noControlOnZoom = !ctrlKey
213+
this.noControlOnZoom = isMacOS ? !event.metaKey : !event.ctrlKey
209214
this.noControlOnZoomTimeout = setTimeout(
210215
() => (this.noControlOnZoom = false),
211216
2000

packages/core/src/language/locales/de.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ const de: Resource = {
1111
},
1212
overlay: {
1313
noControlOnZoom: 'Verwenden Sie Strg+Scrollen zum Zoomen der Karte',
14+
noCommandOnZoom:
15+
'Verwenden Sie Command ⌘ + Scrollen zum Zoomen der Karte',
1416
oneFingerPan:
1517
'Verwenden Sie mindestens zwei Finger zum Verschieben der Karte',
1618
},

packages/core/src/language/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const en: Resource = {
1111
},
1212
overlay: {
1313
noControlOnZoom: 'Use Ctrl+Mousewheel to zoom into the map',
14+
noCommandOnZoom: 'Use Command ⌘ + Mousewheel to zoom into the map',
1415
oneFingerPan: 'Use at least two fingers to pan the map',
1516
},
1617
},

0 commit comments

Comments
 (0)