#
luxiaotao1123
2023-03-21 059270c12f452fcc3344b826f35295fd7c20906e
views/sketh/js/InitCommon.js
@@ -86,16 +86,6 @@
let PI_2 = Math.PI / 2; //used by controls below
let infoElement = document.getElementById('info');
infoElement.style.cursor = "default";
infoElement.style.userSelect = "none";
infoElement.style.MozUserSelect = "none";
let cameraInfoElement = document.getElementById('cameraInfo');
cameraInfoElement.style.cursor = "default";
cameraInfoElement.style.userSelect = "none";
cameraInfoElement.style.MozUserSelect = "none";
let mouseControl = true;
let pointerlockChange;
let fileLoader = new THREE.FileLoader();
@@ -167,7 +157,7 @@
   SCREEN_WIDTH = document.body.clientWidth; //window.innerWidth;
   SCREEN_HEIGHT = document.body.clientHeight; //window.innerHeight;
   renderer.setPixelRatio(pixelRatio);
   // renderer.setPixelRatio(pixelRatio);
   renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
   fontAspect = (SCREEN_WIDTH / 175) * (SCREEN_HEIGHT / 200);
@@ -238,7 +228,6 @@
} // end function onWindowResize( event )
function init()
{
@@ -282,27 +271,27 @@
   // since I use the lil-gui.min.js minified version of lil-gui without modern exports,
   //'g()' is 'GUI()' ('g' is the shortened version of 'GUI' inside the lil-gui.min.js file)
   gui = new g(); // same as gui = new GUI();
   // gui = new g(); // same as gui = new GUI();
   pixel_ResolutionController = gui.add(pixel_ResolutionObject, 'pixel_Resolution', 0.5, 1.0, 0.05).onChange(handlePixelResolutionChange);
   if (!mouseControl)
      orthographicCamera_ToggleController = gui.add(orthographicCamera_ToggleObject, 'Orthographic_Camera', false).onChange(handleCameraProjectionChange);
   // pixel_ResolutionController = gui.add(pixel_ResolutionObject, 'pixel_Resolution', 0.5, 1.0, 0.05).onChange(handlePixelResolutionChange);
   // if (!mouseControl)   // todo: 是否能够点击
   //    orthographicCamera_ToggleController = gui.add(orthographicCamera_ToggleObject, 'Orthographic_Camera', false).onChange(handleCameraProjectionChange);
   gui.domElement.style.userSelect = "none";
   gui.domElement.style.MozUserSelect = "none";
   // gui.domElement.style.userSelect = "none";
   // gui.domElement.style.MozUserSelect = "none";
   if (mouseControl)
   {
      gui.domElement.addEventListener("mouseenter", function (event)
      {
         ableToEngagePointerLock = false;
      }, false);
      gui.domElement.addEventListener("mouseleave", function (event)
      {
         ableToEngagePointerLock = true;
      }, false);
      // gui.domElement.addEventListener("mouseenter", function (event)
      // {
      //    ableToEngagePointerLock = false;
      // }, false);
      // gui.domElement.addEventListener("mouseleave", function (event)
      // {
      //    ableToEngagePointerLock = true;
      // }, false);
      window.addEventListener('wheel', onMouseWheel, false);
@@ -347,21 +336,6 @@
      document.addEventListener('webkitpointerlockchange', pointerlockChange, false);
   } // end if (mouseControl)
   /* // Fullscreen API (optional)
   document.addEventListener("click", function()
   {
      if ( !document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement )
      {
         if (document.documentElement.requestFullscreen)
            document.documentElement.requestFullscreen();
         else if (document.documentElement.mozRequestFullScreen)
            document.documentElement.mozRequestFullScreen();
         else if (document.documentElement.webkitRequestFullscreen)
            document.documentElement.webkitRequestFullscreen();
      }
   }); */
   initTHREEjs(); // boilerplate: init necessary three.js items and scene/demo-specific objects
@@ -461,12 +435,12 @@
   // setup scene/demo-specific objects, variables, GUI elements, and data
   initSceneData();
   pixel_ResolutionController.setValue(pixelRatio);
   if (!allowOrthographicCamera && !mouseControl)
   {
      orthographicCamera_ToggleController.domElement.hidden = true;
      orthographicCamera_ToggleController.domElement.remove();
   }
   // pixel_ResolutionController.setValue(pixelRatio);
   // if (!allowOrthographicCamera && !mouseControl)
   // {
   //    orthographicCamera_ToggleController.domElement.hidden = true;
   //    orthographicCamera_ToggleController.domElement.remove();
   // }
@@ -613,7 +587,7 @@
   // if GUI has been used, update
   if (needChangePixelResolution)
   {
      pixelRatio = pixel_ResolutionController.getValue();
      // pixelRatio = pixel_ResolutionController.getValue();
      onWindowResize();
      needChangePixelResolution = false;
   }