Skip to content
ExamplesOpen editor ↗

leotwanaLeDikologile

→ mouseWheel()

Runs when the mouse wheel is turned.

tiro leotwanaLeDikologile(tiragalo) { ... }

Declare leotwanaLeDikologile as a function with tiro. Bopa hands it an event — an object that tells you how far the wheel turned:

tiro leotwanaLeDikologile(tiragalo) { kwala(tiragalo.delta); }

tiragalo.delta is a number. Measured: delta is the browser event’s own deltaY, so it is positive when you scroll down and negative when you scroll up. What is written here was measured in the running Bopa editor, which reported delta = 300 on a scroll down.

On Apple machines with natural scrolling the signs are reversed.

Stopping the page from scrolling. Adding busa maaka; at the end of the function stops the page underneath from scrolling — which is what you want when the wheel is zooming a picture. In the Bopa editor the preview pane has nothing to scroll, so it makes no difference there; on the reference site it does.

A phone has no wheel. This is a mouse-only event.

NameTypeDescription
tiragalo (optional)sengweThe browser event. tiragalo.delta tells you how far the wheel turned. Optional.
Zooming a circle with the wheel
diri bogolo = 120;

tiro setaLoeto() {
  thalaKanefase(400, 260);
  tlhalosa('Sediko se se mo bogareng se bogolo jwa sona bo fetolwang ka leotwana la peba.');
}

tiro tshwantsha() {
  bokamorago(234);
  tlogelaMothalo();
  tlatsaMmala(210, 120, 90);
  thalaSediko(200, 130, bogolo);

  tlatsaMmala(50);
  bogoloJwaMokwalo(15);
  rulaganyaMokwalo(BOGARE);
  thalaMokwalo(atametsa(bogolo), 200, 245);
}

tiro leotwanaLeDikologile(tiragalo) {
  bogolo = thibela(bogolo - tiragalo.delta * 0.2, 20, 240);
  busa maaka;
}

pebaESutile, pebaETobeditswe