/** * @typedef jibo.face.views~GESTURE * @description Static class with static members that describe possible types of gestures * @prop TAP Gesture type for a single tap * @prop SWIPE_DOWN Gesture type for a swipe down * @prop SWIPE Old name for SWIPE_DOWN * @prop SWIPE_UP Gesture type for a swipe up * @prop PAN Gesture type for a pan. */ /** * Gets singleton instance of TouchManager. * @name jibo.face.views.TouchManager#instance * @type {jibo.face.views.TouchManager} * @readonly */ /** * Instance used for singleton. * @name jibo.face.views.TouchManager._instance * @type {jibo.face.views.TouchManager} * @private */ /** * Threshold of movemnent between gesture types. * @type {number} * @name jibo.face.views.TouchManager.THRESHOLD * @readOnly * @private */ /** * Pixi interaction manager reference. * @type {PIXI.interation.TouchManager} * @name jibo.face.views.TouchManager#_interactionManager * @private */ /** * Reference to canvas element. * @type {Object} * @name jibo.face.views.TouchManager#_canvas * @private */ /** * Reference to GestureManager instance. * @type {jibo.face.GestureManager} * @name jibo.face.views.TouchManager#_gestureManager * @private */ /** * Reference to ViewManager instance. * @type {jibo.face.views} * @name jibo.face.views.TouchManager#_viewManager * @private */ /** * Reference to the tap gesture. * @name jibo.face.views.TouchManager#_tapGesture * @type {HammerJS.Tap} * @private */ /** * Reference to the swipe down gesture. * @name jibo.face.views.TouchManager#_swipeDownGesture * @type {HammerJS.Swipe} * @private */ /** * Reference to the swipe up gesture. * @name jibo.face.views.TouchManager#_swipeUpGesture * @type {HammerJS.Swipe} * @private */ /** * Reference to the pan horizontal gesture. * @name jibo.face.views.TouchManager#_panHorizontalGesture * @type {HammerJS.Pan} * @private */ /** * Object (PIXI.interaction.InteractionEvent) used to pass input position for PIXI hit testing. * @name jibo.face.views.TouchManager#_interactionEvent * @type {any} * @private */ /** * Holds reference to element most recently hit. * @name jibo.face.views.TouchManager#_elementHit * @type {jibo.face.views.Element} * @private */ /** * Flag for whether in simulator or not. * @name jibo.face.views.TouchManager#_isSim * @type {boolean} * @private */ /** * Value holding the latest X coordinate when emulating panning. * @name jibo.face.views.TouchManager#_prevX * @type {Number} * @private */ /** * Value holding the latest Y coordinate when emulating panning. * @name jibo.face.views.TouchManager#_prevY * @type {Number} * @private */ /** * Flag indicating current state of pan emulation. * @name jibo.face.views.TouchManager#_isEmulatingPan * @type {boolean} * @private */ /** * Flag indicating whether user has his finger on the screen * This flag is set only on real Jibo and only by core event listener * @name jibo.face.views.TouchManager#_isMouseDown * @type {boolean} * @private */ /** * Remove gesture by type. * @method jibo.face.views.TouchManager#addGesture * @param {jibo.face.views.GESTURE} [gesture = 'tap'] - type of gesture to remove. * @param {Function} [gestureEventCallback] - For use with Pan gesture, handler called on each pan event. */ /** * Remove gesture by type. * @method jibo.face.views.TouchManager#removeGesture * @param {jibo.face.views.GESTURE} [gesture = 'tap'] - type of gesture to remove. */ /** * Remove all possible TouchManager gestures. * @method jibo.face.views.TouchManager#removeAllGestures */ /** * Create gestures required by Component tree. * NOTE :: Does not create pan gesture, must be created by Component that requires it. * @method jibo.face.views.TouchManager#createRequiredGestures * @param view {jibo.face.views.View} View to create gestures for. */ /** * Destroy. * @method jibo.face.views.TouchManager#destroy */ /** * Add listener for input exiting viewport. * @method jibo.face.views.TouchManager#addViewportOut * @private */ /** * Remove listener for input exiting viewport. * @method jibo.face.views.TouchManager#removeViewportOut * @private */ /** * Create listener for input exiting viewport. * @method jibo.face.views.TouchManager#createViewportOut * @private */ /** * Add listeners that will track core mouse events. * We need them to emulate panning in those cases when user started panning outside of the touch screen. * @method jibo.face.views.TouchManager#addCoreTouchEvents * @private */ /** * Remove listeners for core mouse events. * @method jibo.face.views.TouchManager#removeCoreTouchEvents * @private */ /** * Listener of mouse core events that we might need to determine if user * has started panning outside of the screen * @method jibo.face.views.TouchManager#onCoreTouchEvent * @private */ /** * Set the input coordinates and clear the target. * @method jibo.face.views.TouchManager#resetInput * @param {Number} x - x poisition * @param {Number} y - y position * @private */ /** * Create a gesture for tap. * Refer to HammerJS documentation for Tap values {@link http://hammerjs.github.io/recognizer-tap} * @method jibo.face.views.TouchManager#createTapGesture * @returns {boolean} `true` if a new gesture was created. * @private */ /** * Handler for tap complete event. * @method jibo.face.views.TouchManager#tapHandler * @param gestureEvent {any} * @private */ /** * Find Element within View whose display was tapped. * @param {jibo.face.views.View} currentView - View to check. * @returns {boolean} * @private */ /** * Function required by PIXI processInteractive method, create method to speed up process * @method jibo.face.views.TouchManager#checkElementHit * @param {any} event - PIXI.interactive.InteractionEvent passed from Pixi's hit test * @param {PIXI.DisplayObject} displayObject - dis * @param {boolean} hit - Flag for hit test against display object * @private */ /** * Create a gesture for swipe down. * @method jibo.face.views.TouchManager#createSwipeDownGesture * @returns {boolean} `true` if a new gesture was created. * @private */ /** * Handler for swipe down complete event. * Currently only activates for Views. * @method jibo.face.views.TouchManager#swipeDownHandler * @param gestureEvent {any} * @private */ /** * Create a gesture for swipe up. * @method jibo.face.views.TouchManager#createSwipeUpGesture * @returns {boolean} `true` if a new gesture was created. * @private */ /** * Handler for swipe up complete event. * Currently only activates for Views. * @method jibo.face.views.TouchManager#swipeUpHandler * @param gestureEvent {any} * @private */ /** * Create a gesture for horizontal pan. * @method jibo.face.views.TouchManager#createPanHorizontalGesture * @param {Object} gestureEventCallback * @returns {boolean} `true` if a new gesture was created. * @private */