Anna

mousewheel event issue

Recommended Posts

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.