tap-and-hold a portal on a smartphone to switch directly to it (fixes #406)

This commit is contained in:
Stefan Breunig 2013-03-08 10:15:38 +01:00
parent 2fa8ff7f78
commit 3bd60f4df7

View File

@ -49,13 +49,6 @@ window.runOnSmartphonesBeforeBoot = function() {
$('#chatcontrols').append(smartphone.mapButton).append(smartphone.sideButton);
// add event to portals that allows long press to switch to sidebar
window.addHook('portalAdded', function(data) {
data.portal.on('dblclick', function() {
window.lastClickedPortal = this.options.guid;
});
});
window.addHook('portalDetailsUpdated', function(data) {
var x = $('.imgpreview img').removeClass('hide');
@ -87,4 +80,19 @@ window.runOnSmartphonesAfterBoot = function() {
// make buttons in action bar flexible
var l = $('#chatcontrols a:visible');
l.css('width', 100/l.length + '%');
// add event to portals that allows long press to switch to sidebar
window.addHook('portalAdded', function(data) {
data.portal.on('add', function() {
if(!this._container || this.options.addedTapHoldHandler) return;
this.options.addedTapHoldHandler = true;
var guid = this.options.guid;
// this is a hack, accessing Leaflets private _container is evil
$(this._container).on('taphold', function() {
window.renderPortalDetails(guid);
window.smartphone.sideButton.click();
});
});
});
}