fix preset lookup

This commit is contained in:
j 2018-12-05 14:16:30 +01:00
parent 5b776ca0ee
commit 2b81162fbf

View File

@ -376,7 +376,9 @@ function updateShiftStatus() {
if (response.result) { if (response.result) {
if (response.result.status) { if (response.result.status) {
current_position = response.result.status; current_position = response.result.status;
var preset = presets[parseInt($('select[name=preset-editor]').val(), 10)]; var preset = presets.filter(function(p) {
return p.id == parseInt($('select[name=preset-editor]').val(), 10)
})[0];
preset_offset['azimuth'] = preset['position']['azimuth'] - current_position['azimuth']; preset_offset['azimuth'] = preset['position']['azimuth'] - current_position['azimuth'];
preset_offset['elevation'] = preset['position']['elevation'] - current_position['elevation']; preset_offset['elevation'] = preset['position']['elevation'] - current_position['elevation'];
preset_offset['absoluteZoom'] = preset['position']['absoluteZoom'] - current_position['absoluteZoom']; preset_offset['absoluteZoom'] = preset['position']['absoluteZoom'] - current_position['absoluteZoom'];