mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
Trim: GraphPixelsPerPoint mush remain a power of zoom_offset
This commit is contained in:
parent
ad20dcb30a
commit
4eef1f1bff
1 changed files with 7 additions and 1 deletions
|
@ -689,13 +689,19 @@ void Plot::Move(int offset) {
|
||||||
|
|
||||||
void Plot::Trim(void) {
|
void Plot::Trim(void) {
|
||||||
uint32_t lref, rref;
|
uint32_t lref, rref;
|
||||||
|
const double zoom_offset = 1.148698354997035; // 2**(1/5)
|
||||||
if ((CursorAPos == 0) || (CursorBPos == 0)) { // if we don't have both cursors set
|
if ((CursorAPos == 0) || (CursorBPos == 0)) { // if we don't have both cursors set
|
||||||
lref = GraphStart;
|
lref = GraphStart;
|
||||||
rref = GraphStop;
|
rref = GraphStop;
|
||||||
} else {
|
} else {
|
||||||
lref = CursorAPos < CursorBPos ? CursorAPos : CursorBPos;
|
lref = CursorAPos < CursorBPos ? CursorAPos : CursorBPos;
|
||||||
rref = CursorAPos < CursorBPos ? CursorBPos : CursorAPos;
|
rref = CursorAPos < CursorBPos ? CursorBPos : CursorAPos;
|
||||||
GraphPixelsPerPoint = GraphPixelsPerPoint * (GraphStop - GraphStart) / (rref - lref);
|
// GraphPixelsPerPoint mush remain a power of zoom_offset
|
||||||
|
double GPPPtarget = GraphPixelsPerPoint * (GraphStop - GraphStart) / (rref - lref);
|
||||||
|
while (GraphPixelsPerPoint < GPPPtarget) {
|
||||||
|
GraphPixelsPerPoint *= zoom_offset;
|
||||||
|
}
|
||||||
|
GraphPixelsPerPoint /= zoom_offset;
|
||||||
CursorAPos -= lref;
|
CursorAPos -= lref;
|
||||||
CursorBPos -= lref;
|
CursorBPos -= lref;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue