diff --git a/src/fragments/forms/map-form/components/isochrones/isochrones.js b/src/fragments/forms/map-form/components/isochrones/isochrones.js index d4a1ade00..309d4e7a1 100644 --- a/src/fragments/forms/map-form/components/isochrones/isochrones.js +++ b/src/fragments/forms/map-form/components/isochrones/isochrones.js @@ -19,6 +19,7 @@ import IschronesDetails from './components/isochrones-details/IsochronesDetails' export default { mixins: [MapFormMixin], data: () => ({ + active: true, mode: constants.modes.isochrones, mapViewData: new MapViewData(), places: [new Place()], @@ -121,6 +122,9 @@ export default { } else { this.places = [new Place()] } + }, + '$store.getters.mode': function (activeMode) { + this.active = activeMode === this.mode } }, methods: { diff --git a/src/fragments/forms/map-form/components/map-form-mixin.js b/src/fragments/forms/map-form/components/map-form-mixin.js index 147dc8f9f..85f580795 100644 --- a/src/fragments/forms/map-form/components/map-form-mixin.js +++ b/src/fragments/forms/map-form/components/map-form-mixin.js @@ -8,17 +8,6 @@ import Place from '@/models/place' import {EventBus} from '@/common/event-bus' export default { - props: { - active: { - default: true, - type: Boolean - } - }, - watch: { - active: function (newVal) { - this.activeChanged(newVal) - } - }, computed: { /** * Provides an accessor to the ors map filters object @@ -44,16 +33,6 @@ export default { } }, methods: { - /** - * If the active state changes - * reset the places array - * @param {Boolean} isActive - */ - activeChanged(isActive) { - if (isActive) { - // this.places = [new Place()] - } - }, /** * Toggle round trip */ diff --git a/src/fragments/forms/map-form/components/optimization/optimization.js b/src/fragments/forms/map-form/components/optimization/optimization.js index 6f29cdd0c..521144b0a 100644 --- a/src/fragments/forms/map-form/components/optimization/optimization.js +++ b/src/fragments/forms/map-form/components/optimization/optimization.js @@ -24,6 +24,7 @@ import EditSkills from './components/edit-skills/EditSkills.vue' export default { mixins: [MapFormMixin], data: () => ({ + active: true, mode: constants.modes.optimization, mapViewData: new MapViewData(), skills: [], @@ -216,6 +217,9 @@ export default { this.jobs = [] this.vehicles = [] } + }, + '$store.getters.mode': function (activeMode) { + this.active = activeMode === this.mode } }, methods: { diff --git a/src/fragments/forms/map-form/components/place-and-directions/places-and-directions.js b/src/fragments/forms/map-form/components/place-and-directions/places-and-directions.js index 0e40306a9..84b7d2216 100644 --- a/src/fragments/forms/map-form/components/place-and-directions/places-and-directions.js +++ b/src/fragments/forms/map-form/components/place-and-directions/places-and-directions.js @@ -26,6 +26,7 @@ import RoundTrip from './components/round-trip/RoundTrip.vue' export default { mixins: [MapFormMixin], data: () => ({ + active: true, mapViewData: new MapViewData(), places: [new Place()], roundTripActive: false, @@ -51,6 +52,9 @@ export default { if (newVal === true && this.places.length === 1) { this.setFocusedPlaceInput(0) } + }, + '$store.getters.mode': function (activeMode) { + this.active = activeMode === constants.modes.place || activeMode === constants.modes.directions } }, computed: {