tap-and-hold a portal on a smartphone to switch directly to it (fixes #406)
This commit is contained in:
parent
2fa8ff7f78
commit
3bd60f4df7
@ -49,13 +49,6 @@ window.runOnSmartphonesBeforeBoot = function() {
|
|||||||
|
|
||||||
$('#chatcontrols').append(smartphone.mapButton).append(smartphone.sideButton);
|
$('#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) {
|
window.addHook('portalDetailsUpdated', function(data) {
|
||||||
var x = $('.imgpreview img').removeClass('hide');
|
var x = $('.imgpreview img').removeClass('hide');
|
||||||
|
|
||||||
@ -87,4 +80,19 @@ window.runOnSmartphonesAfterBoot = function() {
|
|||||||
// make buttons in action bar flexible
|
// make buttons in action bar flexible
|
||||||
var l = $('#chatcontrols a:visible');
|
var l = $('#chatcontrols a:visible');
|
||||||
l.css('width', 100/l.length + '%');
|
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 Leaflet’s private _container is evil
|
||||||
|
$(this._container).on('taphold', function() {
|
||||||
|
window.renderPortalDetails(guid);
|
||||||
|
window.smartphone.sideButton.click();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user