mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 16:52:43 +08:00
Merge pull request #146 from pandamicro/0.7
Add touch cancel event to entity
This commit is contained in:
+16
-1
@@ -61,6 +61,13 @@ var EventType = cc.Enum({
|
||||
* @readonly
|
||||
*/
|
||||
TOUCH_END: 'touchend',
|
||||
/**
|
||||
* The event type for touch end event, you can use its value directly: 'touchcancel'
|
||||
* @property TOUCH_CANCEL
|
||||
* @type {String}
|
||||
* @readonly
|
||||
*/
|
||||
TOUCH_CANCEL: 'touchcancel',
|
||||
|
||||
/**
|
||||
* The event type for mouse down events, you can use its value directly: 'mousedown'
|
||||
@@ -103,6 +110,7 @@ var _touchEvents = [
|
||||
EventType.TOUCH_START,
|
||||
EventType.TOUCH_MOVE,
|
||||
EventType.TOUCH_END,
|
||||
EventType.TOUCH_CANCEL,
|
||||
];
|
||||
var _mouseEvents = [
|
||||
EventType.MOUSE_DOWN,
|
||||
@@ -133,8 +141,15 @@ var _touchMoveHandler = function (touch, event) {
|
||||
node.dispatchEvent(event);
|
||||
};
|
||||
var _touchEndHandler = function (touch, event) {
|
||||
var pos = touch.getLocation();
|
||||
var node = this.owner;
|
||||
event.type = EventType.TOUCH_END;
|
||||
|
||||
if (node._hitTest(pos)) {
|
||||
event.type = EventType.TOUCH_END;
|
||||
}
|
||||
else {
|
||||
event.type = EventType.TOUCH_CANCEL;
|
||||
}
|
||||
event.touch = touch;
|
||||
event.bubbles = true;
|
||||
node.dispatchEvent(event);
|
||||
|
||||
@@ -599,21 +599,6 @@ var Component = cc.Class({
|
||||
cc.director.getScheduler().schedule(callback, this, interval, repeat, delay, !this.enabledInHierarchy, key);
|
||||
},
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* schedules the "update" callback function with a custom priority.
|
||||
* This callback function will be called every frame.<br/>
|
||||
* Scheduled callback functions with a lower priority will be called before the ones that have a higher value.<br/>
|
||||
* Only one "update" callback function could be scheduled per node (You can't have 2 'update' callback functions).<br/>
|
||||
* </p>
|
||||
* @method scheduleUpdate
|
||||
* @param {Number} [priority=0] The priority of the update callback
|
||||
*/
|
||||
scheduleUpdate: function (priority) {
|
||||
priority = priority || 0;
|
||||
cc.director.getScheduler().scheduleUpdate(this, priority, !this.enabledInHierarchy);
|
||||
},
|
||||
|
||||
/**
|
||||
* Schedules a callback function that runs only once, with a delay of 0 or larger
|
||||
* @method scheduleOnce
|
||||
@@ -638,15 +623,6 @@ var Component = cc.Class({
|
||||
cc.director.getScheduler().unschedule(callback_fn, this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Unschedules the "update" method.
|
||||
* @method unscheduleUpdate
|
||||
* @see cc.Node#scheduleUpdate
|
||||
*/
|
||||
unscheduleUpdate: function () {
|
||||
cc.director.getScheduler().unscheduleUpdate(this);
|
||||
},
|
||||
|
||||
/**
|
||||
* <p>unschedule all scheduled callback functions: custom callback functions, and the 'update' callback function.<br/>
|
||||
* Actions are not affected by this method.</p>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
var _noCacheRex = /\?/;
|
||||
function urlAppendTimestamp (url) {
|
||||
if (cc.game.config['noCache'] && typeof url === 'string') {
|
||||
|
||||
Reference in New Issue
Block a user