Controlling LCD display with sensors delay issue

Hello all, I have an issue of LCD displaying. For my project, I need to use multiple sensors to control different areas of the LCD. For now, I just divided the LCD display into 3 regions. And one more important feature of my project is that the sensors should be controlled independently, which means that if I press three sensors, three regions will light up.

Now I have an issue that when I press sensors, the regions on LCD will be on, but there is a big delay, sometimes it does not even work. Could someone help me?

i am using HiLetgo 3.2" IPS TFT LCD Display ILI9481 480X320 and Arduino Mega 2560

Code is here:

#include <TFT_HX8357.h> // Hardware-specific library

TFT_HX8357 tft = TFT_HX8357();       // Invoke custom library

#define sensor1 2
#define sensor2 3
#define sensor3 4
#define sensor4 5
#define sensor5 6 

byte lastSensor1State;
byte lastSensor2State;
byte lastSensor3State;
byte lastSensor4State;
byte lastSensor5State;

//Timer variables used
unsigned long currentMillis;
unsigned long pin13Millis;
unsigned long SwitchMillis;

//if these are not changed in the sketch, they can be const
unsigned long debounceMillis = 20UL;  //10ms
unsigned long ledOnTime      = 500UL; //500ms seconds

//**********************************************************************
//void loop() {
//  // put your main code here, to run repeatedly:
//  tft.fillRect(5, 3, 230, 119, TFT_WHITE);
//  tft.fillRect(5, 3, 230, 119, TFT_BLACK);
  
//  tft.fillRect(240, 125, 230, 119, TFT_WHITE);
//  tft.fillRect(240, 125, 230, 119, TFT_BLACK);
  
//  tft.fillRect(240, 3, 230, 119, TFT_WHITE); 
//  tft.fillRect(240, 3, 230, 119, TFT_BLACK); 
  
//  tft.fillRect(5, 125, 230, 119, TFT_WHITE);
//  tft.fillRect(5, 125, 230, 119, TFT_BLACK);
//}
void setup()
{
  Serial.begin(9600);
  tft.init();
  tft.setRotation(1);

  pinMode(sensor1, INPUT_PULLUP);
  pinMode(sensor2, INPUT_PULLUP);
  pinMode(sensor3, INPUT_PULLUP);
  pinMode(sensor4, INPUT_PULLUP);
  pinMode(sensor5, INPUT_PULLUP);

  tft.fillRect(5, 3, 230, 119, TFT_BLACK);
  tft.fillRect(240, 125, 230, 119, TFT_BLACK);
  tft.fillRect(240, 3, 230, 119, TFT_BLACK); 
  tft.fillRect(5, 125, 230, 119, TFT_BLACK);


} //END of setup()

//**********************************************************************
void loop()
{
  //save the current time
  currentMillis = millis();

  //*************************************
  //Heartbeat LED
  //Toggle LED on and off, helps show if there is blocking code
  if (currentMillis - pin13Millis >= ledOnTime)
  {
    pin13Millis = millis();             //re-initialize Timer
    digitalWrite(13, !digitalRead(13)); //toggle LED condition
  }

  //*************************************
  //is it time to check the switches?
  if (currentMillis - SwitchMillis >= debounceMillis)
  {
    //code here runs every debounceMillis ms
    SwitchMillis = millis(); //re-initilize Timer
    
    //go check the switches
    checkSwitches();
  }

} //END of loop()


//**********************************************************************
//                  c h e c k S w i t c h e s ( )
//
void checkSwitches()
{
  //reusable for all the switches
  boolean thisState;

  //check if this switch has changed state
  thisState = digitalRead(sensor1);

  if (thisState != lastSensor1State)
  {
    //update the switch state
    lastSensor1State = thisState;

    //this switch position has changed so do some stuff
    //"LOW condition code"
    //has switch gone from HIGH to LOW?
    if (thisState == LOW)
    {
      //Do some LOW switch stuff here
      tft.fillRect(5, 3, 230, 119, TFT_BLACK);
  
    }
    else
    {
      //Do some HIGH switch stuff here
      tft.fillRect(5, 3, 230, 119, TFT_WHITE);
    }

  } //END of sensor1 code

  //**************************************
  //check if this switch has changed state
  thisState = digitalRead(sensor2);

  if (thisState != lastSensor2State)
  {
    //update the switch state
    lastSensor2State = thisState;

    //this switch position has changed so do some stuff
    //"LOW condition code"
    //has switch gone from HIGH to LOW?
    if (thisState == LOW)
    {
      //Do some LOW switch stuff here
      tft.fillRect(240, 125, 230, 119, TFT_BLACK);
    }
    else
    {
      //Do some HIGH switch stuff here
      tft.fillRect(240, 125, 230, 119, TFT_WHITE);
    }

  } //END of sensor2 code

  //**************************************
  //check if this switch has changed state
  thisState = digitalRead(sensor3);

  if (thisState != lastSensor3State)
  {
    //update the switch state
    lastSensor3State = thisState;

    //this switch position has changed so do some stuff
    //"LOW condition code"
    //has switch gone from HIGH to LOW?
    if (thisState == LOW)
    {
      //Do some LOW switch stuff here
      tft.fillRect(240, 3, 230, 119, TFT_BLACK); 
    }
    else
    {
      //Do some HIGH switch stuff here
      tft.fillRect(240, 3, 230, 119, TFT_WHITE); 
    }

  } //END of sensor3 code
  
} //END of checkSwitches()

//**********************************************************************