Sign in to follow this  
Followers 0
Aida

mousewheel event issue

11 posts in this topic

I wanted to use mouse scroll event . I tried " mousewheel " but its giving me an error " TypeError: eventTypes is undefined". Can smeone please help me here!!!!!!!

Share this post


Link to post
Share on other sites

okay. I will be more descriptive with the title next time.!!!

I am using melonjs 4.1 . Tried in both firefox and chrome, I am using Windows 8.1

 

this is my code 

      me.input.registerPointerEvent("mousewheel", me.game.viewport, function (event) {
           me.event.publish("mousewheel", [ event ]);
       },false); 
        this.mousewheel = me.event.subscribe("mousewheel", function (event) {

   
            var viewport = me.game.viewport;
            viewport.currentTransform.translate(
            viewport.width * viewport.anchorPoint.x,
            viewport.height * viewport.anchorPoint.y
          );
           
            viewport.currentTransform.scale(0.995);
            viewport.currentTransform.translate(
            -viewport.width * viewport.anchorPoint.x,
            -viewport.height * viewport.anchorPoint.y
         );
           

          
        });

 

 

 

Share this post


Link to post
Share on other sites

oops, looks like you found an issue with the 4.1.0. We did refactor some code linked to pointer event management, and it seems that we kind of broke the mouse wheel event.

I just fixed it on the master branch, if you pull the latest version it should work then (i tested using your code snippet).

Sorry about that, and thank you 10000x for reporting it :)

Share this post


Link to post
Share on other sites

to be noted that 4.1.0 is not released yet, master is our current development branch, so issues are to be expected :) just saying in case you stumble on something else :)

Aida likes this

Share this post


Link to post
Share on other sites

Should i just add the pointer.js file you have updated??? I cdnt find the latest melon.js file in the github .

Share this post


Link to post
Share on other sites

Thankyou so much.. Mousewheel event is working for me now :):) . but is there a way to differentiate mouse scroll up and mouse scroll down. for example i am trying to zoom in and zoom out using mouse scroll.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.