-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed scrolling #10
Fixed scrolling #10
Conversation
Uses inventoryWidth |
accidentally close |
@deathcap could you merge this so we can continue updating the package.json in voxelmetaverse |
Only scrolls when chat bar is not open |
@@ -47,6 +47,8 @@ class InventoryHotbarClient extends InventoryHotbarCommon | |||
@keys = game.plugins.get('voxel-keys') ? throw new Error('voxel-inventory-hotbar requires voxel-keys plugin') | |||
@wheelEnable = opts.wheelEnable ? false # enable scroll wheel to change slots? | |||
@wheelScale = opts.wheelScale ? 1.0 # mouse wheel scrolling sensitivity | |||
@console = game.plugins.get('voxel-console') | |||
@scrollLock = true; # allows scrolling on true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary semicolon; not required and should not normally be used in CoffeeScript
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad.
Removed ; |
@@ -92,16 +94,28 @@ class InventoryHotbarClient extends InventoryHotbarCommon | |||
enable: () -> | |||
@inventoryWindow.container.style.visibility = '' | |||
@onSlots = {} | |||
@console.on 'open', => | |||
@scrollLock = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think there's a better way to do this. Try replacing your @scrollLock
and voxel-console events with @game.shell.pointerLock
- it seems to already do what you want here, and is more general than just having the console open. For example, it also takes into account when another modal dialog is open (e.g., inventory) - it is only true when the browser has acquired pointer lock (to interact with the game with mouse look).
Tested this change (with a few modifications: removing voxel-console dependency, setting wheelEnable) but with the mouse I'm using (Apple Magic Mouse), scrolling the mouse still uncontrollably flips through the slots. This may be an inherent problem with this mouse, I know Minecraft has the same problem with it: https://bugs.mojang.com/browse/MC-42367 - so all I've been able to do is disable scrolling, but it does work with a Microsoft IntelliSense mouse (with a discrete scroll wheel instead of the touch-sensitive interface). |
It worked for me with a normal mouse as well. I'll see if I can find some On Tue, Apr 14, 2015 at 8:59 PM, deathcap [email protected] wrote:
Thanks, |
Fixed #9