How to make two joysticks on a phone

when I make two joysticks mouse X and Y need to be divided into 4 parts. If anyone knows how please tell me.

code:
Player player = new Player(100, 100);
InterFace face;

int mapWidth = 2000;
int mapHeight = 2000;
int section_field = 50;
int cx,cy;

void setup (){
size(displayWidth, displayHeight);
face = new InterFace();
}

void draw(){
background (255);

field();

player.make();

face.make();
face.press();
face.mousePressed();

player.run(face.joystick1_x2, face.joystick1_y2);

textSize(20);
fill(0,255,0);
text(mouseX, 100,100);
text(mouseY, 100,150);
}

void field(){
stroke(150);
strokeWeight(1);
for(int x = 0; x < mapWidth + section_field; x += section_field) line(x + cx, 0 + cy, x + cx, mapHeight + cy);
for(int y = 0; y < mapHeight + section_field; y += section_field) line(0 + cx, y + cy, mapWidth + cx, y + cy);
}

class Player{

int x,y,R = 70;
int speed = 10;

Player(int x, int y){
this.x = x;
this.y = y;

}

void make(){
fill(255,0,0);
strokeWeight(2);
stroke(75);
rect(x - cx + width/2,y - cy + height/2,R,R);
}

void run(int jx, int jy){
x -= (jx - face.joystick1_x1)/15;
y -= (jy - face.joystick1_y1)/15;

cx = x;
cy = y;

if(x > 960)x += (jx - face.joystick1_x1)/15;
if(x < -mapWidth + 960)x += (jx - face.joystick1_x1)/15;
if(y > 500)y += (jy - face.joystick1_y1)/15;
if(y < -mapHeight + 500)y += (jy - face.joystick1_y1)/15;

}
}

class InterFace {

int R1_1 = 200;
int R1_2 = 50;
int joystick1_x1 = 300;
int joystick1_y1 = 800;
int joystick1_x2 = joystick1_x1;
int joystick1_y2 = joystick1_y1;
boolean click1 = false;

int joystick2_x1 = width - 300;
int joystick2_y1 = 800;
int joystick2_x2 = joystick2_x1;
int joystick2_y2 = joystick2_y1;
boolean click2 = false;

InterFace() {
}

void make() {
fill(200, 150);
ellipse(joystick1_x1, joystick1_y1, R1_1, R1_1);

fill(100, 100);
ellipse(joystick1_x2, joystick1_y2, R1_2, R1_2);

fill(200, 150);
ellipse(joystick2_x1, joystick2_y1, R1_1, R1_1);

fill(100, 100);
ellipse(joystick2_x2, joystick2_y2, R1_2, R1_2);

}

void press() {
if (click1) {
if (mouseX > joystick1_x1 - R1_1/2 && mouseX < joystick1_x1 + R1_1/2) {
joystick1_x2 = mouseX;
}

  if (mouseY > joystick1_y1 - R1_1/2 && mouseY < joystick1_y1 + R1_1/2) {
    joystick1_y2 = mouseY;
  }
  
  if(mouseX < joystick1_x1 - R1_1/2) joystick1_x2 = joystick1_x1 - R1_1/2;
  if(mouseX > joystick1_x1 + R1_1/2) joystick1_x2 = joystick1_x1 + R1_1/2;
  if(mouseY < joystick1_y1 - R1_1/2) joystick1_y2 = joystick1_y1 - R1_1/2;
  if(mouseY > joystick1_y1 + R1_1/2) joystick1_y2 = joystick1_y1 + R1_1/2;
}

if (!mousePressed || mouseX > joystick1_x1 + R1_1 * 3 || mouseY < joystick1_y1 - R1_1 * 2.5) {
  joystick1_x2 = joystick1_x1;
  joystick1_y2 = joystick1_y1;
  click1 = false;
}

if (click2) {
  if (mouseX > joystick2_x1 - R1_1/2 && mouseX < joystick2_x1 + R1_1/2) {
    joystick2_x2 = mouseX;
  }

  if (mouseY > joystick2_y1 - R1_1/2 && mouseY < joystick2_y1 + R1_1/2) {
    joystick2_y2 = mouseY;
  }
  
  if(mouseX < joystick2_x1 - R1_1/2) joystick2_x2 = joystick2_x1 - R1_1/2;
  if(mouseX > joystick2_x1 + R1_1/2) joystick2_x2 = joystick2_x1 + R1_1/2;
  if(mouseY < joystick2_y1 - R1_1/2) joystick2_y2 = joystick2_y1 - R1_1/2;
  if(mouseY > joystick2_y1 + R1_1/2) joystick2_y2 = joystick2_y1 + R1_1/2;
}

if (!mousePressed || mouseX > joystick2_x1 + R1_1 * 3 || mouseY < joystick2_y1 - R1_1 * 2.5) {
  joystick2_x2 = joystick2_x1;
  joystick2_y2 = joystick2_y1;
  click2 = false;
}

}

void mousePressed() {
if (mouseX > joystick1_x1 - R1_1/2 && mouseX < joystick1_x1 + R1_1/2 && mouseY > joystick1_y1 - R1_1/2 && mouseY < joystick1_y1 + R1_1/2) {
click1 = true;
}

if (mouseX > joystick2_x1 - R1_1/2 && mouseX < joystick2_x1 + R1_1/2 && mouseY > joystick2_y1 - R1_1/2 && mouseY < joystick2_y1 + R1_1/2) {
  click2 = true;
}

}
}