@totvs-agro/mobile-components
Version:
Componentes Mobile Totvs (Front-End) para utilização dos estilos do T-Faces e Ionic v3
52 lines • 1.68 kB
JavaScript
import { GoogleMaps, GoogleMapsEvent, GoogleMapsMapTypeId } from '@ionic-native/google-maps';
import { MapWrapper } from './map-wrapper';
var MapUtil = /** @class */ (function () {
function MapUtil() {
}
MapUtil.create = function (mapElement, mapOptions) {
var options = MapUtil.getDefaultMapOptions();
if (mapOptions) {
if (mapOptions.disable) {
options.gestures = {
rotate: false,
zoom: false,
scroll: false,
tilt: false
};
options.controls = {
compass: false,
myLocationButton: false,
myLocation: false
};
}
}
var map = GoogleMaps.create(mapElement.nativeElement, options);
map.setOptions(mapOptions);
if (mapOptions && mapOptions.onclick) {
map.on(GoogleMapsEvent.MAP_CLICK)
.subscribe(function (location) {
mapOptions.onclick(location);
});
}
return new MapWrapper(map);
};
MapUtil.getDefaultMapOptions = function () {
return {
mapType: GoogleMapsMapTypeId.HYBRID,
camera: {
zoom: 16
},
controls: {
compass: true,
myLocation: true,
myLocationButton: false
},
gestures: {
rotate: true
}
};
};
return MapUtil;
}());
export { MapUtil };
//# sourceMappingURL=map-util.js.map