mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
TESTS!!
This commit is contained in:
@ -2,26 +2,26 @@
|
||||
* Simple gesture controllers with some common gestures that emit
|
||||
* gesture events.
|
||||
*
|
||||
* Ported from github.com/EightMedia/ion.Gestures.js - thanks!
|
||||
* Ported from github.com/EightMedia/ionic.Gestures.js - thanks!
|
||||
*/
|
||||
(function(window, document, ion) {
|
||||
(function(window, document, ionic) {
|
||||
|
||||
/**
|
||||
* ion.Gestures
|
||||
* ionic.Gestures
|
||||
* use this to create instances
|
||||
* @param {HTMLElement} element
|
||||
* @param {Object} options
|
||||
* @returns {ion.Gestures.Instance}
|
||||
* @returns {ionic.Gestures.Instance}
|
||||
* @constructor
|
||||
*/
|
||||
ion.Gesture = function(element, options) {
|
||||
return new ion.Gestures.Instance(element, options || {});
|
||||
ionic.Gesture = function(element, options) {
|
||||
return new ionic.Gestures.Instance(element, options || {});
|
||||
};
|
||||
|
||||
ion.Gestures = {};
|
||||
ionic.Gestures = {};
|
||||
|
||||
// default settings
|
||||
ion.Gestures.defaults = {
|
||||
ionic.Gestures.defaults = {
|
||||
// add styles and attributes to the element to prevent the browser from doing
|
||||
// its native behavior. this doesnt prevent the scrolling, but cancels
|
||||
// the contextmenu, tap highlighting etc
|
||||
@ -42,66 +42,66 @@
|
||||
};
|
||||
|
||||
// detect touchevents
|
||||
ion.Gestures.HAS_POINTEREVENTS = window.navigator.pointerEnabled || window.navigator.msPointerEnabled;
|
||||
ion.Gestures.HAS_TOUCHEVENTS = ('ontouchstart' in window);
|
||||
ionic.Gestures.HAS_POINTEREVENTS = window.navigator.pointerEnabled || window.navigator.msPointerEnabled;
|
||||
ionic.Gestures.HAS_TOUCHEVENTS = ('ontouchstart' in window);
|
||||
|
||||
// dont use mouseevents on mobile devices
|
||||
ion.Gestures.MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android|silk/i;
|
||||
ion.Gestures.NO_MOUSEEVENTS = ion.Gestures.HAS_TOUCHEVENTS && window.navigator.userAgent.match(ion.Gestures.MOBILE_REGEX);
|
||||
ionic.Gestures.MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android|silk/i;
|
||||
ionic.Gestures.NO_MOUSEEVENTS = ionic.Gestures.HAS_TOUCHEVENTS && window.navigator.userAgent.match(ionic.Gestures.MOBILE_REGEX);
|
||||
|
||||
// eventtypes per touchevent (start, move, end)
|
||||
// are filled by ion.Gestures.event.determineEventTypes on setup
|
||||
ion.Gestures.EVENT_TYPES = {};
|
||||
// are filled by ionic.Gestures.event.determineEventTypes on setup
|
||||
ionic.Gestures.EVENT_TYPES = {};
|
||||
|
||||
// direction defines
|
||||
ion.Gestures.DIRECTION_DOWN = 'down';
|
||||
ion.Gestures.DIRECTION_LEFT = 'left';
|
||||
ion.Gestures.DIRECTION_UP = 'up';
|
||||
ion.Gestures.DIRECTION_RIGHT = 'right';
|
||||
ionic.Gestures.DIRECTION_DOWN = 'down';
|
||||
ionic.Gestures.DIRECTION_LEFT = 'left';
|
||||
ionic.Gestures.DIRECTION_UP = 'up';
|
||||
ionic.Gestures.DIRECTION_RIGHT = 'right';
|
||||
|
||||
// pointer type
|
||||
ion.Gestures.POINTER_MOUSE = 'mouse';
|
||||
ion.Gestures.POINTER_TOUCH = 'touch';
|
||||
ion.Gestures.POINTER_PEN = 'pen';
|
||||
ionic.Gestures.POINTER_MOUSE = 'mouse';
|
||||
ionic.Gestures.POINTER_TOUCH = 'touch';
|
||||
ionic.Gestures.POINTER_PEN = 'pen';
|
||||
|
||||
// touch event defines
|
||||
ion.Gestures.EVENT_START = 'start';
|
||||
ion.Gestures.EVENT_MOVE = 'move';
|
||||
ion.Gestures.EVENT_END = 'end';
|
||||
ionic.Gestures.EVENT_START = 'start';
|
||||
ionic.Gestures.EVENT_MOVE = 'move';
|
||||
ionic.Gestures.EVENT_END = 'end';
|
||||
|
||||
// hammer document where the base events are added at
|
||||
ion.Gestures.DOCUMENT = window.document;
|
||||
ionic.Gestures.DOCUMENT = window.document;
|
||||
|
||||
// plugins namespace
|
||||
ion.Gestures.plugins = {};
|
||||
ionic.Gestures.plugins = {};
|
||||
|
||||
// if the window events are set...
|
||||
ion.Gestures.READY = false;
|
||||
ionic.Gestures.READY = false;
|
||||
|
||||
/**
|
||||
* setup events to detect gestures on the document
|
||||
*/
|
||||
function setup() {
|
||||
if(ion.Gestures.READY) {
|
||||
if(ionic.Gestures.READY) {
|
||||
return;
|
||||
}
|
||||
|
||||
// find what eventtypes we add listeners to
|
||||
ion.Gestures.event.determineEventTypes();
|
||||
ionic.Gestures.event.determineEventTypes();
|
||||
|
||||
// Register all gestures inside ion.Gestures.gestures
|
||||
for(var name in ion.Gestures.gestures) {
|
||||
if(ion.Gestures.gestures.hasOwnProperty(name)) {
|
||||
ion.Gestures.detection.register(ion.Gestures.gestures[name]);
|
||||
// Register all gestures inside ionic.Gestures.gestures
|
||||
for(var name in ionic.Gestures.gestures) {
|
||||
if(ionic.Gestures.gestures.hasOwnProperty(name)) {
|
||||
ionic.Gestures.detection.register(ionic.Gestures.gestures[name]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add touch events on the document
|
||||
ion.Gestures.event.onTouch(ion.Gestures.DOCUMENT, ion.Gestures.EVENT_MOVE, ion.Gestures.detection.detect);
|
||||
ion.Gestures.event.onTouch(ion.Gestures.DOCUMENT, ion.Gestures.EVENT_END, ion.Gestures.detection.detect);
|
||||
ionic.Gestures.event.onTouch(ionic.Gestures.DOCUMENT, ionic.Gestures.EVENT_MOVE, ionic.Gestures.detection.detect);
|
||||
ionic.Gestures.event.onTouch(ionic.Gestures.DOCUMENT, ionic.Gestures.EVENT_END, ionic.Gestures.detection.detect);
|
||||
|
||||
// ion.Gestures is ready...!
|
||||
ion.Gestures.READY = true;
|
||||
// ionic.Gestures is ready...!
|
||||
ionic.Gestures.READY = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,10 +109,10 @@
|
||||
* all methods should return the instance itself, so it is chainable.
|
||||
* @param {HTMLElement} element
|
||||
* @param {Object} [options={}]
|
||||
* @returns {ion.Gestures.Instance}
|
||||
* @returns {ionic.Gestures.Instance}
|
||||
* @constructor
|
||||
*/
|
||||
ion.Gestures.Instance = function(element, options) {
|
||||
ionic.Gestures.Instance = function(element, options) {
|
||||
var self = this;
|
||||
|
||||
// A null element was passed into the instance, which means
|
||||
@ -123,7 +123,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// setup ion.GesturesJS window events and register all gestures
|
||||
// setup ionic.GesturesJS window events and register all gestures
|
||||
// this also sets up the default options
|
||||
setup();
|
||||
|
||||
@ -133,19 +133,19 @@
|
||||
this.enabled = true;
|
||||
|
||||
// merge options
|
||||
this.options = ion.Gestures.utils.extend(
|
||||
ion.Gestures.utils.extend({}, ion.Gestures.defaults),
|
||||
this.options = ionic.Gestures.utils.extend(
|
||||
ionic.Gestures.utils.extend({}, ionic.Gestures.defaults),
|
||||
options || {});
|
||||
|
||||
// add some css to the element to prevent the browser from doing its native behavoir
|
||||
if(this.options.stop_browser_behavior) {
|
||||
ion.Gestures.utils.stopDefaultBrowserBehavior(this.element, this.options.stop_browser_behavior);
|
||||
ionic.Gestures.utils.stopDefaultBrowserBehavior(this.element, this.options.stop_browser_behavior);
|
||||
}
|
||||
|
||||
// start detection on touchstart
|
||||
ion.Gestures.event.onTouch(element, ion.Gestures.EVENT_START, function(ev) {
|
||||
ionic.Gestures.event.onTouch(element, ionic.Gestures.EVENT_START, function(ev) {
|
||||
if(self.enabled) {
|
||||
ion.Gestures.detection.startDetect(self, ev);
|
||||
ionic.Gestures.detection.startDetect(self, ev);
|
||||
}
|
||||
});
|
||||
|
||||
@ -154,12 +154,12 @@
|
||||
};
|
||||
|
||||
|
||||
ion.Gestures.Instance.prototype = {
|
||||
ionic.Gestures.Instance.prototype = {
|
||||
/**
|
||||
* bind events to the instance
|
||||
* @param {String} gesture
|
||||
* @param {Function} handler
|
||||
* @returns {ion.Gestures.Instance}
|
||||
* @returns {ionic.Gestures.Instance}
|
||||
*/
|
||||
on: function onEvent(gesture, handler){
|
||||
var gestures = gesture.split(' ');
|
||||
@ -174,7 +174,7 @@
|
||||
* unbind events to the instance
|
||||
* @param {String} gesture
|
||||
* @param {Function} handler
|
||||
* @returns {ion.Gestures.Instance}
|
||||
* @returns {ionic.Gestures.Instance}
|
||||
*/
|
||||
off: function offEvent(gesture, handler){
|
||||
var gestures = gesture.split(' ');
|
||||
@ -189,18 +189,18 @@
|
||||
* trigger gesture event
|
||||
* @param {String} gesture
|
||||
* @param {Object} eventData
|
||||
* @returns {ion.Gestures.Instance}
|
||||
* @returns {ionic.Gestures.Instance}
|
||||
*/
|
||||
trigger: function triggerEvent(gesture, eventData){
|
||||
// create DOM event
|
||||
var event = ion.Gestures.DOCUMENT.createEvent('Event');
|
||||
var event = ionic.Gestures.DOCUMENT.createEvent('Event');
|
||||
event.initEvent(gesture, true, true);
|
||||
event.gesture = eventData;
|
||||
|
||||
// trigger on the target if it is in the instance element,
|
||||
// this is for event delegation tricks
|
||||
var element = this.element;
|
||||
if(ion.Gestures.utils.hasParent(eventData.target, element)) {
|
||||
if(ionic.Gestures.utils.hasParent(eventData.target, element)) {
|
||||
element = eventData.target;
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@
|
||||
/**
|
||||
* enable of disable hammer.js detection
|
||||
* @param {Boolean} state
|
||||
* @returns {ion.Gestures.Instance}
|
||||
* @returns {ionic.Gestures.Instance}
|
||||
*/
|
||||
enable: function enable(state) {
|
||||
this.enabled = state;
|
||||
@ -243,7 +243,7 @@
|
||||
var touch_triggered = false;
|
||||
|
||||
|
||||
ion.Gestures.event = {
|
||||
ionic.Gestures.event = {
|
||||
/**
|
||||
* simple addEventListener
|
||||
* @param {HTMLElement} element
|
||||
@ -261,13 +261,13 @@
|
||||
/**
|
||||
* touch events with mouse fallback
|
||||
* @param {HTMLElement} element
|
||||
* @param {String} eventType like ion.Gestures.EVENT_MOVE
|
||||
* @param {String} eventType like ionic.Gestures.EVENT_MOVE
|
||||
* @param {Function} handler
|
||||
*/
|
||||
onTouch: function onTouch(element, eventType, handler) {
|
||||
var self = this;
|
||||
|
||||
this.bindDom(element, ion.Gestures.EVENT_TYPES[eventType], function bindDomOnTouch(ev) {
|
||||
this.bindDom(element, ionic.Gestures.EVENT_TYPES[eventType], function bindDomOnTouch(ev) {
|
||||
var sourceEventType = ev.type.toLowerCase();
|
||||
|
||||
// onmouseup, but when touchend has been fired we do nothing.
|
||||
@ -303,8 +303,8 @@
|
||||
// and we are now handling a mouse event, we stop that to prevent conflicts
|
||||
if(enable_detect) {
|
||||
// update pointerevent
|
||||
if(ion.Gestures.HAS_POINTEREVENTS && eventType != ion.Gestures.EVENT_END) {
|
||||
count_touches = ion.Gestures.PointerEvent.updatePointer(eventType, ev);
|
||||
if(ionic.Gestures.HAS_POINTEREVENTS && eventType != ionic.Gestures.EVENT_END) {
|
||||
count_touches = ionic.Gestures.PointerEvent.updatePointer(eventType, ev);
|
||||
}
|
||||
// touch
|
||||
else if(sourceEventType.match(/touch/)) {
|
||||
@ -317,12 +317,12 @@
|
||||
|
||||
// if we are in a end event, but when we remove one touch and
|
||||
// we still have enough, set eventType to move
|
||||
if(count_touches > 0 && eventType == ion.Gestures.EVENT_END) {
|
||||
eventType = ion.Gestures.EVENT_MOVE;
|
||||
if(count_touches > 0 && eventType == ionic.Gestures.EVENT_END) {
|
||||
eventType = ionic.Gestures.EVENT_MOVE;
|
||||
}
|
||||
// no touches, force the end event
|
||||
else if(!count_touches) {
|
||||
eventType = ion.Gestures.EVENT_END;
|
||||
eventType = ionic.Gestures.EVENT_END;
|
||||
}
|
||||
|
||||
// store the last move event
|
||||
@ -331,11 +331,11 @@
|
||||
}
|
||||
|
||||
// trigger the handler
|
||||
handler.call(ion.Gestures.detection, self.collectEventData(element, eventType, self.getTouchList(last_move_event, eventType), ev));
|
||||
handler.call(ionic.Gestures.detection, self.collectEventData(element, eventType, self.getTouchList(last_move_event, eventType), ev));
|
||||
|
||||
// remove pointerevent from list
|
||||
if(ion.Gestures.HAS_POINTEREVENTS && eventType == ion.Gestures.EVENT_END) {
|
||||
count_touches = ion.Gestures.PointerEvent.updatePointer(eventType, ev);
|
||||
if(ionic.Gestures.HAS_POINTEREVENTS && eventType == ionic.Gestures.EVENT_END) {
|
||||
count_touches = ionic.Gestures.PointerEvent.updatePointer(eventType, ev);
|
||||
}
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@
|
||||
last_move_event = null;
|
||||
enable_detect = false;
|
||||
touch_triggered = false;
|
||||
ion.Gestures.PointerEvent.reset();
|
||||
ionic.Gestures.PointerEvent.reset();
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -354,18 +354,18 @@
|
||||
|
||||
/**
|
||||
* we have different events for each device/browser
|
||||
* determine what we need and set them in the ion.Gestures.EVENT_TYPES constant
|
||||
* determine what we need and set them in the ionic.Gestures.EVENT_TYPES constant
|
||||
*/
|
||||
determineEventTypes: function determineEventTypes() {
|
||||
// determine the eventtype we want to set
|
||||
var types;
|
||||
|
||||
// pointerEvents magic
|
||||
if(ion.Gestures.HAS_POINTEREVENTS) {
|
||||
types = ion.Gestures.PointerEvent.getEvents();
|
||||
if(ionic.Gestures.HAS_POINTEREVENTS) {
|
||||
types = ionic.Gestures.PointerEvent.getEvents();
|
||||
}
|
||||
// on Android, iOS, blackberry, windows mobile we dont want any mouseevents
|
||||
else if(ion.Gestures.NO_MOUSEEVENTS) {
|
||||
else if(ionic.Gestures.NO_MOUSEEVENTS) {
|
||||
types = [
|
||||
'touchstart',
|
||||
'touchmove',
|
||||
@ -380,9 +380,9 @@
|
||||
'touchend touchcancel mouseup'];
|
||||
}
|
||||
|
||||
ion.Gestures.EVENT_TYPES[ion.Gestures.EVENT_START] = types[0];
|
||||
ion.Gestures.EVENT_TYPES[ion.Gestures.EVENT_MOVE] = types[1];
|
||||
ion.Gestures.EVENT_TYPES[ion.Gestures.EVENT_END] = types[2];
|
||||
ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_START] = types[0];
|
||||
ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_MOVE] = types[1];
|
||||
ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_END] = types[2];
|
||||
},
|
||||
|
||||
|
||||
@ -393,8 +393,8 @@
|
||||
*/
|
||||
getTouchList: function getTouchList(ev/*, eventType*/) {
|
||||
// get the fake pointerEvent touchlist
|
||||
if(ion.Gestures.HAS_POINTEREVENTS) {
|
||||
return ion.Gestures.PointerEvent.getTouchList();
|
||||
if(ionic.Gestures.HAS_POINTEREVENTS) {
|
||||
return ionic.Gestures.PointerEvent.getTouchList();
|
||||
}
|
||||
// get the touchlist
|
||||
else if(ev.touches) {
|
||||
@ -409,21 +409,21 @@
|
||||
|
||||
|
||||
/**
|
||||
* collect event data for ion.Gestures js
|
||||
* collect event data for ionic.Gestures js
|
||||
* @param {HTMLElement} element
|
||||
* @param {String} eventType like ion.Gestures.EVENT_MOVE
|
||||
* @param {String} eventType like ionic.Gestures.EVENT_MOVE
|
||||
* @param {Object} eventData
|
||||
*/
|
||||
collectEventData: function collectEventData(element, eventType, touches, ev) {
|
||||
|
||||
// find out pointerType
|
||||
var pointerType = ion.Gestures.POINTER_TOUCH;
|
||||
if(ev.type.match(/mouse/) || ion.Gestures.PointerEvent.matchType(ion.Gestures.POINTER_MOUSE, ev)) {
|
||||
pointerType = ion.Gestures.POINTER_MOUSE;
|
||||
var pointerType = ionic.Gestures.POINTER_TOUCH;
|
||||
if(ev.type.match(/mouse/) || ionic.Gestures.PointerEvent.matchType(ionic.Gestures.POINTER_MOUSE, ev)) {
|
||||
pointerType = ionic.Gestures.POINTER_MOUSE;
|
||||
}
|
||||
|
||||
return {
|
||||
center : ion.Gestures.utils.getCenter(touches),
|
||||
center : ionic.Gestures.utils.getCenter(touches),
|
||||
timeStamp : new Date().getTime(),
|
||||
target : ev.target,
|
||||
touches : touches,
|
||||
@ -458,13 +458,13 @@
|
||||
* @return {*}
|
||||
*/
|
||||
stopDetect: function() {
|
||||
return ion.Gestures.detection.stopDetect();
|
||||
return ionic.Gestures.detection.stopDetect();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ion.Gestures.PointerEvent = {
|
||||
ionic.Gestures.PointerEvent = {
|
||||
/**
|
||||
* holds all pointers
|
||||
* @type {Object}
|
||||
@ -488,11 +488,11 @@
|
||||
|
||||
/**
|
||||
* update the position of a pointer
|
||||
* @param {String} type ion.Gestures.EVENT_END
|
||||
* @param {String} type ionic.Gestures.EVENT_END
|
||||
* @param {Object} pointerEvent
|
||||
*/
|
||||
updatePointer: function(type, pointerEvent) {
|
||||
if(type == ion.Gestures.EVENT_END) {
|
||||
if(type == ionic.Gestures.EVENT_END) {
|
||||
this.pointers = {};
|
||||
}
|
||||
else {
|
||||
@ -505,7 +505,7 @@
|
||||
|
||||
/**
|
||||
* check if ev matches pointertype
|
||||
* @param {String} pointerType ion.Gestures.POINTER_MOUSE
|
||||
* @param {String} pointerType ionic.Gestures.POINTER_MOUSE
|
||||
* @param {PointerEvent} ev
|
||||
*/
|
||||
matchType: function(pointerType, ev) {
|
||||
@ -514,9 +514,9 @@
|
||||
}
|
||||
|
||||
var types = {};
|
||||
types[ion.Gestures.POINTER_MOUSE] = (ev.pointerType == ev.MSPOINTER_TYPE_MOUSE || ev.pointerType == ion.Gestures.POINTER_MOUSE);
|
||||
types[ion.Gestures.POINTER_TOUCH] = (ev.pointerType == ev.MSPOINTER_TYPE_TOUCH || ev.pointerType == ion.Gestures.POINTER_TOUCH);
|
||||
types[ion.Gestures.POINTER_PEN] = (ev.pointerType == ev.MSPOINTER_TYPE_PEN || ev.pointerType == ion.Gestures.POINTER_PEN);
|
||||
types[ionic.Gestures.POINTER_MOUSE] = (ev.pointerType == ev.MSPOINTER_TYPE_MOUSE || ev.pointerType == ionic.Gestures.POINTER_MOUSE);
|
||||
types[ionic.Gestures.POINTER_TOUCH] = (ev.pointerType == ev.MSPOINTER_TYPE_TOUCH || ev.pointerType == ionic.Gestures.POINTER_TOUCH);
|
||||
types[ionic.Gestures.POINTER_PEN] = (ev.pointerType == ev.MSPOINTER_TYPE_PEN || ev.pointerType == ionic.Gestures.POINTER_PEN);
|
||||
return types[pointerType];
|
||||
},
|
||||
|
||||
@ -541,7 +541,7 @@
|
||||
};
|
||||
|
||||
|
||||
ion.Gestures.utils = {
|
||||
ionic.Gestures.utils = {
|
||||
/**
|
||||
* extend method,
|
||||
* also used for cloning when dest is an empty object
|
||||
@ -631,17 +631,17 @@
|
||||
* angle to direction define
|
||||
* @param {Touch} touch1
|
||||
* @param {Touch} touch2
|
||||
* @returns {String} direction constant, like ion.Gestures.DIRECTION_LEFT
|
||||
* @returns {String} direction constant, like ionic.Gestures.DIRECTION_LEFT
|
||||
*/
|
||||
getDirection: function getDirection(touch1, touch2) {
|
||||
var x = Math.abs(touch1.pageX - touch2.pageX),
|
||||
y = Math.abs(touch1.pageY - touch2.pageY);
|
||||
|
||||
if(x >= y) {
|
||||
return touch1.pageX - touch2.pageX > 0 ? ion.Gestures.DIRECTION_LEFT : ion.Gestures.DIRECTION_RIGHT;
|
||||
return touch1.pageX - touch2.pageX > 0 ? ionic.Gestures.DIRECTION_LEFT : ionic.Gestures.DIRECTION_RIGHT;
|
||||
}
|
||||
else {
|
||||
return touch1.pageY - touch2.pageY > 0 ? ion.Gestures.DIRECTION_UP : ion.Gestures.DIRECTION_DOWN;
|
||||
return touch1.pageY - touch2.pageY > 0 ? ionic.Gestures.DIRECTION_UP : ionic.Gestures.DIRECTION_DOWN;
|
||||
}
|
||||
},
|
||||
|
||||
@ -698,7 +698,7 @@
|
||||
* @returns {Boolean} is_vertical
|
||||
*/
|
||||
isVertical: function isVertical(direction) {
|
||||
return (direction == ion.Gestures.DIRECTION_UP || direction == ion.Gestures.DIRECTION_DOWN);
|
||||
return (direction == ionic.Gestures.DIRECTION_UP || direction == ionic.Gestures.DIRECTION_DOWN);
|
||||
},
|
||||
|
||||
|
||||
@ -742,14 +742,14 @@
|
||||
};
|
||||
|
||||
|
||||
ion.Gestures.detection = {
|
||||
// contains all registred ion.Gestures.gestures in the correct order
|
||||
ionic.Gestures.detection = {
|
||||
// contains all registred ionic.Gestures.gestures in the correct order
|
||||
gestures: [],
|
||||
|
||||
// data of the current ion.Gestures.gesture detection session
|
||||
// data of the current ionic.Gestures.gesture detection session
|
||||
current: null,
|
||||
|
||||
// the previous ion.Gestures.gesture session data
|
||||
// the previous ionic.Gestures.gesture session data
|
||||
// is a full clone of the previous gesture.current object
|
||||
previous: null,
|
||||
|
||||
@ -758,12 +758,12 @@
|
||||
|
||||
|
||||
/**
|
||||
* start ion.Gestures.gesture detection
|
||||
* @param {ion.Gestures.Instance} inst
|
||||
* start ionic.Gestures.gesture detection
|
||||
* @param {ionic.Gestures.Instance} inst
|
||||
* @param {Object} eventData
|
||||
*/
|
||||
startDetect: function startDetect(inst, eventData) {
|
||||
// already busy with a ion.Gestures.gesture detection on an element
|
||||
// already busy with a ionic.Gestures.gesture detection on an element
|
||||
if(this.current) {
|
||||
return;
|
||||
}
|
||||
@ -771,8 +771,8 @@
|
||||
this.stopped = false;
|
||||
|
||||
this.current = {
|
||||
inst : inst, // reference to ion.GesturesInstance we're working for
|
||||
startEvent : ion.Gestures.utils.extend({}, eventData), // start eventData for distances, timing etc
|
||||
inst : inst, // reference to ionic.GesturesInstance we're working for
|
||||
startEvent : ionic.Gestures.utils.extend({}, eventData), // start eventData for distances, timing etc
|
||||
lastEvent : false, // last eventData
|
||||
name : '' // current gesture we're in/detected, can be 'tap', 'hold' etc
|
||||
};
|
||||
@ -782,7 +782,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* ion.Gestures.gesture detection
|
||||
* ionic.Gestures.gesture detection
|
||||
* @param {Object} eventData
|
||||
*/
|
||||
detect: function detect(eventData) {
|
||||
@ -796,7 +796,7 @@
|
||||
// instance options
|
||||
var inst_options = this.current.inst.options;
|
||||
|
||||
// call ion.Gestures.gesture handlers
|
||||
// call ionic.Gestures.gesture handlers
|
||||
for(var g=0,len=this.gestures.length; g<len; g++) {
|
||||
var gesture = this.gestures[g];
|
||||
|
||||
@ -816,7 +816,7 @@
|
||||
}
|
||||
|
||||
// endevent, but not the last touch, so dont stop
|
||||
if(eventData.eventType == ion.Gestures.EVENT_END && !eventData.touches.length-1) {
|
||||
if(eventData.eventType == ionic.Gestures.EVENT_END && !eventData.touches.length-1) {
|
||||
this.stopDetect();
|
||||
}
|
||||
|
||||
@ -825,14 +825,14 @@
|
||||
|
||||
|
||||
/**
|
||||
* clear the ion.Gestures.gesture vars
|
||||
* this is called on endDetect, but can also be used when a final ion.Gestures.gesture has been detected
|
||||
* to stop other ion.Gestures.gestures from being fired
|
||||
* clear the ionic.Gestures.gesture vars
|
||||
* this is called on endDetect, but can also be used when a final ionic.Gestures.gesture has been detected
|
||||
* to stop other ionic.Gestures.gestures from being fired
|
||||
*/
|
||||
stopDetect: function stopDetect() {
|
||||
// clone current data to the store as the previous gesture
|
||||
// used for the double tap gesture, since this is an other gesture detect session
|
||||
this.previous = ion.Gestures.utils.extend({}, this.current);
|
||||
this.previous = ionic.Gestures.utils.extend({}, this.current);
|
||||
|
||||
// reset the current
|
||||
this.current = null;
|
||||
@ -843,7 +843,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* extend eventData for ion.Gestures.gestures
|
||||
* extend eventData for ionic.Gestures.gestures
|
||||
* @param {Object} ev
|
||||
* @returns {Object} ev
|
||||
*/
|
||||
@ -858,16 +858,16 @@
|
||||
// extend 1 level deep to get the touchlist with the touch objects
|
||||
startEv.touches = [];
|
||||
for(var i=0,len=ev.touches.length; i<len; i++) {
|
||||
startEv.touches.push(ion.Gestures.utils.extend({}, ev.touches[i]));
|
||||
startEv.touches.push(ionic.Gestures.utils.extend({}, ev.touches[i]));
|
||||
}
|
||||
}
|
||||
|
||||
var delta_time = ev.timeStamp - startEv.timeStamp,
|
||||
delta_x = ev.center.pageX - startEv.center.pageX,
|
||||
delta_y = ev.center.pageY - startEv.center.pageY,
|
||||
velocity = ion.Gestures.utils.getVelocity(delta_time, delta_x, delta_y);
|
||||
velocity = ionic.Gestures.utils.getVelocity(delta_time, delta_x, delta_y);
|
||||
|
||||
ion.Gestures.utils.extend(ev, {
|
||||
ionic.Gestures.utils.extend(ev, {
|
||||
deltaTime : delta_time,
|
||||
|
||||
deltaX : delta_x,
|
||||
@ -876,12 +876,12 @@
|
||||
velocityX : velocity.x,
|
||||
velocityY : velocity.y,
|
||||
|
||||
distance : ion.Gestures.utils.getDistance(startEv.center, ev.center),
|
||||
angle : ion.Gestures.utils.getAngle(startEv.center, ev.center),
|
||||
direction : ion.Gestures.utils.getDirection(startEv.center, ev.center),
|
||||
distance : ionic.Gestures.utils.getDistance(startEv.center, ev.center),
|
||||
angle : ionic.Gestures.utils.getAngle(startEv.center, ev.center),
|
||||
direction : ionic.Gestures.utils.getDirection(startEv.center, ev.center),
|
||||
|
||||
scale : ion.Gestures.utils.getScale(startEv.touches, ev.touches),
|
||||
rotation : ion.Gestures.utils.getRotation(startEv.touches, ev.touches),
|
||||
scale : ionic.Gestures.utils.getScale(startEv.touches, ev.touches),
|
||||
rotation : ionic.Gestures.utils.getRotation(startEv.touches, ev.touches),
|
||||
|
||||
startEvent : startEv
|
||||
});
|
||||
@ -902,13 +902,13 @@
|
||||
options[gesture.name] = true;
|
||||
}
|
||||
|
||||
// extend ion.Gestures default options with the ion.Gestures.gesture options
|
||||
ion.Gestures.utils.extend(ion.Gestures.defaults, options, true);
|
||||
// extend ionic.Gestures default options with the ionic.Gestures.gesture options
|
||||
ionic.Gestures.utils.extend(ionic.Gestures.defaults, options, true);
|
||||
|
||||
// set its index
|
||||
gesture.index = gesture.index || 1000;
|
||||
|
||||
// add ion.Gestures.gesture to the list
|
||||
// add ionic.Gestures.gesture to the list
|
||||
this.gestures.push(gesture);
|
||||
|
||||
// sort the list by index
|
||||
@ -927,7 +927,7 @@
|
||||
};
|
||||
|
||||
|
||||
ion.Gestures.gestures = ion.Gestures.gestures || {};
|
||||
ionic.Gestures.gestures = ionic.Gestures.gestures || {};
|
||||
|
||||
/**
|
||||
* Custom gestures
|
||||
@ -971,7 +971,7 @@
|
||||
* timeStamp {Number} time the event occurred
|
||||
* target {HTMLElement} target element
|
||||
* touches {Array} touches (fingers, pointers, mouse) on the screen
|
||||
* pointerType {String} kind of pointer that was used. matches ion.Gestures.POINTER_MOUSE|TOUCH
|
||||
* pointerType {String} kind of pointer that was used. matches ionic.Gestures.POINTER_MOUSE|TOUCH
|
||||
* center {Object} center position of the touches. contains pageX and pageY
|
||||
* deltaTime {Number} the total time of the touches in the screen
|
||||
* deltaX {Number} the delta on x axis we haved moved
|
||||
@ -979,46 +979,46 @@
|
||||
* velocityX {Number} the velocity on the x
|
||||
* velocityY {Number} the velocity on y
|
||||
* angle {Number} the angle we are moving
|
||||
* direction {String} the direction we are moving. matches ion.Gestures.DIRECTION_UP|DOWN|LEFT|RIGHT
|
||||
* direction {String} the direction we are moving. matches ionic.Gestures.DIRECTION_UP|DOWN|LEFT|RIGHT
|
||||
* distance {Number} the distance we haved moved
|
||||
* scale {Number} scaling of the touches, needs 2 touches
|
||||
* rotation {Number} rotation of the touches, needs 2 touches *
|
||||
* eventType {String} matches ion.Gestures.EVENT_START|MOVE|END
|
||||
* eventType {String} matches ionic.Gestures.EVENT_START|MOVE|END
|
||||
* srcEvent {Object} the source event, like TouchStart or MouseDown *
|
||||
* startEvent {Object} contains the same properties as above,
|
||||
* but from the first touch. this is used to calculate
|
||||
* distances, deltaTime, scaling etc
|
||||
*
|
||||
* @param {ion.Gestures.Instance} inst
|
||||
* @param {ionic.Gestures.Instance} inst
|
||||
* the instance we are doing the detection for. you can get the options from
|
||||
* the inst.options object and trigger the gesture event by calling inst.trigger
|
||||
*
|
||||
*
|
||||
* Handle gestures
|
||||
* --------------------
|
||||
* inside the handler you can get/set ion.Gestures.detection.current. This is the current
|
||||
* detection session. It has the following properties
|
||||
* inside the handler you can get/set ionic.Gestures.detectionic.current. This is the current
|
||||
* detection sessionic. It has the following properties
|
||||
* @param {String} name
|
||||
* contains the name of the gesture we have detected. it has not a real function,
|
||||
* only to check in other gestures if something is detected.
|
||||
* like in the drag gesture we set it to 'drag' and in the swipe gesture we can
|
||||
* check if the current gesture is 'drag' by accessing ion.Gestures.detection.current.name
|
||||
* check if the current gesture is 'drag' by accessing ionic.Gestures.detectionic.current.name
|
||||
*
|
||||
* @readonly
|
||||
* @param {ion.Gestures.Instance} inst
|
||||
* @param {ionic.Gestures.Instance} inst
|
||||
* the instance we do the detection for
|
||||
*
|
||||
* @readonly
|
||||
* @param {Object} startEvent
|
||||
* contains the properties of the first gesture detection in this session.
|
||||
* contains the properties of the first gesture detection in this sessionic.
|
||||
* Used for calculations about timing, distance, etc.
|
||||
*
|
||||
* @readonly
|
||||
* @param {Object} lastEvent
|
||||
* contains all the properties of the last gesture detect in this session.
|
||||
* contains all the properties of the last gesture detect in this sessionic.
|
||||
*
|
||||
* after the gesture detection session has been completed (user has released the screen)
|
||||
* the ion.Gestures.detection.current object is copied into ion.Gestures.detection.previous,
|
||||
* the ionic.Gestures.detectionic.current object is copied into ionic.Gestures.detectionic.previous,
|
||||
* this is usefull for gestures like doubletap, where you need to know if the
|
||||
* previous gesture was a tap
|
||||
*
|
||||
@ -1030,8 +1030,8 @@
|
||||
*
|
||||
* Register gestures
|
||||
* --------------------
|
||||
* When an gesture is added to the ion.Gestures.gestures object, it is auto registered
|
||||
* at the setup of the first ion.Gestures instance. You can also call ion.Gestures.detection.register
|
||||
* When an gesture is added to the ionic.Gestures.gestures object, it is auto registered
|
||||
* at the setup of the first ionic.Gestures instance. You can also call ionic.Gestures.detectionic.register
|
||||
* manually and pass your gesture object as a param
|
||||
*
|
||||
*/
|
||||
@ -1041,7 +1041,7 @@
|
||||
* Touch stays at the same place for x time
|
||||
* @events hold
|
||||
*/
|
||||
ion.Gestures.gestures.Hold = {
|
||||
ionic.Gestures.gestures.Hold = {
|
||||
name: 'hold',
|
||||
index: 10,
|
||||
defaults: {
|
||||
@ -1051,30 +1051,30 @@
|
||||
timer: null,
|
||||
handler: function holdGesture(ev, inst) {
|
||||
switch(ev.eventType) {
|
||||
case ion.Gestures.EVENT_START:
|
||||
case ionic.Gestures.EVENT_START:
|
||||
// clear any running timers
|
||||
clearTimeout(this.timer);
|
||||
|
||||
// set the gesture so we can check in the timeout if it still is
|
||||
ion.Gestures.detection.current.name = this.name;
|
||||
ionic.Gestures.detection.current.name = this.name;
|
||||
|
||||
// set timer and if after the timeout it still is hold,
|
||||
// we trigger the hold event
|
||||
this.timer = setTimeout(function() {
|
||||
if(ion.Gestures.detection.current.name == 'hold') {
|
||||
if(ionic.Gestures.detection.current.name == 'hold') {
|
||||
inst.trigger('hold', ev);
|
||||
}
|
||||
}, inst.options.hold_timeout);
|
||||
break;
|
||||
|
||||
// when you move or end we clear the timer
|
||||
case ion.Gestures.EVENT_MOVE:
|
||||
case ionic.Gestures.EVENT_MOVE:
|
||||
if(ev.distance > inst.options.hold_threshold) {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
break;
|
||||
|
||||
case ion.Gestures.EVENT_END:
|
||||
case ionic.Gestures.EVENT_END:
|
||||
clearTimeout(this.timer);
|
||||
break;
|
||||
}
|
||||
@ -1087,7 +1087,7 @@
|
||||
* Quick touch at a place or double at the same place
|
||||
* @events tap, doubletap
|
||||
*/
|
||||
ion.Gestures.gestures.Tap = {
|
||||
ionic.Gestures.gestures.Tap = {
|
||||
name: 'tap',
|
||||
index: 100,
|
||||
defaults: {
|
||||
@ -1098,9 +1098,9 @@
|
||||
doubletap_interval : 300
|
||||
},
|
||||
handler: function tapGesture(ev, inst) {
|
||||
if(ev.eventType == ion.Gestures.EVENT_END) {
|
||||
if(ev.eventType == ionic.Gestures.EVENT_END) {
|
||||
// previous gesture, for the double tap since these are two different gesture detections
|
||||
var prev = ion.Gestures.detection.previous,
|
||||
var prev = ionic.Gestures.detection.previous,
|
||||
did_doubletap = false;
|
||||
|
||||
// when the touchtime is higher then the max touch time
|
||||
@ -1120,8 +1120,8 @@
|
||||
|
||||
// do a single tap
|
||||
if(!did_doubletap || inst.options.tap_always) {
|
||||
ion.Gestures.detection.current.name = 'tap';
|
||||
inst.trigger(ion.Gestures.detection.current.name, ev);
|
||||
ionic.Gestures.detection.current.name = 'tap';
|
||||
inst.trigger(ionic.Gestures.detection.current.name, ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1133,7 +1133,7 @@
|
||||
* triggers swipe events when the end velocity is above the threshold
|
||||
* @events swipe, swipeleft, swiperight, swipeup, swipedown
|
||||
*/
|
||||
ion.Gestures.gestures.Swipe = {
|
||||
ionic.Gestures.gestures.Swipe = {
|
||||
name: 'swipe',
|
||||
index: 40,
|
||||
defaults: {
|
||||
@ -1142,7 +1142,7 @@
|
||||
swipe_velocity : 0.7
|
||||
},
|
||||
handler: function swipeGesture(ev, inst) {
|
||||
if(ev.eventType == ion.Gestures.EVENT_END) {
|
||||
if(ev.eventType == ionic.Gestures.EVENT_END) {
|
||||
// max touches
|
||||
if(inst.options.swipe_max_touches > 0 &&
|
||||
ev.touches.length > inst.options.swipe_max_touches) {
|
||||
@ -1169,7 +1169,7 @@
|
||||
* you disable scrolling on that area.
|
||||
* @events drag, drapleft, dragright, dragup, dragdown
|
||||
*/
|
||||
ion.Gestures.gestures.Drag = {
|
||||
ionic.Gestures.gestures.Drag = {
|
||||
name: 'drag',
|
||||
index: 50,
|
||||
defaults: {
|
||||
@ -1197,7 +1197,7 @@
|
||||
handler: function dragGesture(ev, inst) {
|
||||
// current gesture isnt drag, but dragged is true
|
||||
// this means an other gesture is busy. now call dragend
|
||||
if(ion.Gestures.detection.current.name != this.name && this.triggered) {
|
||||
if(ionic.Gestures.detection.current.name != this.name && this.triggered) {
|
||||
inst.trigger(this.name +'end', ev);
|
||||
this.triggered = false;
|
||||
return;
|
||||
@ -1210,46 +1210,46 @@
|
||||
}
|
||||
|
||||
switch(ev.eventType) {
|
||||
case ion.Gestures.EVENT_START:
|
||||
case ionic.Gestures.EVENT_START:
|
||||
this.triggered = false;
|
||||
break;
|
||||
|
||||
case ion.Gestures.EVENT_MOVE:
|
||||
case ionic.Gestures.EVENT_MOVE:
|
||||
// when the distance we moved is too small we skip this gesture
|
||||
// or we can be already in dragging
|
||||
if(ev.distance < inst.options.drag_min_distance &&
|
||||
ion.Gestures.detection.current.name != this.name) {
|
||||
ionic.Gestures.detection.current.name != this.name) {
|
||||
return;
|
||||
}
|
||||
|
||||
// we are dragging!
|
||||
if(ion.Gestures.detection.current.name != this.name) {
|
||||
ion.Gestures.detection.current.name = this.name;
|
||||
if(ionic.Gestures.detection.current.name != this.name) {
|
||||
ionic.Gestures.detection.current.name = this.name;
|
||||
if (inst.options.correct_for_drag_min_distance) {
|
||||
// When a drag is triggered, set the event center to drag_min_distance pixels from the original event center.
|
||||
// Without this correction, the dragged distance would jumpstart at drag_min_distance pixels instead of at 0.
|
||||
// It might be useful to save the original start point somewhere
|
||||
var factor = Math.abs(inst.options.drag_min_distance/ev.distance);
|
||||
ion.Gestures.detection.current.startEvent.center.pageX += ev.deltaX * factor;
|
||||
ion.Gestures.detection.current.startEvent.center.pageY += ev.deltaY * factor;
|
||||
ionic.Gestures.detection.current.startEvent.center.pageX += ev.deltaX * factor;
|
||||
ionic.Gestures.detection.current.startEvent.center.pageY += ev.deltaY * factor;
|
||||
|
||||
// recalculate event data using new start point
|
||||
ev = ion.Gestures.detection.extendEventData(ev);
|
||||
ev = ionic.Gestures.detection.extendEventData(ev);
|
||||
}
|
||||
}
|
||||
|
||||
// lock drag to axis?
|
||||
if(ion.Gestures.detection.current.lastEvent.drag_locked_to_axis || (inst.options.drag_lock_to_axis && inst.options.drag_lock_min_distance<=ev.distance)) {
|
||||
if(ionic.Gestures.detection.current.lastEvent.drag_locked_to_axis || (inst.options.drag_lock_to_axis && inst.options.drag_lock_min_distance<=ev.distance)) {
|
||||
ev.drag_locked_to_axis = true;
|
||||
}
|
||||
var last_direction = ion.Gestures.detection.current.lastEvent.direction;
|
||||
var last_direction = ionic.Gestures.detection.current.lastEvent.direction;
|
||||
if(ev.drag_locked_to_axis && last_direction !== ev.direction) {
|
||||
// keep direction on the axis that the drag gesture started on
|
||||
if(ion.Gestures.utils.isVertical(last_direction)) {
|
||||
ev.direction = (ev.deltaY < 0) ? ion.Gestures.DIRECTION_UP : ion.Gestures.DIRECTION_DOWN;
|
||||
if(ionic.Gestures.utils.isVertical(last_direction)) {
|
||||
ev.direction = (ev.deltaY < 0) ? ionic.Gestures.DIRECTION_UP : ionic.Gestures.DIRECTION_DOWN;
|
||||
}
|
||||
else {
|
||||
ev.direction = (ev.deltaX < 0) ? ion.Gestures.DIRECTION_LEFT : ion.Gestures.DIRECTION_RIGHT;
|
||||
ev.direction = (ev.deltaX < 0) ? ionic.Gestures.DIRECTION_LEFT : ionic.Gestures.DIRECTION_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1266,13 +1266,13 @@
|
||||
inst.trigger(this.name + ev.direction, ev);
|
||||
|
||||
// block the browser events
|
||||
if( (inst.options.drag_block_vertical && ion.Gestures.utils.isVertical(ev.direction)) ||
|
||||
(inst.options.drag_block_horizontal && !ion.Gestures.utils.isVertical(ev.direction))) {
|
||||
if( (inst.options.drag_block_vertical && ionic.Gestures.utils.isVertical(ev.direction)) ||
|
||||
(inst.options.drag_block_horizontal && !ionic.Gestures.utils.isVertical(ev.direction))) {
|
||||
ev.preventDefault();
|
||||
}
|
||||
break;
|
||||
|
||||
case ion.Gestures.EVENT_END:
|
||||
case ionic.Gestures.EVENT_END:
|
||||
// trigger dragend
|
||||
if(this.triggered) {
|
||||
inst.trigger(this.name +'end', ev);
|
||||
@ -1290,7 +1290,7 @@
|
||||
* User want to scale or rotate with 2 fingers
|
||||
* @events transform, pinch, pinchin, pinchout, rotate
|
||||
*/
|
||||
ion.Gestures.gestures.Transform = {
|
||||
ionic.Gestures.gestures.Transform = {
|
||||
name: 'transform',
|
||||
index: 45,
|
||||
defaults: {
|
||||
@ -1307,7 +1307,7 @@
|
||||
handler: function transformGesture(ev, inst) {
|
||||
// current gesture isnt drag, but dragged is true
|
||||
// this means an other gesture is busy. now call dragend
|
||||
if(ion.Gestures.detection.current.name != this.name && this.triggered) {
|
||||
if(ionic.Gestures.detection.current.name != this.name && this.triggered) {
|
||||
inst.trigger(this.name +'end', ev);
|
||||
this.triggered = false;
|
||||
return;
|
||||
@ -1324,11 +1324,11 @@
|
||||
}
|
||||
|
||||
switch(ev.eventType) {
|
||||
case ion.Gestures.EVENT_START:
|
||||
case ionic.Gestures.EVENT_START:
|
||||
this.triggered = false;
|
||||
break;
|
||||
|
||||
case ion.Gestures.EVENT_MOVE:
|
||||
case ionic.Gestures.EVENT_MOVE:
|
||||
var scale_threshold = Math.abs(1-ev.scale);
|
||||
var rotation_threshold = Math.abs(ev.rotation);
|
||||
|
||||
@ -1340,7 +1340,7 @@
|
||||
}
|
||||
|
||||
// we are transforming!
|
||||
ion.Gestures.detection.current.name = this.name;
|
||||
ionic.Gestures.detection.current.name = this.name;
|
||||
|
||||
// first time, trigger dragstart event
|
||||
if(!this.triggered) {
|
||||
@ -1362,7 +1362,7 @@
|
||||
}
|
||||
break;
|
||||
|
||||
case ion.Gestures.EVENT_END:
|
||||
case ionic.Gestures.EVENT_END:
|
||||
// trigger dragend
|
||||
if(this.triggered) {
|
||||
inst.trigger(this.name +'end', ev);
|
||||
@ -1380,7 +1380,7 @@
|
||||
* Called as first, tells the user has touched the screen
|
||||
* @events touch
|
||||
*/
|
||||
ion.Gestures.gestures.Touch = {
|
||||
ionic.Gestures.gestures.Touch = {
|
||||
name: 'touch',
|
||||
index: -Infinity,
|
||||
defaults: {
|
||||
@ -1395,7 +1395,7 @@
|
||||
prevent_mouseevents: false
|
||||
},
|
||||
handler: function touchGesture(ev, inst) {
|
||||
if(inst.options.prevent_mouseevents && ev.pointerType == ion.Gestures.POINTER_MOUSE) {
|
||||
if(inst.options.prevent_mouseevents && ev.pointerType == ionic.Gestures.POINTER_MOUSE) {
|
||||
ev.stopDetect();
|
||||
return;
|
||||
}
|
||||
@ -1404,7 +1404,7 @@
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
||||
if(ev.eventType == ion.Gestures.EVENT_START) {
|
||||
if(ev.eventType == ionic.Gestures.EVENT_START) {
|
||||
inst.trigger(this.name, ev);
|
||||
}
|
||||
}
|
||||
@ -1416,13 +1416,13 @@
|
||||
* Called as last, tells the user has released the screen
|
||||
* @events release
|
||||
*/
|
||||
ion.Gestures.gestures.Release = {
|
||||
ionic.Gestures.gestures.Release = {
|
||||
name: 'release',
|
||||
index: Infinity,
|
||||
handler: function releaseGesture(ev, inst) {
|
||||
if(ev.eventType == ion.Gestures.EVENT_END) {
|
||||
if(ev.eventType == ionic.Gestures.EVENT_END) {
|
||||
inst.trigger(this.name, ev);
|
||||
}
|
||||
}
|
||||
};
|
||||
})(this, document, ion = this.ion || {});
|
||||
})(this, document, ionic = this.ionic || {});
|
||||
|
||||
Reference in New Issue
Block a user