Perform touch constraints after remapping (tft_espi)
@@ -1155,12 +1155,12 @@ bool gslc_TDrvGetTouch(gslc_tsGui* pGui,int16_t* pnX,int16_t* pnY,uint16_t* pnPr
// For resistive displays, perform constraint and scaling
#if defined(DRV_TOUCH_ADA_STMPE610) || defined(DRV_TOUCH_ADA_SIMPLE)
- // Perform constraining to input boundaries
- nInputX = constrain(nInputX,ADATOUCH_X_MIN,ADATOUCH_X_MAX);
- nInputY = constrain(nInputY,ADATOUCH_Y_MIN,ADATOUCH_Y_MAX);
// Perform scaling from input to output
nOutputX = map(nInputX, ADATOUCH_X_MIN, ADATOUCH_X_MAX, 0, nDispOutMaxX);
nOutputY = map(nInputY, ADATOUCH_Y_MIN, ADATOUCH_Y_MAX, 0, nDispOutMaxY);
+ // Perform constraining to OUTPUT boundaries
+ nOutputX = constrain(nOutputX, 0, nDispOutMaxX);
+ nOutputY = constrain(nOutputY, 0, nDispOutMaxY);
#else
// No scaling from input to output
nOutputX = nInputX;
