mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-13 19:40:22 +03:00
Merge pull request #2248 from Scavanger/Geozones-RC2-Fixes
Geozones RC2 fixes
This commit is contained in:
commit
3cfbcb6ce5
5 changed files with 57 additions and 11 deletions
|
@ -1607,6 +1607,10 @@ var mspHelper = (function () {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSPCodes.MSP2_INAV_GEOZONE:
|
case MSPCodes.MSP2_INAV_GEOZONE:
|
||||||
|
|
||||||
|
if (data.buffer.byteLength == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
var geozone = new Geozone(
|
var geozone = new Geozone(
|
||||||
data.getUint8(1),
|
data.getUint8(1),
|
||||||
data.getUint8(2),
|
data.getUint8(2),
|
||||||
|
|
|
@ -4832,6 +4832,12 @@
|
||||||
"geozoneInvalidzone": {
|
"geozoneInvalidzone": {
|
||||||
"message": "Invalid Geozone(s) detected:"
|
"message": "Invalid Geozone(s) detected:"
|
||||||
},
|
},
|
||||||
|
"geozoneInvalidLat": {
|
||||||
|
"message": "Invalid latitude"
|
||||||
|
},
|
||||||
|
"geozoneInvalidLon": {
|
||||||
|
"message": "Invalid longitude"
|
||||||
|
},
|
||||||
"gezoneInvalidReasonNotCC": {
|
"gezoneInvalidReasonNotCC": {
|
||||||
"message": "Not counter clockwise"
|
"message": "Not counter clockwise"
|
||||||
},
|
},
|
||||||
|
|
|
@ -513,7 +513,7 @@
|
||||||
-->
|
-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="config-section gui_box grey">
|
<div id="geozoneSettings" class="config-section gui_box grey">
|
||||||
<div class="gui_box_titlebar">
|
<div class="gui_box_titlebar">
|
||||||
<div class="spacer_box_title" data-i18n="GeozoneSettings"></div>
|
<div class="spacer_box_title" data-i18n="GeozoneSettings"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -56,6 +56,10 @@ TABS.advanced_tuning.initialize = function (callback) {
|
||||||
$('.notFixedWingTuning').show();
|
$('.notFixedWingTuning').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!FC.isFeatureEnabled('GEOZONE')) {
|
||||||
|
$('#geozoneSettings').hide();
|
||||||
|
}
|
||||||
|
|
||||||
GUI.simpleBind();
|
GUI.simpleBind();
|
||||||
|
|
||||||
i18n.localize();;
|
i18n.localize();;
|
||||||
|
|
|
@ -892,11 +892,11 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
width: 3,
|
width: 3,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
vectorLayer.kind = "geozoneline";
|
vectorLayer.kind = "geozonecircle";
|
||||||
vectorLayer.selection = false;
|
vectorLayer.selection = true;
|
||||||
|
|
||||||
geozoneLines.push(vectorLayer);
|
geozoneLines.push(vectorLayer);
|
||||||
map.addLayer(vectorLayer);
|
map.addLayer(vectorLayer);
|
||||||
|
@ -1748,17 +1748,49 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
<span class="vertexNumber"></span> \
|
<span class="vertexNumber"></span> \
|
||||||
</td> \
|
</td> \
|
||||||
<td> \
|
<td> \
|
||||||
<input type="number" class="vertexLat" readonly/> \
|
<input type="number" class="vertexLat"/> \
|
||||||
</td> \
|
</td> \
|
||||||
<td> \
|
<td> \
|
||||||
<input type="number" class="vertexLon" readonly/> \
|
<input type="number" class="vertexLon"/> \
|
||||||
</td> \
|
</td> \
|
||||||
</tr> \
|
</tr> \
|
||||||
');
|
');
|
||||||
const $row = $verticesTable.find('tr:last');
|
const $row = $verticesTable.find('tr:last');
|
||||||
$row.find('.vertexNumber').text(vertex.getNumber() + 1);
|
$row.find('.vertexNumber').text(vertex.getNumber() + 1);
|
||||||
$row.find('.vertexLat').val((vertex.getLatMap()).toLocaleString(['en-US'], {minimumFractionDigits: 7}));
|
|
||||||
$row.find('.vertexLon').val((vertex.getLonMap()).toLocaleString(['en-US'], {minimumFractionDigits: 7}));
|
$row.find('.vertexLat')
|
||||||
|
.val((vertex.getLatMap())
|
||||||
|
.toLocaleString(['en-US'], {minimumFractionDigits: 7}))
|
||||||
|
.on('change', event => {
|
||||||
|
const lat = $(event.currentTarget).val();
|
||||||
|
if (isNaN(lat) || lat < -90 || lat > 90) {
|
||||||
|
GUI.alert(i18n.getMessage("geozoneInvalidLat"));
|
||||||
|
$(event.currentTarget).val(vertex.getLatMap());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vertex.setLat(lat * 1e7);
|
||||||
|
renderGeozoneOptions();
|
||||||
|
renderGeozonesOnMap();
|
||||||
|
updateGeozoneInfo();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$row.find('.vertexLon')
|
||||||
|
.val((vertex.getLonMap())
|
||||||
|
.toLocaleString(['en-US'], {minimumFractionDigits: 7}))
|
||||||
|
.on('change', event => {
|
||||||
|
const lat = $(event.currentTarget).val();
|
||||||
|
if (isNaN(lat) || lat < -180 || lat > 180) {
|
||||||
|
GUI.alert(i18n.getMessage("geozoneInvalidLon"));
|
||||||
|
$(event.currentTarget).val(vertex.getLonMap());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vertex.setLon(lat * 1e7);
|
||||||
|
renderGeozoneOptions();
|
||||||
|
renderGeozonesOnMap();
|
||||||
|
updateGeozoneInfo();
|
||||||
|
});
|
||||||
|
|
||||||
$row.find('#removeVertex').on('click', event => {
|
$row.find('#removeVertex').on('click', event => {
|
||||||
if (selectedGeozone.getVerticesCount() > 3) {
|
if (selectedGeozone.getVerticesCount() > 3) {
|
||||||
selectedGeozone.dropVertex(vertex.getNumber());
|
selectedGeozone.dropVertex(vertex.getNumber());
|
||||||
|
@ -2150,7 +2182,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
*/
|
*/
|
||||||
app.Drag.prototype.handleDragEvent = function (evt) {
|
app.Drag.prototype.handleDragEvent = function (evt) {
|
||||||
|
|
||||||
if (tempMarker.kind == "safehomecircle") {
|
if (tempMarker.kind == "safehomecircle" || tempMarker.kind == "geozonecircle") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue