[distance-to-portal] add vendor-prefixes to transformations and implement updating the distance without re-rendering all portal details
Firefox supports 'transform' without prefix, but Android still requires '-webkit-'. To be sure, include properties with '-moz-', '-webkit-' and without prefix.
This commit is contained in:
parent
9c534c8898
commit
d55d363112
@ -19,10 +19,14 @@
|
|||||||
top: 0.15em;
|
top: 0.15em;
|
||||||
left: 0.15em;
|
left: 0.15em;
|
||||||
transform: skewY(-30deg);
|
transform: skewY(-30deg);
|
||||||
|
-moz-transform: skewY(-30deg);
|
||||||
|
-webkit-transform: skewY(-30deg);
|
||||||
}
|
}
|
||||||
#portal-distance-bearing:after {
|
#portal-distance-bearing:after {
|
||||||
left: auto;
|
left: auto;
|
||||||
right: 0.15em;
|
right: 0.15em;
|
||||||
transform: scaleX(-1) skewY(-30deg);
|
transform: scaleX(-1) skewY(-30deg);
|
||||||
|
-moz-transform: scaleX(-1) skewY(-30deg);
|
||||||
|
-webkit-transform: scaleX(-1) skewY(-30deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,9 +22,24 @@
|
|||||||
// use own namespace for plugin
|
// use own namespace for plugin
|
||||||
window.plugin.distanceToPortal = function() {};
|
window.plugin.distanceToPortal = function() {};
|
||||||
|
|
||||||
window.plugin.distanceToPortal.addDistance = function(info) {
|
window.plugin.distanceToPortal.addDistance = function() {
|
||||||
|
var div = $('<div>')
|
||||||
|
.attr({
|
||||||
|
id: 'portal-distance',
|
||||||
|
title: 'Double-click to set/change current location',
|
||||||
|
})
|
||||||
|
.on('dblclick', window.plugin.distanceToPortal.setLocation);
|
||||||
|
|
||||||
var ll = info.portal.getLatLng();
|
$('#resodetails').after(div);
|
||||||
|
|
||||||
|
window.plugin.distanceToPortal.updateDistance();
|
||||||
|
};
|
||||||
|
|
||||||
|
window.plugin.distanceToPortal.updateDistance = function() {
|
||||||
|
if(!(selectedPortal && portals[selectedPortal])) return;
|
||||||
|
var portal = portals[selectedPortal];
|
||||||
|
|
||||||
|
var ll = portal.getLatLng();
|
||||||
|
|
||||||
var text;
|
var text;
|
||||||
|
|
||||||
@ -42,22 +57,19 @@ window.plugin.distanceToPortal.addDistance = function(info) {
|
|||||||
var bearing = window.plugin.distanceToPortal.currentLoc.bearingTo(ll);
|
var bearing = window.plugin.distanceToPortal.currentLoc.bearingTo(ll);
|
||||||
var bearingWord = window.plugin.distanceToPortal.currentLoc.bearingWordTo(ll);
|
var bearingWord = window.plugin.distanceToPortal.currentLoc.bearingWordTo(ll);
|
||||||
|
|
||||||
text = 'Distance: '+dist+' <span id="portal-distance-bearing" style="transform: rotate('+bearing+'deg)"></span> '
|
$('#portal-distance')
|
||||||
+ zeroPad(bearing, 3) + '° ' + bearingWord;
|
.text('Distance: ' + dist + ' ')
|
||||||
|
.append($('<span>')
|
||||||
|
.attr('id', 'portal-distance-bearing')
|
||||||
|
.css({
|
||||||
|
'transform': 'rotate('+bearing+'deg)',
|
||||||
|
'-moz-transform': 'rotate('+bearing+'deg)',
|
||||||
|
'-webkit-transform': 'rotate('+bearing+'deg)',
|
||||||
|
}))
|
||||||
|
.append(document.createTextNode(' ' + zeroPad(bearing, 3) + '° ' + bearingWord));
|
||||||
} else {
|
} else {
|
||||||
text = 'Location not set';
|
$('#portal-distance').text('Location not set');
|
||||||
}
|
}
|
||||||
|
|
||||||
var div = $('<div>')
|
|
||||||
.attr({
|
|
||||||
id: 'portal-distance',
|
|
||||||
title: 'Double-click to set/change current location',
|
|
||||||
})
|
|
||||||
.html(text)
|
|
||||||
.on('dblclick', window.plugin.distanceToPortal.setLocation);
|
|
||||||
|
|
||||||
$('#resodetails').after(div);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -90,8 +102,7 @@ window.plugin.distanceToPortal.setLocation = function() {
|
|||||||
|
|
||||||
localStorage['plugin-distance-to-portal'] = JSON.stringify({lat:window.plugin.distanceToPortal.currentLoc.lat, lng:window.plugin.distanceToPortal.currentLoc.lng});
|
localStorage['plugin-distance-to-portal'] = JSON.stringify({lat:window.plugin.distanceToPortal.currentLoc.lat, lng:window.plugin.distanceToPortal.currentLoc.lng});
|
||||||
|
|
||||||
// bit nasty, but easiest way of refreshing the distance after marker is moved
|
if (selectedPortal) window.plugin.distanceToPortal.updateDistance();
|
||||||
if (selectedPortal) renderPortalDetails(selectedPortal);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
map.addLayer(window.plugin.distanceToPortal.currentLocMarker);
|
map.addLayer(window.plugin.distanceToPortal.currentLocMarker);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user