gpstrek - Move refresh code out of drawing method for compass
parent
6c0944718d
commit
911c12c6f1
|
|
@ -672,6 +672,9 @@ let getCompassSlice = function(){
|
||||||
const buffers = 4;
|
const buffers = 4;
|
||||||
let buf = [];
|
let buf = [];
|
||||||
return {
|
return {
|
||||||
|
refresh: function(){
|
||||||
|
return Math.abs(lastDrawnValue - compassDataSource.getCourse()) > SETTINGS.minCourseChange;
|
||||||
|
},
|
||||||
draw: function (graphics, x,y,height,width){
|
draw: function (graphics, x,y,height,width){
|
||||||
const max = 180;
|
const max = 180;
|
||||||
const increment=width/max;
|
const increment=width/max;
|
||||||
|
|
@ -680,7 +683,6 @@ let getCompassSlice = function(){
|
||||||
|
|
||||||
let course = isGpsCourse() ? s.currentPos.course : getAveragedCompass();
|
let course = isGpsCourse() ? s.currentPos.course : getAveragedCompass();
|
||||||
|
|
||||||
if (Math.abs(lastDrawnValue - compassDataSource.getCourse()) < SETTINGS.minCourseChange) return;
|
|
||||||
lastDrawnValue = course;
|
lastDrawnValue = course;
|
||||||
|
|
||||||
graphics.clearRect(x,y,x+width,y+height);
|
graphics.clearRect(x,y,x+width,y+height);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue