Skip to content

Commit a8e8da2

Browse files
committed
Move computed variable to be a const
1 parent bee3c60 commit a8e8da2

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

packages/core/src/components/MapContainer.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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,13 +93,8 @@ export default Vue.extend({
9193
'moveHandle',
9294
'moveHandleActionButton',
9395
]),
94-
isMacOS() {
95-
return navigator.userAgent.indexOf('Mac') !== -1
96-
},
9796
overlayLocale() {
98-
return `common:overlay.${
99-
this.isMacOS ? 'noCommandOnZoom' : 'noControlOnZoom'
100-
}`
97+
return `common:overlay.${isMacOS ? 'noCommandOnZoom' : 'noControlOnZoom'}`
10198
},
10299
renderMoveHandle() {
103100
return (
@@ -213,7 +210,7 @@ export default Vue.extend({
213210
},
214211
wheelEffect(event: WheelEvent) {
215212
clearTimeout(this.noControlOnZoomTimeout)
216-
this.noControlOnZoom = this.isMacOS ? !event.metaKey : !event.ctrlKey
213+
this.noControlOnZoom = isMacOS ? !event.metaKey : !event.ctrlKey
217214
this.noControlOnZoomTimeout = setTimeout(
218215
() => (this.noControlOnZoom = false),
219216
2000

0 commit comments

Comments
 (0)