How to reset the <area> to the default ?

  • Hi KLAUS,

    Is there a native Krpano function to reset the <area> to the stage width and height (as it is by default before setting an <area>) *question*
    In trying to answer a thread from machart (new approach for widescreen presentation), I was needing to reset the <area>. So I have tried something like reset(area) and others but without succes.

    I have found a way that works, using the onresize event for call an action that sets the <area> to match the stage but I am not sure that is the best way to do.
    Here is an example code I used to test:

    Is there a better way to do ? A native function ?

    SAlut.

  • Hi,

    there no reset functions, but that can be done by setting the area values back to the default ones:

    Code
    <area x="0%" y="0%" width="100%" height="100%" />


    e.g. as action:

    Code
    <action name="resetarea">
      set(area.x, 0%);
      set(area.y, 0%);
      set(area.width, 100%);
      set(area.height, 100%);
    </action>

    note - it's enougth to call this ones, not in every onresize,
    the onresize event could be also set back to 'null' when not needed anymore,

    best regards,
    Klaus

  • Thank you KLAUS,

    I have simplified a little and modified the code to reset the area in your way:


    Is there a better way to set a border to the area? I have posted a thread about this here:
    Border attribute for <area> node

    Thank you. *smile*

    SAlut,

  • Hi,

    Here a more simplified code after the explanaition from KLAUS here: Border attribute for <area> node
    The modified code:


    The most important part to customise the way you need is line code 56 to 61.... Here are the values to set properly the area, the margin and the border...

    Thank you again KLAUS *thumbsup* .I would like to say one more and one more time the GREAT job you are doing. *attention*

    SAlut.

  • Hello, I wld like to know if there is a possibility that the area scales via tween to 100% when resetting the predefinded area.

    Code
    <action name="reset_and tween_area_size">
    set(events.onresize,); 
    set(area.x, 0%);
    set(area.y, 0%);
    tween(area.width, 100%);
    tween(area.height, 100%);
    if( area_vars.border.value == false, reset_border(););
    </action>

    In this way the area tweens from upper left corner over the whole screen, I wld like to have an animation that scales the area that it fits the screen from the before setted area. So I want to use it as an animation that while the tour is loading a static images shows up and after loading is done and mouse click, the area grows to full stage and you can navigate through the tour.

    Thanks in advance.
    A.

  • Hi Astroman,

    Try with this code:

    SAlut.

  • Hello Michel, that works absolut perfect!
    Many thanks. Can I ask about this:
    tween(area.height, get(stageheight),,,WAIT);

    When doing it without ",,,WAIT);" the "tour" shakes a little and starts tweening - working with "wait" makes all smooth.
    So for what is the ",,,WAIT);"?

    A.

  • Hi Astroman,

    WAIT flag for the tween() action

    • waiting until this tween has been finished before the next action command will be executed
    • usage:
      Code
      tween(variable,destinationvalue,time,tweentype,WAIT);

    The tween() action starts only a 'process' to change a value during the time, but after starting it, the next action will be processed, this allows the tween() several values at once,...

    So, without the WAIT flag, the following actions are executed (the set(area.x, 0%),ect...)... this is why the "tour" shakes a little and starts tweening *wink* ...

    Hope this help...

    SAlut.

    Edited once, last by michel (May 15, 2010 at 2:02 PM).

  • Hi Astroman,

    Answering to your private message (*), here a modified code to set the area size using tween :

    (*) hope it can be usefull to other also *wink* .

    SAlut.

  • Ah. Very clever to run the area_size function/action again ;)
    Thank you. My first impressions was to recieve the values from the "area_size" function and pass them to the "
    set_area_size_tween" action.

  • Hi Astroman,

    Yes *thumbup* , following your approach, the code could be something like this:

    SAlut.

  • Hi Astroman,

    Answering to your private message (*), here a modified code to set the area size using tween :

    (*) hope it can be usefull to other also *wink* .

    SAlut.

    I have tried this code but the area keeps resizing all the time, like in an infinite loop. Why is this happening?

  • Here is a live test

    http://www.orbitlab.gr/beta/test/

    this is my code

  • Hi Michel,
    Can you please come up with a solution to this problem based on your code:

    When I put the tour, using code above, in a div tag (per normal) everything is ok and appears centered as it is using the entire screen resolution.
    But when I put the tour in a div tag and then try to center that div using <center> </center> or other methods of centering, the stage suddenly shrinks in size to a couple of inches.

    I found the problem because I wanted to put the tour within a reduced size (windowed) div (60% x 80% of screen size) and then the tour was positioned in the top left corner. So I went to center it and bam!... it changed to this tiny little box, albeit it was centered.
    The reason I wanted to reduce the DIV is because I did not want the stage to be full screen while the image was a reduced size. I thought it might be better to have plugins outside the image, but inside the reduced size stage. That way, I could set plugin parent to stage and all would align and scale well in a small window and as a full screen window.

    Anyway, I reset the div to full (100%) size w and h. Then kept the <center> and still have same problem... stage becomes this tiny little box in the center of the screen.

    What I want windowed:

    What I want Fullscreen (not sure if this is exact to what would be reproduced full screen):

    If you have found a new method or know a better way to accomplish this I'd be happy to hear about it.
    I'm thinking maybe the best way is to just create a plugin border around the tour then using that as a parent for controls.

    Thanks, Tony

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!