width="100%" offset

  • Hi,

    I have this picture I want in the left, Its 100px wide. The rest I want to fill with a white border, so I made a 1x1 pixel and stretch it to make it fit. My question is, is it somehow possible to do like width="100% - 100" or something like that? So the border is always as wide as krpano but leaves 100px for the image so they don't overlap. If not, could you implement such thing?

    Ow I forgot, they have an alpha, so they can't overlap.

  • I don't think you can do it directly as you would like.

    If you are using a 1x1 px to make the border... you could set the 1x1 px img to 100% with an x or ox of 100 to move it over to allow for your image. The 1x1px image would still be as wide as the entire stage... but the right side would be pushed out of view of the stage.

    You might be able to utilze some javascript to find out how wide the stage is... and then subtract 100 from that... and then use that new value to set the border dimens.

    That's a MIGHT.

  • Yeah but I thought there was a onresize event in krpano that returns stagewidth and such. Then I could store that in a variable and remove 10px from it. Only I can't figure out the syntax


    Hi, this would be the solution:

    Code
    <events onresize="sub(plugin[image].width,stagewidth,100);" />


    that means:
    plugin[image].width = stagewidth - 100

    and to call the resize event also on beginning:

    Code
    <events onxmlcomplete="events.onresize();" />

    best regards,
    Klaus

  • Hi Klaus,

    Is it possible to substract a % of the stagewidth. For example:

    <events onresize="sub(plugin[image].width,stagewidth,50%);" />

    which means:
    plugin[image].width = stagewidth - 50% (of the stagewidth) ?

    Or maybe set a percentage of the stagewidth?

    Is this possible? Best regards,

    D-Tang

  • Hi,

    Is it possible to substract a % of the stagewidth. For example:

    <events onresize="sub(plugin[image].width,stagewidth,50%);" />

    which means:
    plugin[image].width = stagewidth - 50% (of the stagewidth) ?

    Or maybe set a percentage of the stagewidth?

    yes,

    e.g.

    Code
    mul(halfstagewidth, stagewidth, 0.5);
    sub(plugin[image].width, stagewidth, halfstagewidth);

    that means:
    halfstagewidth = stagewidth * 0.5
    plugin[image].width = stagewidth - halfstagewidth

    or in the case of always 50% just:

    Code
    mul(plugin[image].width, stagewidth, 0.5);

    best regards,
    Klaus

Participate now!

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