[UnfoldingMaps] Stop or limit Map interaction to an area of the screen ???

edited April 2014 in Library Questions

I'm working on this project with a fullscreen map but on top of that I have a series of buttons and sliders (controlP5) that are used to filter out a series of variables and render different batch of pins.

The problem is that when I click a toggle button or drag a slider I'm also interacting with the map behind so I was wondering if there's a way in UnfoldingMap library to limit the area of interaction or, even better, toggle the interaction so I can disable it when the mouse is over a controlP5 element and viceversa (using cp5.isMouseOver() ).

Thank you!!

Answers

  • Anyone can help on this? I could not find anything on unfolding maps and I'm quite a noob in understanding the JavaDoc Reference, can't always wrap my head around it.

    Any help is appreciated :)

  • edited May 2014 Answer ✓

    Sorry, missed this question. Hope this is still helpful.

    If you have some UI in combination with a map, and still want to have an interactive map, you need to either

    a) simply separate them. e.g. make the map smaller and the UI below. See the following pseudo-code:

        map = new UnfoldingMap(this, 0, 0, width, height-200);
        button = new Button(this, 50, height - 150, ....)
    

    b) for more complex stuff, or if your UI is atop the map you need to delete the DefaultEventDispatcher, and forward the interactions to the map yourself. See https://github.com/tillnagel/unfolding/commit/b5729dbe08cfcd719b3201fac8d2dd9ebea03cf5 for an example

  • Thaks tnagel, I'm gonna look into your example on github right now! Since I have lots of buttons I don't want to sacrifice too much space for the UI only. I thought overlapping the two was the best solution.

  • edited May 2014

    can't you just draw the word "Menu" in the corner and when you click on it, you get into the state menu and the map is off and you draw your series of buttons and sliders?

  • I guess I could do that for sure but there's a plus in having the possibility to see what is changing on the map in realtime while you interact with the interface. Being a visualization tool I think it's important to be able to always have a visual reference of "how it looked like before changing that variable on the menu".

  • understood.

    you can't click on a state to switch it on/off?

  • I'm not sure I understand your question, you mean creating a button that sets ON or OFF the rest of the interface?

    (here's a pic of a part of the interface, just to be clear :D ) Screen Shot 2014-05-08 at 14.54.02

  • edited May 2014

    sorry double post...sometime pForum freezes on me when I use imgs :-/

  • I'm on the wrong track

    just stick with tnagel

Sign In or Register to comment.