MultiLine Edit
This commit is contained in:
@@ -4,12 +4,13 @@ const state = {
|
||||
type: 'none',
|
||||
index: 'none',
|
||||
editing: false,
|
||||
data: {airports: {}, parking: {}, arc: {}, node: {}, runway: {}}
|
||||
data: {airports: {}, parking: {}, arc: {}, multiarc: {}, node: {}, runway: {}}
|
||||
}
|
||||
|
||||
const SET_EDIT_AIRPORT = 'SET_EDIT_AIRPORT'
|
||||
const SET_EDIT_PARKING = 'SET_EDIT_PARKING'
|
||||
const SET_EDIT_ARC = 'SET_EDIT_ARC'
|
||||
const SET_EDIT_MULTI_ARC = 'SET_EDIT_MULTI_ARC'
|
||||
const SET_EDIT_RUNWAY = 'SET_EDIT_RUNWAY'
|
||||
|
||||
const mutations = {
|
||||
@@ -62,6 +63,29 @@ const mutations = {
|
||||
Vue.set(state, 'index', arc.index)
|
||||
Vue.set(state, 'type', 'arc')
|
||||
},
|
||||
SET_EDIT_MULTI_ARC (state, arc) {
|
||||
if (arc === undefined) {
|
||||
return
|
||||
}
|
||||
if (!state.data || state.type !== 'multiarc') {
|
||||
Vue.set(state, 'data', {})
|
||||
}
|
||||
Vue.set(state.data, 'multiarc', arc)
|
||||
if (state.data.multiarc.name === undefined) {
|
||||
Vue.set(state.data.multiarc, 'name', '')
|
||||
}
|
||||
Vue.set(state, 'index', arc.index)
|
||||
Vue.set(state, 'type', 'multiarc')
|
||||
},
|
||||
'SET_EDIT_MULTI_ARC_IDS' (state, arcs) {
|
||||
if (arcs === undefined) {
|
||||
return
|
||||
}
|
||||
if (!state.data || state.type !== 'multiarc') {
|
||||
return
|
||||
}
|
||||
state.data.multiarc.ids = state.data.multiarc.ids.concat(arcs.filter(n => n).filter((v, i, a) => a.indexOf(v) === i))
|
||||
},
|
||||
'SET_EDIT_PARKING_NAME' (state, parkingName) {
|
||||
Vue.set(state.data.parking, 'name', parkingName)
|
||||
},
|
||||
@@ -91,13 +115,25 @@ const mutations = {
|
||||
Vue.set(state.data.parking, 'coords', coords)
|
||||
},
|
||||
'SET_EDIT_ARC_NAME' (state, arcName) {
|
||||
Vue.set(state.data.arc, 'name', arcName)
|
||||
if (state.type === 'arc') {
|
||||
Vue.set(state.data.arc, 'name', arcName)
|
||||
} else {
|
||||
Vue.set(state.data.multiarc, 'name', arcName)
|
||||
}
|
||||
},
|
||||
'SET_EDIT_PUSHBACK' (state, isPushBackRoute) {
|
||||
Vue.set(state.data.arc, 'isPushBackRoute', Number(isPushBackRoute))
|
||||
if (state.type === 'arc') {
|
||||
Vue.set(state.data.arc, 'isPushBackRoute', Number(isPushBackRoute))
|
||||
} else {
|
||||
Vue.set(state.data.multiarc, 'isPushBackRoute', Number(isPushBackRoute))
|
||||
}
|
||||
},
|
||||
'SET_EDIT_DIRECTION' (state, direction) {
|
||||
Vue.set(state.data.arc, 'direction', direction)
|
||||
if (state.type === 'arc') {
|
||||
Vue.set(state.data.arc, 'direction', direction)
|
||||
} else {
|
||||
Vue.set(state.data.multiarc, 'direction', direction)
|
||||
}
|
||||
},
|
||||
'SET_EDIT_HOLDPOINTTYPE' (state, holdPointType) {
|
||||
Vue.set(state.data.node, 'holdPointType', holdPointType)
|
||||
@@ -132,6 +168,12 @@ const actions = {
|
||||
async setArc (context, arc) {
|
||||
context.commit(SET_EDIT_ARC, arc)
|
||||
},
|
||||
async setMultiArc (context, arc) {
|
||||
context.commit(SET_EDIT_MULTI_ARC, arc)
|
||||
},
|
||||
async setMultiArcIds (context, arc) {
|
||||
context.commit('SET_EDIT_MULTI_ARC_IDS', arc)
|
||||
},
|
||||
async setNode (context, node) {
|
||||
context.commit('SET_EDIT_NODE', node.attributes)
|
||||
context.commit('SET_EDIT_NODE_COORDS', node.lat.toFixed(6) + ' ' + node.lng.toFixed(6))
|
||||
|
||||
Reference in New Issue
Block a user