Skip to content

Commit

Permalink
add further direction tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
felixerdy committed Nov 6, 2019
1 parent 82e1570 commit 4c477a2
Show file tree
Hide file tree
Showing 11 changed files with 404 additions and 316 deletions.
3 changes: 1 addition & 2 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>OriGami</name>
<description>OriGami is an orientation game.</description>
<author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
<content original-src="index.html" src="http://localhost:8100" />
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
Expand Down Expand Up @@ -110,5 +110,4 @@
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<plugin name="cordova-plugin-geolocation" spec="~4.0.2" />
<plugin name="cordova-plugin-camera" spec="~4.1.0" />
<allow-navigation href="http://localhost:8100" sessionid="9e6f25d0" />
</widget>
5 changes: 5 additions & 0 deletions package-lock.json

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

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
"@ionic-native/device": "^5.16.0",
"@ionic-native/device-orientation": "^5.15.0",
"@ionic-native/geolocation": "^5.11.0",
"@ionic-native/insomnia": "^5.16.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.11.0",
"@ionic-native/vibration": "^5.16.0",
"@ionic/angular": "^4.1.0",
"@mapbox/mapbox-gl-draw": "^1.1.2",
"@ngx-translate/core": "^11.0.1",
Expand All @@ -39,6 +41,7 @@
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-device-orientation": "^2.0.1",
"cordova-plugin-geolocation": "^4.0.2",
"cordova-plugin-vibration": "^3.1.1",
"core-js": "^2.5.4",
"leaflet.offline": "^1.0.4",
"mapbox-gl": "^1.5.0",
Expand Down Expand Up @@ -97,7 +100,9 @@
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-geolocation": {},
"cordova-plugin-camera": {},
"cordova-plugin-device-orientation": {}
"cordova-plugin-device-orientation": {},
"cordova-plugin-insomnia": {},
"cordova-plugin-vibration": {}
},
"platforms": [
"android",
Expand Down
7 changes: 6 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ import { DynamicFormModule } from "./dynamic-form/dynamic-form.module";
import { LottieAnimationViewModule } from "ng-lottie";
import { Device } from "@ionic-native/device/ngx";

import { Insomnia } from "@ionic-native/insomnia/ngx";
import { Vibration } from "@ionic-native/vibration/ngx";

// AoT requires an exported function for factories
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http, "./assets/i18n/", ".json");
Expand Down Expand Up @@ -105,7 +108,9 @@ export function HttpLoaderFactory(http: HttpClient) {
// Geofence,
Camera,
DeviceOrientation,
Device
Device,
Insomnia,
Vibration
],
bootstrap: [AppComponent]
})
Expand Down
9 changes: 9 additions & 0 deletions src/app/form-elements/map/map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ export class MapComponent implements OnInit, Field, AfterViewInit {
e.preventDefault();
}
if (this.config.featureType == "direction") {
let bearing = this.map.getBearing();

while (bearing > 360) {
bearing = bearing - 360;
}
while (bearing < 0) {
bearing = bearing + 360;
}

this.group.patchValue({ [this.config.name]: this.map.getBearing() });
}
});
Expand Down
Loading

0 comments on commit 4c477a2

Please sign in to comment.