Flaxis / slick-ui

Lightweight Phaser UI plugin
http://slick-ui.com/
190 stars 26 forks source link

multiple sliders on a page do not get move callback #12

Closed BarbaraWalters closed 7 years ago

BarbaraWalters commented 7 years ago

I think there is a flaw in the move callback if there are multiple sliders in a panel. I changed all references in Element/Slider.js from sprite_handle to this.sprite_handle and it seems to have fixed the problem.

Also, I'm curious about why there are different color textures for the handle, when sprite.tint seems to work just fine. I just left all the sprite_handles as grey and then just tinted them whatever color I wanted.

Flaxis commented 7 years ago

Whoops, I see now I forgot to define sprite_handle as a local variable using var... So while using this.sprite_handle probably works because it's an object property, I think having a local variable would be better, because objects outside of the slider won't be able to access it (which they shouldn't) Thanks for reporting this issue. I'll make sure it's fixed right away!

Also, as for why the handle has 2 different sprites while changing the sprite tint probably works: I think that's just a matter of preference. The Kenney asset pack included the fancy variations, so I thought I'd be safe and let pixels do the job instead of visual processing :) Of course you can always override the renderer to do things the way you like.

Flaxis commented 7 years ago

It's fixed in 0.4.2 :)