Skip to content

Commit

Permalink
fix for manually updating compas while providing an update function,
Browse files Browse the repository at this point in the history
values weren't coming out the same as they went in.
  • Loading branch information
Nathan Wilkins committed Jul 15, 2014
1 parent 90e798f commit 0c4893e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions compass-rose-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
coordinates.x += this.frontcanv.width / 2;
coordinates.y += this.frontcanv.height / 2;

_this.drawArrow(coordinates);
canvas.parentElement.settings['move'](newSpeed, newDirection);
_this.drawArrow(coordinates, newDirection, newSpeed);
return;
}

Expand Down Expand Up @@ -96,7 +95,7 @@
return coords;
};

this.drawArrow = function(coords) {
this.drawArrow = function(coords, direction, speed) {
var canvas = this.frontcanv;
var ctx = canvas.getContext('2d');

Expand Down Expand Up @@ -156,10 +155,12 @@
ctx.closePath();

// pass our values to the configured move function
if (canvas.parentElement.settings &&
canvas.parentElement.settings['move'] != null)
{
canvas.parentElement.settings['move'](canvas.pmag, canvas.pangle);
if (canvas.parentElement.settings && canvas.parentElement.settings['move'] != null){
if (direction && speed) {
canvas.parentElement.settings['move'](speed, direction);
} else {
canvas.parentElement.settings['move'](canvas.pmag, canvas.pangle);
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion compass-rose-ui.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0c4893e

Please sign in to comment.