Преглед изворни кода

Fixed zoom issues.

tags/1.0
Matthew Petroff пре 13 година
родитељ
комит
c40b94bcf6
1 измењених фајлова са 30 додато и 15 уклоњено
  1. +30
    -15
      src/js/pannellum.js

+ 30
- 15
src/js/pannellum.js Прегледај датотеку

@@ -152,10 +152,8 @@ function onDocumentMouseUp(event)

function onDocumentMouseWheel(event)
{
if (fov >= 40 && fov <= 100)
{
fov -= event.wheelDeltaY * 0.05;
if (fov >= 35 && fov <= 105)
{
// WebKit
if (event.wheelDeltaY)
{
@@ -169,20 +167,19 @@ function onDocumentMouseWheel(event)
// Firefox
else if (event.detail)
{
fov += event.detail * 1.0;
}
// keep field of view within bounds
if(fov < 40)
{
fov = 40;
}
if(fov > 100)
{
fov = 100;
fov += event.detail * 1.5;
}
}
// keep field of view within bounds
if(fov < 35)
{
fov = 35;
}
if(fov > 105)
{
fov = 105;
}
camera.projectionMatrix = THREE.Matrix4.makePerspective(fov,window.innerWidth / window.innerHeight,1,1100);
render();
}
@@ -206,6 +203,15 @@ function onDocumentKeyPress (event)
camera.projectionMatrix = THREE.Matrix4.makePerspective(fov,window.innerWidth / window.innerHeight,1,1100);
render();
}
// keep field of view within bounds
if(fov < 40)
{
fov = 40;
}
if(fov > 100)
{
fov = 100;
}
}
// if plus key is pressed
@@ -218,6 +224,15 @@ function onDocumentKeyPress (event)
camera.projectionMatrix = THREE.Matrix4.makePerspective(fov,window.innerWidth / window.innerHeight,1,1100);
render();
}
// keep field of view within bounds
if(fov < 40)
{
fov = 40;
}
if(fov > 100)
{
fov = 100;
}
}
}



Loading…
Откажи
Сачувај