SetOnScroll - scrolling up or down?

Hey,
i've a radar, and a rangeslider, so you basically can zoom in and zoom out the map.
everything works pretty well, and now i simply want to add a scrollevent. So lets say my rangeslider goes from 0 - 1000.
When i start the Program the default value of the slider is 500. when i know scroll up, i want to zoom in, so i basically set the current value of the rangeslider - 100. The other way around it goes +100. Works pretty good so for. But the way i solved it is pretty bad i guess, lol. i wondered if there is a more explicit event ike scene.setOnScrollUp or scene.setOnScrollDown. So when i tried to solve it, im checked the deltaY value of my event and saw, if you scroll down it gets the value -40. if you scroll up it's 40. so right now i did it like this:
        Animation.getInstance().radarScene.setOnScroll(new EventHandler<ScrollEvent>()
            @Override
            public void handle(ScrollEvent me)
                if(me.getDeltaY() == 40)
                    Controller.getInstance().getRangeSlider().setValue(Controller.getInstance().getRangeSlider().getValue() - 100);
                if(me.getDeltaY() == -40)
                   Controller.getInstance().getRangeSlider().setValue(Controller.getInstance().getRangeSlider().getValue() + 100);
               yeah, it works but i find it very unsexy. any one got a better way? Didn't find something like setOnScrollDown, like i said, but maybe i just don't see it. Thanks in advance.
Edited by: dscarminiabielefeld on 20-Nov-2012 03:11

That looks somewhat non-robust... are you sure the scroll event always gives +/-40 for the delta? What if the user has a trackpad to scroll with? One thing you can be certain of is that the sign of the delta represents the direction of the scroll. So why not do something like
private static final double SCROLL_ZOOM_SCALE = 2.5 ;
public void handle(ScrollEvent me) {
  Slider rangeSlider = Controller.getInstance().getRangeSlider();
  double zoomDelta = me.getDeltaY() * SCROLL_ZOOM_SCALE ;
  double oldValue = rangeSlider.getValue();
  double targetValue = oldValue - zoomDelta ;
  double newValue = Math.max(rangeSlider.getMinValue(), Math.min(targetValue, rangeSlider.getMaxValue()));
  rangeSlider.setValue(newValue);
}

Similar Messages

  • Touchpad no longer scrolls up and down on Satellite A

    So my HD crashed and i have to completely install Windows and all the Toshiba stuff with it a new.
    All is well - except for one thing, my touchpad no longer scrolls up and down using the side of it in IE or Chrome, but it still works in SeaMonkey.
    My Computer technician tells me it's an issue with getting some new driver for the touchpad, and i think i had to do that already about a year ago when i still had my original HD running.
    So i went to the Toshiba.ch website and tried to find something.
    I found all their "verfication" stuff and got inside the system and it instantly returned about 45 drivers by the looks of my "un"-driving eyeys they all could have been for whatever, so i searched especially for "touch pad" and yes, there was one for my Synapsis touchpad and XP as well, so i downloaded it - or i should say i opened it in Win Zip and checked first on the "readme file - wow, that was some Portugese in there, and that's when i kind of begun to feel lost.
    I check in at Toshiba.ch, get a ton of drivers in my face i have no clue whether i am supposed to download them all or what, and when i finally pick what i think i need the whole thing seems to be in Portugese, what the crickey in the afternoon is this???
    Anyway, before i download and try to install stuff i have no clue about i was hoping someone would actually give me a better hint on what i have to do exactly to get my touchpad to scroll up and down again also in Chrome, IE and where ever else.
    I use Service Pack 3 on Win XP Pro and was told that's maybe why the old original driver for this laptop needs to be updated, but which file, where to get it, and how to properly install it please anyone???

    Thanks for that, you confirm what i actually found out myself in the meantime.
    The way i got this issue solved was that i first tried to download and install the Synaptics driver from the Toshiba site - that simply failed miserably, glad with no negative side effects at least.
    Nesxt i used what unfortunately is way easier that sites like the Toshiba overload, i used Google to simply find the Synaptics website and instantly got the link to their driver download - eh voila, that actually gave me a .exe file, not an endless array of zipped files like the stuff on the Toshiba site in endless language versions!!!
    This worked, tested everything out alread since a while.
    - Which now leaves me with the question about the second driver you mentioned,
    Alps Electric
    what is that one needed for??
    I have not seen this name on my lappy before, so totally unsure about whether it still needs this dispite things are working everywhere, i did not even have to go into the Device Settings of the Mouse / touchpad to change or rearrange anything in there after the direct download from Synapsis, but well informed is always best, so if you could let me know about that
    Alps thing would appreciate...

  • I don't know if this is the right section but I experience the following issue with Adobe Acrobat Pro XI installed on Windows 8.1. When I start Acrobat the related window opens normally but, after some scroll up and down along the document, it blocks, Acr

    I don't know if this is the right section but I experience the following issue with Adobe Acrobat Pro XI installed on Windows 8.1. When I start Acrobat the related window opens normally but, after some scroll up and down along the document, it blocks, Acrobat doesn't respond to any command I can give and, in place of the pointer arrow, a vertical bar, as the one of the text editor appears. The only way I can stop Acrobat is by means of the task manager. I tried to de-install and the re- install Acrobat but the behaviour is always the same. What can I do??

    Have you opened Acrobat and gone to Help>Updates to get an updated install?

  • How can I get a search bar added to my email archives screen to make it easier to search for the right archives folder, Samsung has one so I was surprised to see that I have to scroll up and down to find the right folder?

    How can I get a search bar added to my email archives screen to make it easier to search for the right archives folder, Samsung has one so I was surprised to see that I have to scroll up and down to find the right folder?

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    * https://support.mozilla.com/kb/Safe+Mode
    * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    You can modify the pref <b>keyword.URL</b> on the <b>about:config</b> page to use Google's "I'm Feeling Lucky" or Google's "Browse By Name".
    * Google "I'm Feeling Lucky": http://www.google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=
    * Google "Browse by Name": http://www.google.com/search?ie=UTF-8&sourceid=navclient&gfns=1&q=
    * http://kb.mozillazine.org/keyword.URL
    * http://kb.mozillazine.org/Location_Bar_search

  • Calendar Month View won't scroll up and down

    This is a very minor, but strange issue with Calendar.
    I can scroll up and down in Calendar month view on my MacBook Air, but on my Mac Pro, I can only switch months by clicking the" >" button or "Command+Left Arrow".
    Anyone know why?
    Thanks.

    I'm using Yosemite on both.
    I did a little research and saw some comments that mentioned that vertical scrolling works with the trackpad, but not with mouse scroll wheels... so there's that. Doesn't make sense, but it's possible.

  • My monitor screen scrolls up and down on its own by it's self? How do I stop it?

    How do I fix a monitor screen scrolling up and down on its own?

    Sabrasam,
    Thank you for your quick reply.
    I want you to try a factory reset on the monitor if you haven’t attempted one already.
    1.       Press the Menu down in the bottom right corner of the monitor.
    2.       Once the on screen display appears toggle down to factory reset.
    3.       Select on that option
    You might see your monitor go dark a couple times but that is normal. Test it out after the reset.
    If I have been helpful or if you'd like to say thank you for me trying to help, click the white star under my name to give me Kudos. I really appreciate it.
    Please respond at your earliest convenience.
    Thanks
    Clicking the White Kudos star on the left is a way to say Thanks!
    Clicking the 'Accept as Solution' button is a way to let others know which steps helped solve the problem!

  • Ever since installing firefox 4, i can no longer use my finger type joystick on my keyboard for automatic scrolling up and down a page. Any suggestions?

    I have three buttons below my space bar which function, basically like the left-click, right- click buttons on a mouse but the middle button, when held down, should allow me to move the joystick up or down to continuously scroll up or down a page. Now, it doesn't work. This is a function I really like. If I cannot resolve this, how do I remove Firefox 4 and go back to my previous edition of Firefox?

    Thanks for the suggestion - i checked and scrolling is activated. Which fits with the fact that it works in every other application apart from firefox. Any otehr ideas?
    thanks os much!

  • Why can't i scroll up and down in pages

    I have created a newsletter in pages.  All of a sudden I cannot scroll up or down to move between page 1 and 2 of my document.  The only way I can get to page 2 is if I zoom out to about 50%.  Then I cannot read the font.  So frustrating.  How do I fix this?

    Check your settings (gestures) in System Preferences > Trackpad
    Sometimes just a restart can help.

  • Can't scroll up and down in Safari

    Ever since updating to Safari 6.1 (running on Lion) I've been having problems using the find function (command-f). After I use the find function, Safari either won't let me scroll up and down on the page, or it will let me scroll but the text becomes inverted, garbled and in other words impossible to read. The only solution is to quit Safari and re-open. Has anyone else had this issue and do you know of a fix??

    The same thing is happening to me, but not when I use the command + F shortcut. It just happens randomly. Pages won't scroll, and if they do, parts of the page turn upside down and are all garbled. I've attached some screen shots. I was worried this was a virus or malaware, but it's good to hear that's it's Safari's problem. Have you two figured out any solutions yet?

  • Can't Scroll Inside Drop Down Menus

    I just got a new HP laptop (Windows 7 Home Premium 64 bit), installed Firefox 11 (now updated to 12), and discovered that when using the track pad (Synaptics Touch Pad v8.1. Driver provided by Synaptics, version 15.3.29.0 dated 10/13/2011), I can not scroll inside drop down menus.
    To replicate, go to this link: http://sacramento.craigslist.org/sss/
    Click the drop down for the category to search. Use the track pad to scroll the list. Mine closes the list and returns focus to the browser instead of scrolling the list. It then scrolls the browser window instead. This works fine in IE. Things I have tried:
    Safe mode
    Unchecking smooth scrolling
    Unchecking autoscrolling
    Unchecking hardware acceleration
    And just about any of the various combinations of the above things. I also tried restarting Firefox each time I made a change. Nothing seems to solve this issue.
    Oddly enough, if there is a text window inside the page (like the on I am writing this in), I can scroll that just fine. Once I move my mouse out of the box, it scrolls the main page just fine. I don't think it's a matter of the focus following the mouse, it has something to do with scrolling drop down boxes specifically it seems.
    Also, I should note that all the pages I have problems with work fine in IE the way they SHOULD work in Firefox.

    It's Synaptics Touch Pad v8.1. It is using a driver provided by Synaptics, version 15.3.29.0 dated 10/13/2011, and is supposedly the most current version. I have tried getting newer off the HP website, letting Windows search for the most current version, and looking at the Synaptics site, but I still end up with the same version.
    I have double checked the scrolling regions to make sure I am within them as well as all the other settings regarding the touch pad. In fact, I had to enable the scrolling regions because they were disabled by default and instead used two finger scrolling. For what it's worth, two finger scrolling gives me the same result - it does not scroll the drop down menu.
    As I said, it works just fine in IE and all other programs, so I'm not sure I understand how the drivers for the touchpad could be the issue. It seems to me it's more likely that Firefox is not interpreting the "signal" from the touchpad correctly, yet IE does. Then again, I've been wrong before...

  • Starting about a week ago, my cursor changes from an arrow to a 4-pointed star shape and moves erradically and won't scroll up or down.

    Starting about a week ago, my cursor changes from a plain arrow to a 4-pointed star. It also moves by itself and I cannot control it. It makes it VERY hard to scroll up or down, and it stops scrolling every so often.

    Hi Krist, <br />Sorry you are having problems.
    It is a while mow since I used XP, I do not remember a 4 pointed star option for the cursor.
    *Is this only on Firefox?
    If other programs are affected it is something to do with Windows XP or software installed on that.
    If it is only on Firefox then as an initial step try in Firefox's safe mode with all plugins disabled. You may start safemode by using
    * Help -> Restart with addons disabled
    ** see also [[Troubleshoot Firefox issues using Safe Mode]]
    * and [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]

  • Can't scroll up or down in flash player

    I'm trying to run webkinz.com for my kids on their new netbook.  webkinz runs in ad
    obe flash player.  flashplayer opens and you can navigate whatever fits on the screen however you can't
    scroll up or down to view all other information.  there is no toolbar and no scroll bar.
    the PC has 1GB RAM and 1.6Ghz so it meets system requirements.

    This is most likely a display setting issue. My kid has an Asus netbook and streams YouTube videos all day and night on it (it seems like she does anyway).
    With the display set at the default (something like 768 X 420) she had nothing but problems with anything she did online. Once we "max'd it out" to 1024 X 680 (or thereabouts, she won't let me have it right now so I can see for myself) she was able  to do more, like scroll around and find other videos she wanted to watch.
    Unfortunately at the lower resolution, the video takes the whole screen and while in the video window, scrolling is turned off.

  • My i pod won't scroll up or down.

    My Ipod touch won't scroll up or down and the display is a negative view. What can I do?

    You seem to have an Accessibility feature or two turn on. Turn them off.
    Try tripling clicking the Home button and go to Settings>General>Accessibility and turn them all off. Use three fingers for scrolling if necessary.
    The color problem is likely Invent Colors (iOS6) or While on Black for other iOS.
    For more info see:
    iPhone: Configuring accessibility features (including VoiceOver and Zoom)

  • HT204407 why is the display on my icloud page so freaking big. It's magnified about a hundred times and why can't I scroll up and down. The thing is frozen. It's very irritating.

    Why is the display on my icloud page so freaking large. It's magnified about a hundred times. It's like I can see only one letter at a time. I'm using a PC, but I recently bought an Iphone, so I was going with their technology. But this Icloud display thing is just a pain in the ***. I can't even use the scroll up and down feature. It's just a frozen solid block.

    My display for iCloud on my desktop is the same. Magnified and can't find a way to fix it. It is the same for all the accounts in my family. It is magnified on my sign in page.

  • My ipod will not scroll up or down or left or right how do i set this up or how do i fix it

    my ipod will not scroll up or down or left or right how do i set this up or fix it

    I think this is a serious design flaw on Apple's part, and I'm surprised it's lingered as long as it has - the monitors are just not adjustable.
    About the only way you can raise the monitor is to stand it on something. If you're in an office, reams of copier paper seem to work well, as tacky as that may be.

Maybe you are looking for

  • 5800 XM "Expired Certificate" error message

    For people who own a Nokia 5800 XM, the error message of "Expired Certificate" when downloading applications onto the device will be mean you cannot load on new apps, which can be frustrating. Firstly you should try to update the firmware on your pho

  • Time series functions are not working in OBIEE for ESSBASE data source

    Hi All, I am facing a problem in OBIEE as I am getting error messages for measure columns with Time series functions(Ago,ToDate and PeriodRolling) in both RPD and Answers. Error is "Target database does not support Ago operation". But I am aware of O

  • HR-ABAP delimitaion of the relation.

    Hi Friends, I want to know which function module is used to delimit the relation between Org & Position. That function module should be wokred like pp02 delimitation activity. Here i have the requirement to create the realtion , delimit the relation

  • Data upload from third party system to GRT table.

    Hello,         Can you please let  me know how we can upload payroll data from a legacy system (to be more clear, how to upload data that we receive from a third party system) into GRT table.  Note:The file should be tab delimited text file. As of no

  • Elements Organizer and Editor Image Differences?

    I've noticed that the images displayed by Photoshop Elements Organizer are noticeable different from the display of the same image file by the Elements Editor.  Why does this happen and is there a way to correct one or the other displays.  Generally,