sendToBack method

void sendToBack([
  1. int? obj
])

Implementation

void sendToBack([int? obj]){
  if(obj != null){
    levelInfo[selectedLevel].objects[obj].layer--;
  }
  else if(objectTappedOn.isNotEmpty){
    for(int i = 0; i < objectTappedOn.length; i++){
      levelInfo[selectedLevel].objects[objectTappedOn[i].objectLocation].layer--;
    }
    updateMinMap = true;
  }
  levelInfo[selectedLevel].objects.sort((Object a, Object b){
    final int az = a.layer;
    final int bz = b.layer;
    //return (az-bz).round();
    if (bz > az) return -1;
    if (bz < az) return 1;
    return 0;
  });
  update();
}