Added working drag, fixed scrolling on drag, fixed cordova example

This commit is contained in:
Max Lynch
2013-08-28 07:53:26 -05:00
parent 50460a3247
commit 22fd709e81
15 changed files with 145 additions and 64 deletions

View File

@ -51,6 +51,12 @@
handleClick: function(e) {
var target = e.target;
if(framework.Gestures.HAS_TOUCHEVENTS) {
// We don't allow any clicks on mobile
e.preventDefault();
return false;
}
if (
! target
|| e.which > 1
@ -65,14 +71,11 @@
//|| target.getAttribute('data-ignore') == 'push'
) {
// Allow it
console.log("EVENT: click", e);
return;
}
// We need to cancel this one
e.preventDefault();
// TODO: should we do this?
// e.stopPropagation();
},
handlePopState: function(event) {
@ -89,7 +92,7 @@
framework.offGesture = framework.EventController.offGesture;
// Set up various listeners
window.addEventListener('click', framework.EventController.handleClick);
window.addEventListener('popstate', framework.EventController.handlePopState);
window.addEventListener('click', framework.EventController.handleClick);
//window.addEventListener('popstate', framework.EventController.handlePopState);
})(this, document, FM = this.FM || {});

View File

@ -1176,8 +1176,8 @@
// prevent default browser behavior when dragging occurs
// be careful with it, it makes the element a blocking element
// when you are using the drag gesture, it is a good practice to set this true
drag_block_horizontal : false,
drag_block_vertical : false,
drag_block_horizontal : true,
drag_block_vertical : true,
// drag_lock_to_axis keeps the drag gesture on the axis that it started on,
// It disallows vertical directions if the initial direction was horizontal, and vice versa.
drag_lock_to_axis : false,

View File

@ -6,10 +6,11 @@
isPanelOpen;
function onTap(e) {
var el = e.target;
return togglePanel(e, el, el.dataset.togglePanel);
if(e.target) {
el = e.target;
if(el.dataset.togglePanel) {
return togglePanel(e, el, el.dataset.togglePanel);
}
while(el.parentElement) {
el = el.parentElement;
@ -50,6 +51,6 @@
}
}
framework.on("click", onTap);
framework.onGesture("tap", onTap, document.getElementById('open-panel'));
})(this, document, FM = this.FM || {});