Skip to content

Commit

Permalink
PR-494: Address PR review.
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsunni committed Jun 10, 2024
1 parent 7e03924 commit 3bc09d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/modules/map/components/cesium/CesiumMouseTracker.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup>
import { Cartographic, Math, ScreenSpaceEventHandler, ScreenSpaceEventType } from 'cesium'
import { transform } from 'ol/proj'
import { computed, inject, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
import proj4 from 'proj4'
import { computed, inject, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { useStore } from 'vuex'
Expand Down Expand Up @@ -38,9 +38,10 @@ onMounted(() => {
})
})
onUnmounted(() => {
onBeforeUnmount(() => {
if (handler) {
handler.removeInputAction(ScreenSpaceEventType.MOUSE_MOVE)
handler.destroy()
}
})
Expand All @@ -57,7 +58,7 @@ function setupHandler() {
const cartographic = Cartographic.fromCartesian(cartesian)
const longitude = Math.toDegrees(cartographic.longitude)
const latitude = Math.toDegrees(cartographic.latitude)
let coordinate = transform([longitude, latitude], 'EPSG:4326', projection.value)
let coordinate = proj4('EPSG:4326', projection.value.getCode(), [longitude, latitude])
coordinate.push(cartographic.height)
mousePosition.value.textContent = formatCoordinate(coordinate)
Expand Down
4 changes: 2 additions & 2 deletions src/utils/coordinates/CoordinateSystem.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ export default class CoordinateSystem {
}

/**
* Returns the EPSG number of this coordinate system
* Returns the EPSG identifier of this coordinate system
*
* @returns {Number}
* @returns {String}
*/
getCode() {
return `EPSG:${this.epsgNumber}`
Expand Down

0 comments on commit 3bc09d8

Please sign in to comment.