Sign in to follow this  
JohnK

GUI ScrollViewer

Recommended Posts

It sounds cool. But the scroll of the mouse does not work for moving the cursor with the wheel. 

I think this has not been added, do we have the opportunity to add it with observables?

Share this post


Link to post
Share on other sites

Something like this:

canvas.addEventListener("wheel", (evt) => { 
	if(this.slider[name].isVisible == true) {
		if(evt.deltaY < 0 && this.slider[name].value >= 0) {
			this.slider[name].value -= 50;
		} else if(evt.deltaY > 0 && this.slider[name].value < this.slider[name].maximum) {
			this.slider[name].value += 50;
		}  
	}
}, false);

 

Share this post


Link to post
Share on other sites

This is a dirty way of doing it https://www.babylonjs-playground.com/#3EF49E#1 will have to do more studying to add "wheel" code into the source code as observables and events are one of my many weak points.

Note that for both sliders the range is 0 to 100 from which the amount to scroll the viewer window is then calculated. You can guess the name of the horizontal bar 🙂😎🙂

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  

  • Recently Browsing   0 members

    No registered users viewing this page.