Suggestion: Mousewheel - remove preventDefault()

  • In my game, I let the user zoom in and out on the map by using the mousewheel, which is pretty standard nowadays. I also have some HTML-based list boxes on my HUD using the List object. Normally, the user can scroll in these list boxes using the mousewheel when mouse hovers over it, which is a great usability feature. However, when I enable mousewheel zooming on the map, the scrolling in the list box no longer works.

    The problem is that the official Mouse plugin on line 174 runs preventDefault() when it captures a mousewheel event, which overrides any default events, such as scrolling of list boxes.

    If I manually edit the plugin and remove this line, it works just as expected, so my feature request is that you either disable preventDefault(), or better yet make it into a setting in the Mouse object. Although I'm not entirely sure of when it could be useful (IE compatibility?), making it into an option would reduce the risk of compatibility issues, if you leave it enabled by default.

    Thanks for listening!

  • Does it work to disable it while the mouse is hovering over the list object?

  • Paradox

    No, unfortunately not, it still seems to run preventDefault, even if I condition it on mouse not hovering the list object. That would be another way to solve it I guess, to only make it preventDefault when the event is actually run.

  • If we simply remove it, some games will start scrolling the page around when you use the mouse wheel, which will make them unplayable. Perhaps post a bug report with a minimal .capx repro and I'll see if I can tweak it until it works.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ashley

    Ah, of course. I sometimes forget that Construct 2 is also used to make embedded web games, as I'm working on a full stand-alone game.

    Here's a bug report with a .capx:

    scirra.com/forum/topic76648_post458873.html

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)