Results 1 to 6 of 6

Thread: [Suggestion] GetScreenWidth/Height functions

  1. #1
    Basic Member
    Join Date
    Oct 2014
    Posts
    35

    [Suggestion] GetScreenWidth/Height functions

    I think it would be nice to have these two simple functions. Panorama handles all of the UI rescaling stuff but sometimes in the script we need to know the aspect ratio/screen dimensions as well, and currently we cannot do that.

  2. #2

  3. #3
    Basic Member
    Join Date
    Oct 2014
    Posts
    35
    Sorry if I wasn't clear. I know Panorama automatically does the scaling. What I am asking for is a GetScreenWidth/GetScreenHeight function in the Javascript API that will let me access the screen width and height inside of a script. Unless I am missing something about that link.

  4. #4
    Basic Member
    Join Date
    Jan 2012
    Posts
    144
    Yes I understand, I mean you could use classes for different aspect ratios to work around that for now, tho a function would be nice probably.

  5. #5
    $.Msg( $("#utils").GetParent().GetParent().contentwidth ); // screen width
    or
    $.Msg( $.GetContextPanel().GetParent().contentwidth ); // screen width
    var ratio = w / h;
    Code:
    <root>
            <Panel class="Main" hittest="false">
                   <Panel id="utils" hittest="false" />
    	</Panel>
    </root>
    Last edited by dotyer.ua; 07-21-2015 at 10:55 AM.

  6. #6
    Basic Member arhowk's Avatar
    Join Date
    Mar 2015
    Location
    Michigan, USA
    Posts
    210
    @dotyer.ua this code *should* still be effected to Panorama scaling (not sure about that)

    also, that code is functionally equivalent to $.GetContextPanel().contentwidth (this method also requires no additional xml to execute)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •