Rust, stdweb, add_event_listener, disable right click

  1. To disable right click, as in Disable mouse right-click it appears we need to "return false" in the event handler.

  2. I'm not doing this globally, just for a small canvas/WebGL window.

  3. However, stdweb's add_event_listener wants functions of type "event -> ()"

  4. Is there anyway to make this work within existing stdweb, or does this involve lots of js! macros ?

Unfortunately, calling evt.prevent_default() is not enough.
EDIT:

More specifically, I've already done evt.prevent_default() on the MouseDownEvent, MouseUpEvent, and MouseMoveEvent.

This by itself is not sufficient.

EDIT2:

I'm using Chrome on Linux.

Appears simplest way to solve is this

<body oncontextmenu="return false;">
...
</body>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.