https://github.com/AppWerft/Ti.CompassView
Compassview for Axways Titanium 🚀
https://github.com/AppWerft/Ti.CompassView
appcelerator-titanium
Last synced: 8 months ago
JSON representation
Compassview for Axways Titanium 🚀
- Host: GitHub
- URL: https://github.com/AppWerft/Ti.CompassView
- Owner: AppWerft
- License: other
- Created: 2017-05-16T15:39:42.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-11-02T13:06:57.000Z (about 6 years ago)
- Last Synced: 2025-03-05T12:53:00.868Z (10 months ago)
- Topics: appcelerator-titanium
- Language: Java
- Homepage:
- Size: 2.89 MB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.txt
- License: LICENSE
Awesome Lists containing this project
README
# Ti.CompassView
This Axway Titanium module realizes a compassview. This works faster and smoother then a pure JS solution, because the event managing over KrollProxy is avoided.
## Usage
### Rotating image (compass) following compass sensor
```javascript
var Compass = require("ti.compassview");
var compassView = Compass.createView({
offset : 10,
type : Compass.TYPE_RADAR, // or TYPE_COMPASS
image : '/images/radar.png',
duration: 200, //optional
image: "/asssets/arrow.png"
});
compassView.getBearing();
compassView.setOffset(45);
```
### Shifting content of ScrollView following compass sensor
```javascript
const Compass = require("ti.compassview");
const containerView = Ti.UI.createScrollView({
scrollType : 'horizontal';
contentWidth : 3000, // must be numeric, Ti.UI.SIZE doesn't work !
width: Ti.UI.FILL
});
// optional background image
containerView.add(Ti.UI.createImageView({
image : 360°_PANOIMAGE
}));
// some numbers:
for ( i = 0; i < 360; i += 30) {
containerView.add(Ti.UI.createLabel({
text : i + '°',
bottom : 10,
left : 3000 / 360*i,
height : Ti.UI.SIZE,
width : Ti.UI.SIZE,
color : "yellow",
font : {
fontSize : 14,
fontWeight : 'bold'
}
}));
}
Compass.setCompassTracker(containerView,{
offset : 0 // offset to north
smoothScroll : true // uses smoothScroll,
sensorDelay : Compass.SENSOR_DELAY_FASTEST
});
```