Results 1 to 4 of 4

Thread: Lock the Orientation to Portrait Mode

  1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    19
    Answers
    1

    Default Lock the Orientation to Portrait Mode

    Hi ,
    I searched forumns , but it has similar queries related to webapps, I am working on a hybrid app,
    I want to lock orientation of my App (an hybrid app) on basis of its Active Tab Bar.

    for example home tab must be in locked Portrait mode even when tilted ,
    and in Second Tab must be in Landscape mode even when held vertically .

    I tried using
    monitorOrientation:false,

    but this doesnt work .

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449
    Answers
    3997

    Default

    The only way to really do this is on orientation, rotate your viewport.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    19
    Answers
    1

    Default

    As given in API documentation Return false to stop the orientation change. i did same but this doesn't stops from going to
    Landscape mode.
    onbeforeorientationchange: function(orientation, w, h){
    try{
    //this.suspendLayout = false;
    if(orientation === 'portrait'){
    console.log('P: ' + orientation);
    // alert("P: b4 Orientation: "+orientation);

    } else {
    orientation='portrait';
    this.setOrientation( orientation, w, h )
    // alert("L:b4 Orientation: "+orientation);
    console.log('L: ' + orientation);
    return false;
    }
    this.doLayout();
    }
    catch(error){
    alert(error);
    }
    return false;
    }

  4. #4
    Sencha User
    Join Date
    Jun 2012
    Posts
    37
    Answers
    3

    Default

    What is the best way to rotate your viewport?

    I tried to to this with css
    -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    -ms-transform: rotate(90deg);
    transform: rotate(90deg);


    but the viewport did not fill the screen do I need to update the width and height as well?

Tags for this Thread

Posting Permissions

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