Anna Posted January 12, 2017 Share Posted January 12, 2017 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!!!!!!! Quote Link to comment Share on other sites More sharing options...
obiot Posted January 12, 2017 Share Posted January 12, 2017 would help if you could be a bit more descriptive.... which version of melonJS, which browser, which platform ? also a code snippet would be great Quote Link to comment Share on other sites More sharing options...
obiot Posted January 12, 2017 Share Posted January 12, 2017 also if possible try to use the title of the post to give a short description of the message, to avoid having all messages titled "melonJS" thanks ! Quote Link to comment Share on other sites More sharing options...
Anna Posted January 12, 2017 Author Share Posted January 12, 2017 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 ); }); Quote Link to comment Share on other sites More sharing options...
obiot Posted January 12, 2017 Share Posted January 12, 2017 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 Quote Link to comment Share on other sites More sharing options...
obiot Posted January 12, 2017 Share Posted January 12, 2017 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 Anna 1 Quote Link to comment Share on other sites More sharing options...
Anna Posted January 12, 2017 Author Share Posted January 12, 2017 Should i just add the pointer.js file you have updated??? I cdnt find the latest melon.js file in the github . Quote Link to comment Share on other sites More sharing options...
obiot Posted January 12, 2017 Share Posted January 12, 2017 wii build are here : http://melonjs-builds.s3.amazonaws.com/index.html?prefix=artifacts/ and the last one here : http://melonjs-builds.s3.amazonaws.com/index.html?prefix=artifacts/master/1929/build/ Anna 1 Quote Link to comment Share on other sites More sharing options...
Anna Posted January 12, 2017 Author Share Posted January 12, 2017 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. Quote Link to comment Share on other sites More sharing options...
obiot Posted January 12, 2017 Share Posted January 12, 2017 yes, in the event object you can check the `deltaY` property Quote Link to comment Share on other sites More sharing options...
Anna Posted January 12, 2017 Author Share Posted January 12, 2017 got it Do u have any example for panning as well?? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.