Skip to content

Commit

Permalink
PB-387: Add out of bound warning for geolocation in 3d
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasJoss committed Jun 25, 2024
1 parent b920e1d commit afc8c27
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/store/modules/position.store.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ const actions = {
return
}
if (Array.isArray(center)) {
if (LV95.isInBounds(center[0], center[1])) {
if (state.projection.epsg != LV95.epsg || LV95.isInBounds(center[0], center[1])) {
commit('setCenter', {
x: center[0],
y: center[1],
Expand All @@ -227,7 +227,7 @@ const actions = {
log.debug('center received is out of bounds, ignoring')
}
} else {
if (LV95.isInBounds(center.x, center.y)) {
if (state.projection.epsg != LV95.epsg || LV95.isInBounds(center.x, center.y)) {
const { x, y } = center
commit('setCenter', { x, y, dispatcher })
} else {
Expand Down
8 changes: 6 additions & 2 deletions src/store/plugins/geolocation-management.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import proj4 from 'proj4'

import { IS_TESTING_WITH_CYPRESS } from '@/config'
import { STANDARD_ZOOM_LEVEL_1_25000_MAP } from '@/utils/coordinates/CoordinateSystem.class'
import { LV95, WGS84 } from '@/utils/coordinates/coordinateSystems'
import { LV95, WEBMERCATOR, WGS84 } from '@/utils/coordinates/coordinateSystems'
import CustomCoordinateSystem from '@/utils/coordinates/CustomCoordinateSystem.class.js'
import log from '@/utils/logging'

Expand All @@ -14,7 +14,11 @@ let geolocationWatcher = null
let firstTimeActivatingGeolocation = true

function setCenterIfInBounds(store, center) {
if (LV95.isInBounds(center[0], center[1])) {
if (
store.state.cesium.active
? LV95.getBoundsAs(WEBMERCATOR).isInBounds(center[0], center[1])
: LV95.isInBounds(center[0], center[1])
) {
store.dispatch('setCenter', {
center: center,
...dispatcher,
Expand Down

0 comments on commit afc8c27

Please sign in to comment.