gpstrek - Move refresh code out of drawing method for compass

pull/2768/head
Martin Boonk 2023-06-11 19:50:15 +02:00
parent 6c0944718d
commit 911c12c6f1
1 changed files with 3 additions and 1 deletions

View File

@ -672,6 +672,9 @@ let getCompassSlice = function(){
const buffers = 4;
let buf = [];
return {
refresh: function(){
return Math.abs(lastDrawnValue - compassDataSource.getCourse()) > SETTINGS.minCourseChange;
},
draw: function (graphics, x,y,height,width){
const max = 180;
const increment=width/max;
@ -680,7 +683,6 @@ let getCompassSlice = function(){
let course = isGpsCourse() ? s.currentPos.course : getAveragedCompass();
if (Math.abs(lastDrawnValue - compassDataSource.getCourse()) < SETTINGS.minCourseChange) return;
lastDrawnValue = course;
graphics.clearRect(x,y,x+width,y+height);