Skip to content
ExamplesOpen editor ↗

menwana

→ touches

An array of every point being touched on the screen right now.

menwana

On a computer with a mouse, menwana is an empty array. On a phone or tablet, every point being touched is added to it, and each one carries:

  • .x and .y — where it is on the canvas
  • .winX and .winY — where it is on the page
  • .id — a number telling this finger apart from the others

You walk it like any other array:

gopheta (metlha monwana mo menwana) { thalaSediko(monwana.x, monwana.y, 40); }

Only reach for it when you need more than one touch. If your sketch wants a single finger, you do not need menwana at all — pebaETobeditswe and pebaX/pebaY already work on a phone, because Bopa folds touch into the same pointer events. menwana is for reading two or more fingers at once.

The name is menwana, “fingers”. It is an ordinary word a child already knows, and it is written in Setswana in phrases like “konya menwana e mebedi” (tap two fingers). The recorded cost: someone using a stylus is not using a finger — but the word still tells the truth about how the sketch will actually be used.

A circle on every finger
tiro setaLoeto() {
  thalaKanefase(400, 300);
  tlhalosa('Kanefase e e ntsho e e bontshang sediko se se phatsimang mo lefelong lengwe le lengwe le le kgomilweng.');
}

tiro tshwantsha() {
  bokamorago(24, 26, 34);
  tlogelaMothalo();
  tlatsaMmala(240, 190, 90, 200);

  gopheta (metlha monwana mo menwana) {
    thalaSediko(monwana.x, monwana.y, 70);
  }

  fa (balaLenaane(menwana) === 0) {
    tlatsaMmala(150);
    bogoloJwaMokwalo(16);
    rulaganyaMokwalo(BOGARE);
    thalaMokwalo('Kgoma sekerini ka menwana e mentsi', 200, 155);
  }
}

pebaETobeditswe, pebaEGogilwe, pebaX, pebaY