fixed mouse wheel scrolling

This commit is contained in:
2013-11-27 19:21:41 +10:00
parent b9c82f280b
commit c6618614d9
4 changed files with 12 additions and 6 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
*.pyc
.DS_Store
.spyderproject
reports/

Binary file not shown.

View File

@@ -7,13 +7,14 @@
{% block includes %}
<link href="{% static "three_d_viewer/css/bootstrap.css" %}" rel="stylesheet" media="screen" />
<link href="{% static "three_d_viewer/css/custom.css" %}" rel="stylesheet" media="screen" />
<script type="text/javascript" src="{% static "three_d_viewer/js/jquery-2.0.3.js" %}"></script>
<script type="text/javascript" src="{% static "three_d_viewer/js/bootstrap.min.js" %}"></script>
{% endblock %}
</head>
<body onload={% block loadscript %}""{% endblock %}>
<div class="container">
<div class="my-fluid-container">
<div class="page-header">
{% block pageheader %}
<h1>Three D Viewer</h1>
@@ -21,8 +22,8 @@
{% endblock %}
</div>
<div class="row">
<div class="col-md-4">
<div class="row my-fluid-container">
<div class="col-sm-4 col-md-2">
{% block sidebar %}
<div class="row">
{% include "three_d_viewer/sampletree.html" %}
@@ -30,7 +31,7 @@
{% endblock %}
</div>
<div id="contentdiv" class="col-md-8" style="border:1px solid black" height="100%">
<div id="contentdiv" class="col-sm-8 col-md-10" style="border:1px solid black" height="100%">
{% block content %}
<p>Put some intro text sort of stuff here</p>
{% endblock %}

View File

@@ -127,7 +127,7 @@ function webGLStart(){
canvas.onmousemove = handleMouseMove;
canvas.onmousewheel = handleMouseWheel;
window.addEventListener("DOMMouseScroll", handleMouseWheel, false);
canvas.addEventListener("DOMMouseScroll", handleMouseWheel, false);
tick();
}
@@ -314,12 +314,16 @@ function degToRad(degrees){
}
function handleMouseWheel(event){
event.preventDefault();
var delta = event.wheelDelta | -event.detail;
if (delta < 0){
translationMatrix[2] -= .05;
}else{
translationMatrix[2] += .05;
}
event.returnValue=false;
}
function handleMouseDown(event){
@@ -372,6 +376,6 @@ function handleMouseMove(event){
{% endblock %}
{% block content %}
<canvas id="canvas" style="border: 1px dotted #bfbfbf;" width="640px" height="480px"></canvas>
<canvas id="canvas" style="border: 1px dotted #bfbfbf;" width="750px" height="600px"></canvas>
<div><br><span id="progress" style="color: red"></span></div>
{% endblock %}