- This topic has 6 replies, 3 voices, and was last updated 11 years, 4 months ago by SKnoxmn.
-
AuthorPosts
-
SKnoxmnMemberStill trying to get an angle and bearing to display in a text field. I’m now positive that I’m missing something probably very simple here.
Have a look and please advise; http://goo.gl/s81dZU
function clearFields()
{
$(‘#m1-Learning-textField1’).val(”);
$(‘#m1-Learning-textField2’).val(”);
$(‘#m1-Learning-textField3’).val(”);
$(‘#m1-Learning-textField4’).val(”);
$(‘#m1-Learning-textField5’).val(”);
}// clearFieldsfunction findPosition()
{
navigator.geolocation.getCurrentPosition(onSuccess, onError);
}// findPositionfunction findHeading()
{
navigator.compass.getCurrentHeading(compassSuccess, compassError);
}// findHeadingfunction onSuccess(heading)
{
$(‘#m1-Learning-textField5’).val(heading); I suspect its with this “heading”
}// onSuccessfunction onSuccess(position)
{
$(‘#m1-Learning-textField1’).val(position.coords.latitude);
$(‘#m1-Learning-textField2’).val(position.coords.longitude);
$(‘#m1-Learning-textField3’).val(position.coords.altitude);
}// onSuccessfunction onError(error)
{
$(‘#m1-Learning-textField1’).val(error.code);
$(‘#m1-Learning-textField2’).val(error.message);
}// onErrorButton: OnClick = return getCurrentHeading();
Am I close?
SKnox
SKnoxmnMemberThis doesn’t do it…
function Orientation()
{
window.addEventListener(“deviceorientation”, handleOrientation, true);
}// Orientationfunction handleOrientation(event)
{
var absolute = event.absolute;
var alpha = event.alpha;
var beta = event.beta;
var gamma = event.gamma;
} // Do stuff with the new orientation datafunction alpha()
$(‘#m1-Learning-textField4’).val(event.beta);
$(‘#m1-Learning-textField5’).val(event.alpha);
SKnoxmnMemberThis one didn’t either:
window.addEventListener(“deviceorientation”, handleOrientation, true);
function handleOrientation(event)
{
var absolute = event.absolute;
var alpha = event.alpha;
var beta = event.beta;
var gamma = event.gamma;
} // Do stuff with the new orientation datafunction event()
$(‘#m1-Learning-textField4’).val(event.beta);
$(‘#m1-Learning-textField5’).val(event.alpha);So far, all of these attempts to get the angle and direction have managed to “Disable” the other funtion that worked when getting Lat. Lon. and Alt.
Open to suggestions,
SKnox
support-octavioMemberThe “I Haz Cheeseburger?!?!?!” message is a goofy bug in the simulator that we are working on.
Now, I’ve taken a look at your _custom.js code. And found out that there is a syntax error (you miss the braces in your alpha function) that can be the issue in your app:
Attachments:
You must be logged in to view attached files.
SKnoxmnMemberI like the “Bug” message.. it works well and gets my attention.
So I’ve done this now;
function Orientation()
{
window.addEventListener(“deviceorientation”, handleOrientation, true);
}// Orientationfunction handleOrientation(event)
{
var absolute = event.absolute;
var alpha = event.alpha;
var beta = event.beta;
var gamma = event.gamma;
} // Do stuff with the new orientation datafunction What Goes Here()
{
$(‘#m1-Learning-textField4’).val(event.beta); //and should val = Var alpha or beat or something else?
$(‘#m1-Learning-textField5’).val(event.alpha);
}at least now I’m still getting the lat / lon / alt to display, but no love on the angle and azimuth yet.
SKnox
Unknown AuthorParticipantPlease tell me there’s an “All your base are belong to us” error message in there somewhere.
-1TC
SKnoxmnMemberYeah, I didn’t want to bring that one up. “All your base…”
But on the upside, I did comment out all aspects of my script which helped me keep track of what each piece was doing.
So I was able to get it going, posting azimuth and angle to the text field on my form.
Next will be the how to fire it off with an “onClick” and then have it stop once it gets the data.
Lat Lon Altitude is a click once and it populates fine.
angle / azimuth runs “onLoad” and keeps going.
So, Id like an “OnClick” to fire off both and then stop.
Im open to ideas,
p.s. All your Base are belong to us.
http://www.youtube.com/watch?v=8fvTxv46ano
SKnox -
AuthorPosts