Comments (6)
Hi @mauricioLopezRamirez. Unfortunately I understand Spanish only with Google translate. But I hope that you understand English. Add orientation cordova plugin. Subscribe to orientation change event and recreate map. Like this (I haven't tested):
screen.orientation.addEventListener('change', function(){ Mapbox.hide(); Mapbox.show(yourOptions); });
from mapbox.
@risinghero gracias por tu respuesta, lo e hecho sin plugin, solo utilice javascript lo cual detecta el cambio de orientación pero no ha funcionado el siguiente código. Que otra opción propones:
window.addEventListener("orientationchange", function() {
Mapbox.hide();
showMap();
});
from mapbox.
@mauricioLopezRamirez please check with debugger that event "orientationchange" works. There can be some problems with it.
from mapbox.
@risinghero si funciona, e puesto un alert para que me verifique que si se cambio de orientación y si cambia.
from mapbox.
@mauricioLopezRamirez to further help you I need simple example reproducing this issue. Can you create one? Just Map+subscription to event so i can test it on my pc.
from mapbox.
ok @risinghero este es mi codigo del index.html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width">
<script type="text/javascript" src="cordova.js"></script>
</head>
<body onload="onLoad()">
<script>
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
showMap();
}
var zoom = 12;
function setTilt() {
Mapbox.setTilt({
pitch: 45,
duration: 4500
});
}
window.addEventListener("orientationchange", function() {
Mapbox.hide();
showMap();
});
function showMap() {
Mapbox.show({
style: 'emerald',
margins: {
'left': 0,
'right': 0,
'top': 0,
'bottom': 0
},
center: {
lat: 3.4210196,
lng: -76.5201787
},
zoomLevel: zoom, // 0 (the entire world) to 20, default 10
showUserLocation: true, // default false
hideAttribution: true, // default false
hideLogo: true, // default false
hideCompass: false, // default false
disableRotation: false, // default false
disableScroll: false, // default false
disableTilt: false, // default false
disableZoom: false, // default false
disablePitch: false, // default false
markers: [
{
'lat': 3.4356455,
'lng': -76.5281464,
'title': 'CALLE 13 CON CARRERA 23',
'subtitle': 'Sentido: SUR-NORTE\nZona: CENTRO'
}
]
},
function (result) {
console.log(JSON.stringify(result));
// let's add a callback for these markers - invoked when the callout is tapped (Android) or the (i) icon in the marker callout (iOS)
Mapbox.addMarkerCallback(function (selectedMarker) {
// alert("Marker selected: " + JSON.stringify(selectedMarker));
});
// let's add callbacks for region changing
//
// - invoked when the map is about to moved (animated or not).
Mapbox.onRegionWillChange(function(centerCoordinates) {
console.log("Map will move from: ", centerCoordinates);
});
// - invoked at each tick (so 60 per second) when the map moves. So don't do any heavy computing here.
Mapbox.onRegionIsChanging(function(centerCoordinates){
console.log("New map center is: ", centerCoordinates);
});
// - invoked after the map has moved (animated or not).
Mapbox.onRegionDidChange(function(centerCoordinates) {
console.log("Map as finished to move to : ", centerCoordinates);
});
},
function (error) {
alert(error);
}
)
}
</script>
</body>
</html>
from mapbox.
Related Issues (20)
- In ios map is not showing ??
- This project is dead. HOT 4
- Not able to import mapbox-gl npm package and cordova-plugin-mapbox HOT 1
- Adding JS event on pin click HOT 2
- Search bar HOT 1
- addMarkerCallback does not show clickable button in popup on Android 5.1.0 HOT 3
- 3D Map Support HOT 1
- Add Polyline & Alpha support
- Failed to fetch plugin HOT 2
- Mapbox.hide - PhoneGap Cordova HOT 1
- use navigation in phonegap-based app
- How to use with ionic 3 HOT 3
- como usar clearBackground: true,
- Go to user's current location
- active or not HOT 9
- How to add element over map HOT 13
- No support and maintainance HOT 9
- Where is Mapbox plugin Documentation ? HOT 1
- AAPT: error: duplicate value for resource 'attr/layout_anchorGravity' with config ''.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapbox.