compassjs 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +3 -0
- data/README.md +2 -2
- data/lib/assets/javascripts/compass.js +15 -7
- metadata +3 -3
data/ChangeLog
CHANGED
data/README.md
CHANGED
@@ -109,9 +109,9 @@ For Ruby on Rails you can use gem for Assets Pipeline.
|
|
109
109
|
If you don’t use any assets packaging manager (it’s very bad idea), you can use
|
110
110
|
already minified version of the library.
|
111
111
|
|
112
|
-
Take it from: [github.com/
|
112
|
+
Take it from: [ai.github.com/compass.js/compass.js].
|
113
113
|
|
114
|
-
[github.com/
|
114
|
+
[ai.github.com/compass.js/compass.js]: http://ai.github.com/compass.js/compass.js
|
115
115
|
|
116
116
|
## Contributing
|
117
117
|
|
@@ -234,10 +234,11 @@
|
|
234
234
|
self._start('phonegap');
|
235
235
|
|
236
236
|
} else if ( self._win.DeviceOrientationEvent ) {
|
237
|
+
self._checking = 0;
|
237
238
|
self._win.addEventListener('deviceorientation', self._checkEvent);
|
238
239
|
setTimeout(function () {
|
239
|
-
if (
|
240
|
-
self._start(false)
|
240
|
+
if ( self._checking !== false ) {
|
241
|
+
self._start(false);
|
241
242
|
}
|
242
243
|
}, 500);
|
243
244
|
|
@@ -296,12 +297,13 @@
|
|
296
297
|
self._callbacks.noSupport = [];
|
297
298
|
},
|
298
299
|
|
299
|
-
// Tell, that `DeviceOrientationEvent
|
300
|
-
|
300
|
+
// Tell, that we wait for `DeviceOrientationEvent`.
|
301
|
+
_checking: false,
|
301
302
|
|
302
303
|
// Check `DeviceOrientationEvent` to detect compass method.
|
303
304
|
_checkEvent: function (e) {
|
304
|
-
self.
|
305
|
+
self._checking += 1;
|
306
|
+
var wait = false;
|
305
307
|
|
306
308
|
if ( defined(e.webkitCompassHeading) ) {
|
307
309
|
self._start('webkitOrientation');
|
@@ -309,11 +311,17 @@
|
|
309
311
|
} else if ( defined(e.alpha) && self._nav.geolocation ) {
|
310
312
|
self._gpsHack();
|
311
313
|
|
312
|
-
} else {
|
314
|
+
} else if ( self._checking > 1 ) {
|
313
315
|
self._start(false);
|
316
|
+
|
317
|
+
} else {
|
318
|
+
wait = true;
|
314
319
|
}
|
315
320
|
|
316
|
-
|
321
|
+
if ( !wait ) {
|
322
|
+
self._checking = false;
|
323
|
+
self._win.removeEventListener('deviceorientation', self._checkEvent);
|
324
|
+
}
|
317
325
|
},
|
318
326
|
|
319
327
|
// Use GPS to detect difference between `alpha` orientation and real North.
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: compassjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Andrey "A.I." Sitnik
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
type: :runtime
|
@@ -43,7 +43,7 @@ files:
|
|
43
43
|
- LICENSE
|
44
44
|
- README.md
|
45
45
|
- ChangeLog
|
46
|
-
homepage:
|
46
|
+
homepage: http://ai.github.com/compass.js/
|
47
47
|
licenses: []
|
48
48
|
post_install_message:
|
49
49
|
rdoc_options: []
|