Cannot access to the 'setCameraTarget' method.
See original GitHub issueI’m submitting a … (check one with “x”)
- question
- any problem or bug report
- feature request
If you choose ‘problem or bug report’, please select OS: (check one with “x”)
- Android
- iOS
cordova information: (run $> cordova plugin list
)
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-googlemaps 2.2.9 "cordova-plugin-googlemaps"
cordova-plugin-ionic-keyboard 2.0.5 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.2.0 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
If you use @ionic-native/google-maps
, please tell the package.json (only @ionic-native/core
and @ionic-native/google-maps
are fine mostly)
"@ionic-native/core": "^4.7.0",
"@ionic-native/google-maps": "^4.7.0",
Current behavior:
setCameraTarget
throws an error. I’m trying to set the camera with multiple ILatLng
objects, to bound the map to their locations.
Expected behavior: Should work.
Screen capture or video record:
Related code, data or error log (please format your code or data):
import { HttpClient } from '@angular/common/http';
import { Component } from '@angular/core';
import { GoogleMap, GoogleMaps, GoogleMapsEvent } from "@ionic-native/google-maps";
import { IonicPage } from 'ionic-angular';
import { Store } from '../../models/store.model';
import { LocationsConstants } from './locations.constants';
import { Observable } from 'rxjs/Observable';
@IonicPage()
@Component({
selector: 'page-locations',
templateUrl: 'locations.html',
})
export class LocationsPage {
public map: GoogleMap;
public stores: Observable<Store[]>;
constructor(
private _http: HttpClient
) { }
public ionViewDidLoad() {
this.stores = this._http.get<Store[]>('./assets/data/stores.json');
this.map = GoogleMaps.create('map', LocationsConstants.MapOptions);
this.map.one(GoogleMapsEvent.MAP_READY).then(() => this.loadMap());
}
public loadMap() {
this.stores.subscribe(stores => this.placeMarkers(stores));
}
public placeMarkers(stores: Store[]) {
console.log((stores.map(d => d.latlng)));
this.map.setCameraTarget(stores.map(d => d.latlng));
for (let store of stores)
this.map.addMarker({ position: store.latlng, ...LocationsConstants.MarkerOptions });
}
}
[
{
"name": "",
"location": "",
"latlng": {
"lat": 40.334564,
"lng": -74.487639
}
},
{
"name": "",
"location": "",
"latlng": {
"lat": 40.8518239,
"lng": -74.44092739999996
}
}
]
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Any way to set camera target in the script?
Hi all, I was wondering if it was possible for you to define a target for something in the script as opposed to...
Read more >setCameraTarget - ped - Scripting
I managed to get the camera looking at the ped, I just can't check if it follows cause I can't seem to get...
Read more >Google Earth Studio - Camera Target & Multi-View - YouTube
Tap to unmute. If playback doesn't begin shortly, try restarting your device. Your browser can't play this video. Learn more. Switch camera.
Read more >I cannot access the camera in a UIViewController
My goal is to get it activated in viewDidAppear or viewDidLoad, but I also tried testing it by connecting the code to a...
Read more >Site cannot access camera, but does not seem to be ...
The same problem does not persist on Chrome and Chromium, so I'll be using Chromium for the time being. Due to the way...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
this error continues… anybody can help me?