Sie sind nicht angemeldet.

1

Mittwoch, 2. Februar 2011, 01:53

How to close a plugin (image) if NOT clicked...

Say I click on an image and it opens a floorplan - on the floorplan there are several transparent images that will loadscene if clicked... however, what if the user doesn't want to click on anything inf the floorplan and wants to go back to whatever they were doing before they clicked the floorplan... say they just click on the pano and try to move it again...

I'd like to close the floorplan and go back to whatever was happening before I ever clicked it in the first place.

Somewhat of a similar action to when you open the thumbnails - if you open the thumbnails and opt not to click on any, and just try moving the pano, the thumbnails collapse back to their stack...

Any ideas on how that sort of behavior is accomplished?

panomaster

Fortgeschrittener

Beiträge: 297

Wohnort: Kobyłka, Poland

Beruf: Virtual Tours - Spherical Panoramas - Krpano developer

  • Nachricht senden

2

Mittwoch, 2. Februar 2011, 10:02

You should use any close action (eg. set(plugin[floorplan].visible, false)) and call it after onOut event.

3

Mittwoch, 2. Februar 2011, 19:15

Thanks for the help! That solution kind of works... but if I just move my mouse off the floorplan it goes away (even with a delayedcall). I was hoping to find a way to open the floorplan, and have the floorplan close only if the user moves the pano... (i.e. opts not to click anything on the floorplan).

panomaster

Fortgeschrittener

Beiträge: 297

Wohnort: Kobyłka, Poland

Beruf: Virtual Tours - Spherical Panoramas - Krpano developer

  • Nachricht senden

4

Mittwoch, 2. Februar 2011, 21:02

The main problem is "when the floorplan should be closed" (in which situation). There can be several such situations - and you should support all of them eg.

1. If user opens floorplan, points any rooom and then move mouse cusor out of flooplan - if you want to hide floorplan in this situation you can do something like this:

Quellcode

1
<plugin name="flooplan" ... onout="set(plugin[floorplan].visible, false)" />


2. If user clisk panorama after opening floorplan you can hide it by setting global onclick event:



Quellcode

1
2
<events        ...        onclick="set(plugin[floorplan].visible, false)"       ...
        />



But maybe you should think of another situation in which floorplan should be close eg. making "close button" on floorplan.

5

Mittwoch, 2. Februar 2011, 23:02

2. If user clisk panorama after opening floorplan you can hide it by setting global onclick event:


a global onclick will close the map even if the user click on the map so that might not work perfect. if you want the map to close when the user moves the pano use the event "onviewchange"

panomaster

Fortgeschrittener

Beiträge: 297

Wohnort: Kobyłka, Poland

Beruf: Virtual Tours - Spherical Panoramas - Krpano developer

  • Nachricht senden

6

Donnerstag, 3. Februar 2011, 00:30

Zitat

"a global onclick will close the map even if the user click on the map"
Really? Make a test...

IMHO onviewchange event should be used only if it's necessary eg. in case of updating compass or rotating google map (peformace issue).

7

Donnerstag, 3. Februar 2011, 03:49

Really? Make a test...


i almost certain of it. but not 100% ill test tomorrow at work. the vtour dropket creates a global onclick event to close the thumbnails after they are opened. i had a map in my tour and they closed even if the map was clicked. i ended up changing that so i cant just go look but i am curious. ill add a static jped image to the default vtour.xml and will test.

i agree with you on the onviewchange. usually when i use that event i will set it null after it had detected what i needed it to. i would not want that action being run constantly when it would not be needed.

for this instance you could add set(events.onviewchange, closemap()); to the action that opens the map. and inside the action that closes the map make the last line set(events.onviewchange, null); then each time you open the map the pano will wait for the stage to move in order to close the map. when it closes it will set the event null so it is not wasting away when not needed. then when the map opens again it will start detecting pano movement until it does, then stop again. i am at a pc i cannot test with but i think it should work.

8

Donnerstag, 3. Februar 2011, 20:14

I tried:

<events onclick="closemap"/>

An action group that puts away the floorplan and "undoes" what was done with "openmap"

It works perfectly in Flash - precisely as I was hoping - thanks for your help! However, it doesn't work on the iPad, argh! On the iPad it will close the floorplan if I move the pano, but if I can no longer use the floorplan to move to a new pano... any click will close the floorplan and void the loading of a different pano...

(FWIW - I would have though onviewchange would be the solution, but it did not work as I would have hoped...)