Commit 153a139e authored by DoinLakeFlyer's avatar DoinLakeFlyer

parent 80878ee8
......@@ -598,6 +598,16 @@ void MissionController::removeMissionItem(int viIndex)
}
_recalcAll();
// Adjust current item
int newVIIndex;
if (viIndex >= _visualItems->count()) {
newVIIndex = _visualItems->count() - 1;
} else {
newVIIndex = viIndex;
}
setCurrentPlanViewSeqNum(_visualItems->value<VisualMissionItem*>(newVIIndex)->sequenceNumber(), true);
setDirty(true);
}
......
......@@ -846,12 +846,11 @@ Item {
readOnly: false
onClicked: _missionController.setCurrentPlanViewSeqNum(object.sequenceNumber, false)
onRemove: {
var removeIndex = index
_missionController.removeMissionItem(removeIndex)
if (removeIndex >= _missionController.visualItems.count) {
removeIndex--
var removeVIIndex = index
_missionController.removeMissionItem(removeVIIndex)
if (removeVIIndex >= _missionController.visualItems.count) {
removeVIIndex--
}
_missionController.setCurrentPlanViewSeqNum(removeIndex, true)
}
onSelectNextNotReadyItem: selectNextNotReady()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment