Skip to content

Commit

Permalink
Fix use of offsets when calculating joint position
Browse files Browse the repository at this point in the history
  • Loading branch information
Wylie authored and Wylie committed Aug 14, 2018
1 parent 7b07eab commit d2b46cb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 27 deletions.
31 changes: 15 additions & 16 deletions index.html
@@ -1,8 +1,5 @@
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">

Expand All @@ -20,27 +17,29 @@

<div id="container">
<header>
<h1>Forward & Inverse Kinematics</h1>
<h1>Forward & Inverse Kinematics</h1>
</header>

<div id="main" role="main"></div>

<footer>
<p>Up and down arrow keys change the number of joints.</p>
<p>Up and down arrow keys change the number of joints.</p>

<p><strong>Forward Kinematics:</strong></p>
<p>Click a joint to select it. Left and right arrow keys rotate.</p>
<p><strong>Inverse Kinematics:</strong></p>
<p>Click and drag anywhere on the board to orient the joints.</p>
<p><a href="https://github.com/wylieconlon/kinematics">Source code</a></p>
<p><strong>Forward Kinematics:</strong></p>
<p>Click a joint to select it. Left and right arrow keys rotate.</p>

<p><strong>Inverse Kinematics:</strong></p>
<p>Click and drag anywhere on the board to orient the joints.</p>

<p><a href="https://github.com/wylieconlon/kinematics">Source code</a></p>
</footer>
</div>


<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script defer src="js/raphael-min.js"></script>
<script
src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha256-3edrmyuQ0w65f8gfBsqowzjJe2iM6n0nKciPUp8y+7E="
crossorigin="anonymous"></script>
<script defer src="js/raphael.min.js"></script>
<script defer src="js/sylvester.js"></script>
<script defer src="js/kinematics.js"></script>
</body>
Expand Down
4 changes: 2 additions & 2 deletions js/kinematics.js
Expand Up @@ -156,13 +156,13 @@ $(function() {
if(offsetLeft == undefined) {
offsetLeft = 0;
for(var node=$("#main svg")[0]; node; node = node.offsetParent) {
offsetLeft += node.offsetLeft;
offsetLeft += $(node).offset().left;
}
}
if(offsetTop == undefined) {
offsetTop = 0;
for(var node=$("#main svg")[0]; node; node = node.offsetParent) {
offsetTop += node.offsetTop;
offsetTop += $(node).offset().top;
}
}

Expand Down
9 changes: 0 additions & 9 deletions js/raphael-min.js

This file was deleted.

1 change: 1 addition & 0 deletions js/raphael.min.js

Large diffs are not rendered by default.

0 comments on commit d2b46cb

Please sign in to comment.