Deselect
This commit is contained in:
parent
ac0879b7b8
commit
fb4d518c6c
@ -249,6 +249,13 @@
|
|||||||
console.error("Lookup " + index + " failed ");
|
console.error("Lookup " + index + " failed ");
|
||||||
this.buildLookup()
|
this.buildLookup()
|
||||||
}
|
}
|
||||||
|
if (Number(this.$store.state.Editable.index) >= 0 &&
|
||||||
|
this.featureLookup[this.$store.state.Editable.index]!==undefined) {
|
||||||
|
this.featureLookup[this.$store.state.Editable.index].forEach(element => {
|
||||||
|
element.deselect();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.featureLookup[index].forEach((element, i) => {
|
this.featureLookup[index].forEach((element, i) => {
|
||||||
if (element instanceof L.Polyline) {
|
if (element instanceof L.Polyline) {
|
||||||
element._latlngs.forEach((e1, index1) => {
|
element._latlngs.forEach((e1, index1) => {
|
||||||
|
@ -182,29 +182,19 @@ L.ParkingSpot = L.Circle.extend({
|
|||||||
});
|
});
|
||||||
this.on('editable:vertex:clicked', function (event) {
|
this.on('editable:vertex:clicked', function (event) {
|
||||||
console.debug(this.featureLookup[event.vertex.glueindex]);
|
console.debug(this.featureLookup[event.vertex.glueindex]);
|
||||||
|
if (Number(store.default.state.Editable.index) >= 0 &&
|
||||||
|
this.featureLookup[store.default.state.Editable.index]!==undefined) {
|
||||||
|
this.featureLookup[store.default.state.Editable.index].forEach(element => {
|
||||||
|
if(element.deselect !== undefined) {
|
||||||
|
element.deselect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(event.target.editor._resizeLatLng.__vertex._icon !== event.sourceTarget._element){
|
if(event.target.editor._resizeLatLng.__vertex._icon !== event.sourceTarget._element){
|
||||||
event.vertex._icon.style['background-color'] = 'red';
|
event.vertex._icon.style['background-color'] = 'red';
|
||||||
store.default.dispatch('setParking', event.target.options.attributes);
|
store.default.dispatch('setParking', event.target.options.attributes);
|
||||||
this.select();
|
this.select();
|
||||||
this.unwatch = store.default.watch(
|
|
||||||
function (state) {
|
|
||||||
return state.Editable.data.parking;
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
if(state === undefined ||
|
|
||||||
state.index !== Number(event.target.glueindex)) {
|
|
||||||
if (event.target instanceof L.ParkingSpot) {
|
|
||||||
this.deselect();
|
|
||||||
this.unwatch();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
deep: true //add this if u need to watch object properties change etc.
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -217,27 +207,19 @@ L.ParkingSpot = L.Circle.extend({
|
|||||||
|
|
||||||
},
|
},
|
||||||
selectParking() {
|
selectParking() {
|
||||||
|
if (Number(store.default.state.Editable.index) >= 0 &&
|
||||||
|
this.featureLookup[store.default.state.Editable.index]!==undefined) {
|
||||||
|
this.featureLookup[store.default.state.Editable.index].forEach(element => {
|
||||||
|
if(element.deselect !== undefined) {
|
||||||
|
element.deselect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
store.default.dispatch('setParking', this.options.attributes);
|
store.default.dispatch('setParking', this.options.attributes);
|
||||||
store.default.dispatch('setParkingCoords', this.getLatLng().lat.toFixed(5) + ' ' + this.getLatLng().lng.toFixed(5));
|
store.default.dispatch('setParkingCoords', this.getLatLng().lat.toFixed(5) + ' ' + this.getLatLng().lng.toFixed(5));
|
||||||
|
|
||||||
this.select();
|
this.select();
|
||||||
this.unwatch = store.default.watch(
|
|
||||||
function (state) {
|
|
||||||
return state.Editable.data.parking;
|
|
||||||
},
|
|
||||||
(state) => {
|
|
||||||
if(state === undefined ||
|
|
||||||
state.index !== Number(this.options.attributes.index)) {
|
|
||||||
this.deselect();
|
|
||||||
this.unwatch();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
deep: true //add this if u need to watch object properties change etc.
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
turfToLatLng: function (turfPoint) {
|
turfToLatLng: function (turfPoint) {
|
||||||
return {lat: turfPoint.geometry.coordinates[1], lng: turfPoint.geometry.coordinates[0]};
|
return {lat: turfPoint.geometry.coordinates[1], lng: turfPoint.geometry.coordinates[0]};
|
||||||
|
@ -25,27 +25,6 @@ L.RunwayNode = L.Marker.extend({
|
|||||||
if (store.default.state.Editable.index !== event.target.options.attributes.index) {
|
if (store.default.state.Editable.index !== event.target.options.attributes.index) {
|
||||||
store.default.dispatch('setRunway', event.target.options.attributes);
|
store.default.dispatch('setRunway', event.target.options.attributes);
|
||||||
}
|
}
|
||||||
this.unwatch = store.default.watch(
|
|
||||||
function (state) {
|
|
||||||
return state.Editable.data.runway;
|
|
||||||
},
|
|
||||||
(state) => {
|
|
||||||
// Reset colour
|
|
||||||
if(event.target instanceof L.RunwayNode &&
|
|
||||||
event.target.options.attributes &&
|
|
||||||
event.target.options.attributes.selected) {
|
|
||||||
event.target.options.attributes.selected = false;
|
|
||||||
event.target.deselect();
|
|
||||||
this.unwatch();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
deep: true //add this if u need to watch object properties change etc.
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
select() {
|
select() {
|
||||||
|
Loading…
Reference in New Issue
Block a user