This commit is contained in:
Keith Paterson 2021-06-02 12:12:52 +02:00
parent 091e7853eb
commit b2ddb08374

View File

@ -177,8 +177,7 @@
:step="0.1" :step="0.1"
:precision="1" :precision="1"
:disabled="!editing || calculate === 'Heading'" :disabled="!editing || calculate === 'Heading'"
@focus="headingFocussed = true" @change="headingChange"
@blur="headingFocussed = false"
></el-input-number> ></el-input-number>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
@ -245,7 +244,24 @@
const turfOptions = { units: 'kilometers' }; const turfOptions = { units: 'kilometers' };
export default { export default {
mounted() {
this.$store.watch(
function (state) {
return state.Editable.data.parking;
},
() => { this.editedParking() }
,
{
deep: true //add this if u need to watch object properties change etc.
}
);
},
methods: { methods: {
editedParking() {
this.externalChange = true
this.heading = Number(this.$store.state.Editable.data.parking.heading);
this.externalChange = false
},
rotate() { rotate() {
var heading = this.$store.state.Editable.data.parking.heading + 90; var heading = this.$store.state.Editable.data.parking.heading + 90;
while (heading>=360) { while (heading>=360) {
@ -254,9 +270,7 @@
while (heading<0) { while (heading<0) {
heading += 360 heading += 360
} }
this.rotateFocussed = true;
this.headingChange(heading); this.headingChange(heading);
this.rotateFocussed = false;
}, },
headingChange( newValue ) { headingChange( newValue ) {
while (newValue>=360) { while (newValue>=360) {
@ -265,8 +279,8 @@
while (newValue<0) { while (newValue<0) {
newValue += 360 newValue += 360
} }
if ( Math.abs( ( this.$store.state.Editable.data.parking.heading - newValue ) >= 0 && Math.abs( this.$store.state.Editable.data.parking.heading - newValue ) <= 0.1 ) if ( ( Math.abs( this.$store.state.Editable.data.parking.heading - newValue ) >= 0 && Math.abs( this.$store.state.Editable.data.parking.heading - newValue ) <= 0.1 )
|| this.headingFocussed || this.rotateFocussed) { || !this.externalChange) {
if (Number(this.$store.state.Editable.data.parking.heading) !== newValue) { if (Number(this.$store.state.Editable.data.parking.heading) !== newValue) {
this.$store.commit('SET_EDIT_PARKING_HEADING', newValue) this.$store.commit('SET_EDIT_PARKING_HEADING', newValue)
} }
@ -331,7 +345,7 @@
} }
} }
}, },
data () { return {rotateFocussed: false, headingFocussed: false, coordFocussed: false, noseCoordFocussed: false, calculateState: 'Nose Wheel', noseWheel: '', validRadii: [7.5, 10, 14, 18, 26, 33, 40], validN2M: [5, 5, 6, 10, 15, 24, 24] } }, data () { return {rotateFocussed: false, externalChange: false, coordFocussed: false, noseCoordFocussed: false, calculateState: 'Nose Wheel', noseWheel: '', validRadii: [7.5, 10, 14, 18, 26, 33, 40], validN2M: [5, 5, 6, 10, 15, 24, 24], heading: 0 }},
computed: { computed: {
editing: { editing: {
get: function () { get: function () {
@ -451,16 +465,6 @@
this.calcCenter(); this.calcCenter();
} }
}, },
heading: {
// getter
get: function () {
return this.$store.state.Editable.data.parking.heading
},
// setter
set: function (newValue) {
this.headingChange(newValue)
}
},
wingspan: { wingspan: {
// getter // getter
get: function () { get: function () {