Clip values to display range

pull/1892/head
Martin Boonk 2022-05-27 13:16:47 +02:00
parent cddaf36f1a
commit f763cd962f
1 changed files with 2 additions and 2 deletions

View File

@ -9,6 +9,6 @@ Bangle.on('touch', function(button, xy) {
}
// apply the calibration offset
xy.x = Math.round((xy.x + cal_settings.xoffset) * cal_settings.xscale);
xy.y = Math.round((xy.y + cal_settings.yoffset) * cal_settings.yscale);
xy.x = E.clip(Math.round((xy.x + (cal_settings.xoffset || 0)) * (cal_settings.xscale || 1)),0,g.getWidth());
xy.y = E.clip(Math.round((xy.y + (cal_settings.yoffset || 0)) * (cal_settings.yscale || 1)),0,g.getHeight());
});