Plugin Directory

Changeset 1133897


Ignore:
Timestamp:
04/13/2015 07:39:56 PM (11 years ago)
Author:
joergviola
Message:

relative width and height

Location:
3d-model-viewer/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 3d-model-viewer/trunk/output.php

    r1133276 r1133897  
    33
    44<script>
     5
    56    stage = document.getElementById("<?php echo $id ?>"); 
    67
    7     width = <?php echo $width ?>;
    8     height = <?php echo $height ?>;
    9    
     8    width = 0;
     9    pWidth = "<?php echo $width ?>";
     10    if (pWidth.indexOf('%')==pWidth.length-1) {
     11        width = stage.offsetWidth * parseInt(pWidth) / 100;
     12    } else {
     13        width = parseInt(pWidth);
     14    }
     15
     16    height = 0;
     17    pHeight = "<?php echo $height ?>";
     18    if (pHeight.indexOf('%')==pHeight.length-1) {
     19        height = stage.offsetHeight * parseInt(pHeight) / 100;
     20    } else {
     21        height = parseInt(pHeight);
     22    }
     23   
    1024    var scene = new THREE.Scene();
    1125    var camera = new THREE.PerspectiveCamera( 75, width / height, 0.1, 1000 );
  • 3d-model-viewer/trunk/readme.txt

    r1133276 r1133897  
    2424as well as the cameras and your models position and scale.
    2525
     26For a good application example, [look here](http://openbuilds.com.mx/tienda_de_openbuilds_mexico/guia-lineal-v-slot/#) (thanks to Ronald van Arkel):
     27
     28
     29
    2630== Installation ==
    2731
     
    3135
    3236* model: name of the model file in the media gallery. Mandatory.
    33 * width, height: Size of the 3d stage. Optional, default is 500x300.
     37* width, height: Size of the 3d stage. If in percent, then relative to the size of the div around the canvas. Optional, default is 500x300.
    3438* background: Background color. Optional, default is "ffffff".
    3539* opacity: Background opacity. Optional, default is 1.
     
    5963== Changelog ==
    6064
     65= 1.3 =
     66* width and size can be reltaive to the size of the div around the canvas (which in turn can be set via CSS).
     67
    6168= 1.2 =
    6269* Performance after moving camera optimized.
Note: See TracChangeset for help on using the changeset viewer.