plugin resizing with fov

  • Hello,
    I am trying to build a scale ruler on a flat partial pano.
    So I have a plugin element that resizes according to view.fov in an onviewchange event.
    It works as long as the window (browser window) is not resized.
    When the window is resized vertically by the user, the scale ruler doesn't change size (the view.fov stays same), but the actual pano changes size, so relative size is not right and ruler is useless. Resizing the window horizontally doesn't seem to make a problem.
    I need this to work whatever the window size.
    If I could have the current zoom value I would use that instead of fov and logically that would be ok.
    Alternatively, the solution is probably not to have the pano resize inside the window when the window is resized. I am confident that is the solution but could not find the way to do it.
    Or, maybe, there is another way to do this altogether that I haven't thought about.
    Thanks for helping on this!

    The code is below
    Variable its_size is visually defined so the ruler is the length I want (for example 10 m).

    Code
    <plugin name="ruler"  devices="desktop" align="centertop" x="0" y="10" style="scale" visible="true" edge="1" height="4" width="200"/>
    <events onviewchange="
    	        	set (its_size,1275);
    	        	div(its_size, get(view.fov));
    	        	set(plugin[ruler].width,get(its_size));
        />
  • Thank you Klaus.
    I was kind of expecting that answer about using onresize and stage/area sizes.
    I'll find out how to get these into my calculations by experimenting.
    For now, my solution was to have a fixed height in pixels for my div tag where the pano is embedded. Width can be left in % without issues.
    Best
    Greg

Jetzt mitmachen!

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