first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,187 @@
YUI.add('event-touch', function (Y, NAME) {
/**
Adds touch event facade normalization properties (touches, changedTouches, targetTouches etc.) to the DOM event facade. Adds
touch events to the DOM events whitelist.
@example
YUI().use('event-touch', function (Y) {
Y.one('#myDiv').on('touchstart', function(e) {
...
});
});
@module event
@submodule event-touch
*/
var SCALE = "scale",
ROTATION = "rotation",
IDENTIFIER = "identifier",
win = Y.config.win,
GESTURE_MAP = {};
/**
* Adds touch event facade normalization properties to the DOM event facade
*
* @method _touch
* @for DOMEventFacade
* @private
* @param ev {Event} the DOM event
* @param currentTarget {HTMLElement} the element the listener was attached to
* @param wrapper {CustomEvent} the custom event wrapper for this DOM event
*/
Y.DOMEventFacade.prototype._touch = function(e, currentTarget, wrapper) {
var i,l, etCached, et,touchCache;
Y.log("Calling facade._touch() with e = " + e, "debug", "event-touch");
if (e.touches) {
Y.log("Found e.touches. Replicating on facade", "info", "event-touch");
/**
* Array of individual touch events for touch points that are still in
* contact with the touch surface.
*
* @property touches
* @type {DOMEventFacade[]}
*/
this.touches = [];
touchCache = {};
for (i = 0, l = e.touches.length; i < l; ++i) {
et = e.touches[i];
touchCache[Y.stamp(et)] = this.touches[i] = new Y.DOMEventFacade(et, currentTarget, wrapper);
}
}
if (e.targetTouches) {
Y.log("Found e.targetTouches. Replicating on facade", "info", "event-touch");
/**
* Array of individual touch events still in contact with the touch
* surface and whose `touchstart` event occurred inside the same taregt
* element as the current target element.
*
* @property targetTouches
* @type {DOMEventFacade[]}
*/
this.targetTouches = [];
for (i = 0, l = e.targetTouches.length; i < l; ++i) {
et = e.targetTouches[i];
etCached = touchCache && touchCache[Y.stamp(et, true)];
this.targetTouches[i] = etCached || new Y.DOMEventFacade(et, currentTarget, wrapper);
if (etCached) { Y.log("Found native event in touches. Using same facade in targetTouches", "info", "event-touch"); }
}
}
if (e.changedTouches) {
Y.log("Found e.changedTouches. Replicating on facade", "info", "event-touch");
/**
An array of event-specific touch events.
For `touchstart`, the touch points that became active with the current
event.
For `touchmove`, the touch points that have changed since the last
event.
For `touchend`, the touch points that have been removed from the touch
surface.
@property changedTouches
@type {DOMEventFacade[]}
**/
this.changedTouches = [];
for (i = 0, l = e.changedTouches.length; i < l; ++i) {
et = e.changedTouches[i];
etCached = touchCache && touchCache[Y.stamp(et, true)];
this.changedTouches[i] = etCached || new Y.DOMEventFacade(et, currentTarget, wrapper);
if (etCached) { Y.log("Found native event in touches. Using same facade in changedTouches", "info", "event-touch"); }
}
}
if (SCALE in e) {
this[SCALE] = e[SCALE];
}
if (ROTATION in e) {
this[ROTATION] = e[ROTATION];
}
if (IDENTIFIER in e) {
this[IDENTIFIER] = e[IDENTIFIER];
}
};
//Adding MSPointer events to whitelisted DOM Events. MSPointer event payloads
//have the same properties as mouse events.
if (Y.Node.DOM_EVENTS) {
Y.mix(Y.Node.DOM_EVENTS, {
touchstart:1,
touchmove:1,
touchend:1,
touchcancel:1,
gesturestart:1,
gesturechange:1,
gestureend:1,
MSPointerDown:1,
MSPointerUp:1,
MSPointerMove:1,
MSPointerCancel:1,
pointerdown:1,
pointerup:1,
pointermove:1,
pointercancel:1
});
}
//Add properties to Y.EVENT.GESTURE_MAP based on feature detection.
if ((win && ("ontouchstart" in win)) && !(Y.UA.chrome && Y.UA.chrome < 6)) {
GESTURE_MAP.start = ["touchstart", "mousedown"];
GESTURE_MAP.end = ["touchend", "mouseup"];
GESTURE_MAP.move = ["touchmove", "mousemove"];
GESTURE_MAP.cancel = ["touchcancel", "mousecancel"];
}
else if (win && win.PointerEvent) {
GESTURE_MAP.start = "pointerdown";
GESTURE_MAP.end = "pointerup";
GESTURE_MAP.move = "pointermove";
GESTURE_MAP.cancel = "pointercancel";
}
else if (win && ("msPointerEnabled" in win.navigator)) {
GESTURE_MAP.start = "MSPointerDown";
GESTURE_MAP.end = "MSPointerUp";
GESTURE_MAP.move = "MSPointerMove";
GESTURE_MAP.cancel = "MSPointerCancel";
}
else {
GESTURE_MAP.start = "mousedown";
GESTURE_MAP.end = "mouseup";
GESTURE_MAP.move = "mousemove";
GESTURE_MAP.cancel = "mousecancel";
}
/**
* A object literal with keys "start", "end", and "move". The value for each key is a
* string representing the event for that environment. For touch environments, the respective
* values are "touchstart", "touchend" and "touchmove". Mouse and MSPointer environments are also
* supported via feature detection.
*
* @property _GESTURE_MAP
* @type Object
* @static
*/
Y.Event._GESTURE_MAP = GESTURE_MAP;
}, '3.18.1', {"requires": ["node-base"]});
+1
View File
@@ -0,0 +1 @@
YUI.add("event-touch",function(e,t){var n="scale",r="rotation",i="identifier",s=e.config.win,o={};e.DOMEventFacade.prototype._touch=function(t,s,o){var u,a,f,l,c;if(t.touches){this.touches=[],c={};for(u=0,a=t.touches.length;u<a;++u)l=t.touches[u],c[e.stamp(l)]=this.touches[u]=new e.DOMEventFacade(l,s,o)}if(t.targetTouches){this.targetTouches=[];for(u=0,a=t.targetTouches.length;u<a;++u)l=t.targetTouches[u],f=c&&c[e.stamp(l,!0)],this.targetTouches[u]=f||new e.DOMEventFacade(l,s,o)}if(t.changedTouches){this.changedTouches=[];for(u=0,a=t.changedTouches.length;u<a;++u)l=t.changedTouches[u],f=c&&c[e.stamp(l,!0)],this.changedTouches[u]=f||new e.DOMEventFacade(l,s,o)}n in t&&(this[n]=t[n]),r in t&&(this[r]=t[r]),i in t&&(this[i]=t[i])},e.Node.DOM_EVENTS&&e.mix(e.Node.DOM_EVENTS,{touchstart:1,touchmove:1,touchend:1,touchcancel:1,gesturestart:1,gesturechange:1,gestureend:1,MSPointerDown:1,MSPointerUp:1,MSPointerMove:1,MSPointerCancel:1,pointerdown:1,pointerup:1,pointermove:1,pointercancel:1}),s&&"ontouchstart"in s&&!(e.UA.chrome&&e.UA.chrome<6)?(o.start=["touchstart","mousedown"],o.end=["touchend","mouseup"],o.move=["touchmove","mousemove"],o.cancel=["touchcancel","mousecancel"]):s&&s.PointerEvent?(o.start="pointerdown",o.end="pointerup",o.move="pointermove",o.cancel="pointercancel"):s&&"msPointerEnabled"in s.navigator?(o.start="MSPointerDown",o.end="MSPointerUp",o.move="MSPointerMove",o.cancel="MSPointerCancel"):(o.start="mousedown",o.end="mouseup",o.move="mousemove",o.cancel="mousecancel"),e.Event._GESTURE_MAP=o},"3.18.1",{requires:["node-base"]});
@@ -0,0 +1,181 @@
YUI.add('event-touch', function (Y, NAME) {
/**
Adds touch event facade normalization properties (touches, changedTouches, targetTouches etc.) to the DOM event facade. Adds
touch events to the DOM events whitelist.
@example
YUI().use('event-touch', function (Y) {
Y.one('#myDiv').on('touchstart', function(e) {
...
});
});
@module event
@submodule event-touch
*/
var SCALE = "scale",
ROTATION = "rotation",
IDENTIFIER = "identifier",
win = Y.config.win,
GESTURE_MAP = {};
/**
* Adds touch event facade normalization properties to the DOM event facade
*
* @method _touch
* @for DOMEventFacade
* @private
* @param ev {Event} the DOM event
* @param currentTarget {HTMLElement} the element the listener was attached to
* @param wrapper {CustomEvent} the custom event wrapper for this DOM event
*/
Y.DOMEventFacade.prototype._touch = function(e, currentTarget, wrapper) {
var i,l, etCached, et,touchCache;
if (e.touches) {
/**
* Array of individual touch events for touch points that are still in
* contact with the touch surface.
*
* @property touches
* @type {DOMEventFacade[]}
*/
this.touches = [];
touchCache = {};
for (i = 0, l = e.touches.length; i < l; ++i) {
et = e.touches[i];
touchCache[Y.stamp(et)] = this.touches[i] = new Y.DOMEventFacade(et, currentTarget, wrapper);
}
}
if (e.targetTouches) {
/**
* Array of individual touch events still in contact with the touch
* surface and whose `touchstart` event occurred inside the same taregt
* element as the current target element.
*
* @property targetTouches
* @type {DOMEventFacade[]}
*/
this.targetTouches = [];
for (i = 0, l = e.targetTouches.length; i < l; ++i) {
et = e.targetTouches[i];
etCached = touchCache && touchCache[Y.stamp(et, true)];
this.targetTouches[i] = etCached || new Y.DOMEventFacade(et, currentTarget, wrapper);
}
}
if (e.changedTouches) {
/**
An array of event-specific touch events.
For `touchstart`, the touch points that became active with the current
event.
For `touchmove`, the touch points that have changed since the last
event.
For `touchend`, the touch points that have been removed from the touch
surface.
@property changedTouches
@type {DOMEventFacade[]}
**/
this.changedTouches = [];
for (i = 0, l = e.changedTouches.length; i < l; ++i) {
et = e.changedTouches[i];
etCached = touchCache && touchCache[Y.stamp(et, true)];
this.changedTouches[i] = etCached || new Y.DOMEventFacade(et, currentTarget, wrapper);
}
}
if (SCALE in e) {
this[SCALE] = e[SCALE];
}
if (ROTATION in e) {
this[ROTATION] = e[ROTATION];
}
if (IDENTIFIER in e) {
this[IDENTIFIER] = e[IDENTIFIER];
}
};
//Adding MSPointer events to whitelisted DOM Events. MSPointer event payloads
//have the same properties as mouse events.
if (Y.Node.DOM_EVENTS) {
Y.mix(Y.Node.DOM_EVENTS, {
touchstart:1,
touchmove:1,
touchend:1,
touchcancel:1,
gesturestart:1,
gesturechange:1,
gestureend:1,
MSPointerDown:1,
MSPointerUp:1,
MSPointerMove:1,
MSPointerCancel:1,
pointerdown:1,
pointerup:1,
pointermove:1,
pointercancel:1
});
}
//Add properties to Y.EVENT.GESTURE_MAP based on feature detection.
if ((win && ("ontouchstart" in win)) && !(Y.UA.chrome && Y.UA.chrome < 6)) {
GESTURE_MAP.start = ["touchstart", "mousedown"];
GESTURE_MAP.end = ["touchend", "mouseup"];
GESTURE_MAP.move = ["touchmove", "mousemove"];
GESTURE_MAP.cancel = ["touchcancel", "mousecancel"];
}
else if (win && win.PointerEvent) {
GESTURE_MAP.start = "pointerdown";
GESTURE_MAP.end = "pointerup";
GESTURE_MAP.move = "pointermove";
GESTURE_MAP.cancel = "pointercancel";
}
else if (win && ("msPointerEnabled" in win.navigator)) {
GESTURE_MAP.start = "MSPointerDown";
GESTURE_MAP.end = "MSPointerUp";
GESTURE_MAP.move = "MSPointerMove";
GESTURE_MAP.cancel = "MSPointerCancel";
}
else {
GESTURE_MAP.start = "mousedown";
GESTURE_MAP.end = "mouseup";
GESTURE_MAP.move = "mousemove";
GESTURE_MAP.cancel = "mousecancel";
}
/**
* A object literal with keys "start", "end", and "move". The value for each key is a
* string representing the event for that environment. For touch environments, the respective
* values are "touchstart", "touchend" and "touchmove". Mouse and MSPointer environments are also
* supported via feature detection.
*
* @property _GESTURE_MAP
* @type Object
* @static
*/
Y.Event._GESTURE_MAP = GESTURE_MAP;
}, '3.18.1', {"requires": ["node-base"]});