mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
Added working drag, fixed scrolling on drag, fixed cordova example
This commit is contained in:
13
example/cordova/iOS/www/js/framework-events.js
vendored
13
example/cordova/iOS/www/js/framework-events.js
vendored
@ -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 || {});
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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 || {});
|
||||
|
||||
Reference in New Issue
Block a user