Hide/show controls: what about the toggles ?

  • I have a very nice hide/show controls toggle button. It works well, but when you select "show" it shows all the buttons (of course) including both states of "toggle" buttons. That means you need to click on the toggle button twice before it gets back to normal operation.

    How can I get around this ? Somehow it needs to know the state of the full-screen/close full-screen state ?

    Here is the "show" button code. Any ideas much appreciated.

  • If I understand this correctly... you have a "button" that is used to show the user interface controls... and the problem is that when you click it... to show the controls... your openfs / closefs images are both shown....??

    Actually, reading back over it... it sounds like you have multiple plugins being shown on top of each other... maybe like the stoprotate / startrotate.... etc... ??

    This actually makes sense with the code you have shown... since you've "turned on" all of the plugins with the show plugin / onclick action. There isn't a simple way (that I know of) for krpano to know which plugin was supposed to be active... A complicated way would be to start assigning values to variables and check them using "if" statements.

    But, there is another way...

    Now, using the openfs / closefs plugins as an example... you are using two seperate plugins to toggle these two events. I'm guessing that the onclick actions turn off (visible=false) the existing plugin and turn on (visible=true) the alternate corresponding plugin / image.

    IF this is the case... then what you will probably want to do is consolidate your plugins so that instead of using two different plugins for something like openfs and closefs... you'll have one plugin "togglefs" and use an action to switch the url attribute to display the appropriate image. At the same time you can "switch" the onclick action between openfs and closefs... and this can be done for any of your "toggle" buttons.

    Here's some sample code for an action that I use for a plugin that toggles the size of the map plugin. You'll see how it changes the "mapsize" plugin url so that it showd two different images.

    Code
    <action name="changesize">
    		switch(plugin[mapsize].url,resources/downarrow.png,resources/uparrow.png);
    		switch(plugin[mapsize].onhover,showtext(Smaller Map),showtext(Larger Map));
    		switch(plugin[map].width,49%,40%);
    		switch(plugin[map].height,70%,40%);
    	</action>

    What's also nice with this is that I use a different action to hide / show the map... and when I turn the map back on... the size is the same as when it was turned off... and the mapsize plugin corresponds.... so, this shows how krpano keeps settings in memory.

    I hope that all makes sense... *smile*

  • sorry if it seems complicated...

    I think the key is that you can dynamically change the image shown for a plugin by changing the url attribute with an action... as well as change any of the attributes for the plugin (x, y, offset, rotate, onclick , onhover, etc...)

    If you need help digesting it all... and need a loosely related sample... you can check out http://goto.marlincreek.com/kingsharbor and see how the map control icons alternate and such. That's where I pulled the code sample from earlier.

    Good luck

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!