Changes between Version 31 and Version 32 of PythonOcc/elbow


Ignore:
Timestamp:
Dec 12, 2013, 8:52:25 AM (10 years ago)
Author:
Leon Kos
Comment:

Pravilno naredi redraw ob resize

Legend:

Unmodified
Added
Removed
Modified
  • PythonOcc/elbow

    v31 v32  
    270270  viewer.update();
    271271}     
    272 window.onload = window.onresize = function() {onLoad();}       
     272window.onload = function() {onLoad();}       
    273273</script> 
    274274<canvas id="cv" width="600" height="400"
     
    340340        scene.addChild(myMesh);
    341341}
     342var viewer = null;
    342343
    343344function onLoad2(){
     
    345346  canvas.width = 0.9*window.innerWidth;
    346347  canvas.height = canvas.width/1.6;
    347   var viewer = new JSC3D.Viewer(canvas);
     348  viewer = new JSC3D.Viewer(canvas);
    348349  //viewer.setParameter('SceneUrl', '/vaje/raw-attachment/wiki/PythonOcc/elbow/pipe.stl');
    349350  viewer.setParameter('BackgroundColor1', '#FFFFFF');
     
    397398  viewer.update();
    398399}     
    399 window.onload = window.onresize = function() {onLoad(); onLoad2();}       
     400window.onload = function() {onLoad(); onLoad2();} 
     401window.onresize = function() {
     402  var canvas = document.getElementById('cv2');
     403  canvas.width = 0.9*window.innerWidth;
     404  canvas.height = canvas.width/1.6;
     405  viewer.ctx = canvas.getContext('2d');
     406  viewer.canvasData = viewer.ctx.getImageData(0, 0, canvas.width, canvas.height);
     407  viewer.frameWidth = canvas.width;
     408  viewer.frameHeight = canvas.height;
     409  viewer.drawBackground();
     410  viewer.update();
     411}     
    400412</script> 
    401413<canvas id="cv2" width="600" height="400"
     
    408420<script src="/vaje/raw-attachment/wiki/PythonOcc/elbow/jsc3d.min.js"></script>
    409421<script type="text/javascript">
     422var viewer = null;
    410423function onLoad2(){
    411424  var canvas = document.getElementById('cv2');
    412425  canvas.width = 0.9*window.innerWidth;
    413426  canvas.height = canvas.width/1.6;
    414   var viewer = new JSC3D.Viewer(canvas);
     427  viewer = new JSC3D.Viewer(canvas);
    415428  //viewer.setParameter('SceneUrl', '/vaje/raw-attachment/wiki/PythonOcc/elbow/pipe.stl');
    416429  viewer.setParameter('BackgroundColor1', '#FFFFFF');
     
    479492
    480493  viewer.update();
    481 }     
    482 window.onload = window.onresize = function() {onLoad(); onLoad2();}       
     494}
     495
     496window.onload = function() {onLoad(); onLoad2();} 
     497window.onresize = function() {
     498  var canvas = document.getElementById('cv2');
     499  canvas.width = 0.9*window.innerWidth;
     500  canvas.height = canvas.width/1.6;
     501  viewer.ctx = canvas.getContext('2d');
     502  viewer.canvasData = viewer.ctx.getImageData(0, 0, canvas.width, canvas.height);
     503  viewer.frameWidth = canvas.width;
     504  viewer.frameHeight = canvas.height;
     505  viewer.drawBackground();
     506  viewer.update();
     507}           
    483508</script> 
    484509<canvas id="cv2" width="600" height="400"