melonJS
    Preparing search index...

    Function setPreventDefault

    • set whether melonJS should prevent the default browser action on registered events, such as the page scrolling with the arrow keys or Space. This is the global default; input.bindKey's preventDefault argument overrides it per binding.

      Pointer listeners read it when they are registered, so call this before creating the Application for it to apply to the engine's own listeners. input.bindKey reads it when a key is bound. The keys the UI focus takes while a widget has it, and a UITextButton#bindKey key with no binding of its own, read it on each press.

      Leave it on for a game shown in a frame on a page that scrolls, such as a game portal: with it off, those keys scroll the page as well.

      Parameters

      • value: boolean

        true to prevent default browser actions (the default)

      Returns void

      // let the browser handle scrolling, zooming and context menus itself
      me.input.setPreventDefault(false);