mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-13 21:11:02 +00:00
Geomap enhancements (#1767)
* Increase Geomap zoom-in ability * Use floating point for current position * Show grid squares when zoomed in too much for map * Zoom in fast after exceeding map resolution & clean up redundant code * Revert order of functions to make it easier to review * Changed grid color for better contrast with markers * Optimizations * Set x_pos/x_pos to center pixel versus upper left corner * Show more distant planes when zoomed out * Correct pixel offset when zooming in * Fix oops in x_pos/y_pos centering change * Wrapping support for lat/lon fields * Wrapping support (for Geomap lat/lon fields) * Handle wrapping for negative lat/lon
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
#include "chprintf.h"
|
||||
#include "irq_controls.hpp"
|
||||
#include "string_format.hpp"
|
||||
#include "usb_serial_device_to_host.h"
|
||||
#include "usb_serial_io.h"
|
||||
|
||||
using namespace portapack;
|
||||
|
||||
@@ -2118,7 +2118,15 @@ bool NumberField::on_key(const KeyEvent key) {
|
||||
}
|
||||
|
||||
bool NumberField::on_encoder(const EncoderEvent delta) {
|
||||
int32_t old_value = value();
|
||||
set_value(value() + (delta * step));
|
||||
|
||||
if (on_wrap) {
|
||||
if ((delta > 0) && (value() < old_value))
|
||||
on_wrap(1);
|
||||
else if ((delta < 0) && (value() > old_value))
|
||||
on_wrap(-1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -783,6 +783,7 @@ class NumberField : public Widget {
|
||||
public:
|
||||
std::function<void(NumberField&)> on_select{};
|
||||
std::function<void(int32_t)> on_change{};
|
||||
std::function<void(int32_t)> on_wrap{};
|
||||
|
||||
using range_t = std::pair<int32_t, int32_t>;
|
||||
|
||||
|
Reference in New Issue
Block a user