4 * http://d.hatena.ne.jp/uupaa/20100430/1272561922
\r
5 * event.offsetX と offsetY の互換性について
\r
7 * http://www.keynavi.net/ja/tipsj/gokan.html
\r
8 * Safari : マウスイベントは大丈夫ですが ページ全体に対するキーイベントをきちんと扱えない問題があります。
\r
9 * その他、リンクに対するフォーカス(element.focus())の動作がおかしい、 スクリーン上のマウス位置(event.screenX/Y)をブラウザ画面の 左下隅から計算する などの問題があり修正が待たれます。
\r
13 // http://msdn.microsoft.com/ja-jp/library/ie/dn255104%28v=vs.85%29.aspx
\r
14 var X_Dom_Event_devicePixelRatio = window.devicePixelRatio || ( window.screen.deviceXDPI / window.screen.logicalXDPI ) || 1,
\r
16 X_Dom_Event_convertMSPointerType = ( !window.PointerEvent && window.MSPointerEvent ) && [ 0, 0, 'touch', 'pen', 'mouse' ], // WP8.1 は PointerEvent と MSPointerEvent 両方ある
\r
23 * https://github.com/markleusink/ios-html5-drag-drop-shim/blob/master/ios-drag-drop.js
\r
25 X_Dom_Event_coordinateSystemForElementFromPoint = X_UA[ 'iOS' ] < 5 ? 'page' : 'client', // iOS4 以下は clientX が undeifned...
\r
27 X_Dom_Event_CANCEL_MOUSE = {},
\r
30 if( X_Dom_Event_devicePixelRatio !== 1 ){
\r
31 X_UA_classNameForHTML += ' dpr' + X_Dom_Event_devicePixelRatio;
\r
33 X_UA[ 'dpr' ] = X_Dom_Event_devicePixelRatio;
\r
36 if( !X_UA[ 'IE' ] || 9 <= X_UA[ 'IE' ] ){
\r
37 X_DomEvent = function( e, xnode ){
\r
38 var originalType = e.type,
\r
39 isNum = X_Type_isNumber,
\r
40 type, pointerEventType,
\r
42 altKey, ctrlKey, metaKey, shiftKey, target, xtarget, offset, related, force,
\r
43 elm, i, n, time, touch, ev;
\r
46 this[ 'type' ] = type = X_Event_RenameTo[ originalType ] || originalType;
\r
50 this[ 'data' ] = e.data;
\r
51 this[ 'origin' ] = e.origin;
\r
52 this[ 'source' ] = e.source;
\r
55 this[ 'lengthComputable' ] = e.lengthComputable;
\r
56 this[ 'loaded' ] = e.loaded;
\r
57 this[ 'total' ] = e.total;
\r
65 this[ 'dataTransfer' ] = e.dataTransfer;
\r
69 //console.log( 'original : ' + originalType + ' > ' + type );
\r
70 // http://msdn.microsoft.com/ja-jp/library/ie/dn304886%28v=vs.85%29.aspx
\r
72 if( e.pointerType ||
\r
73 // IE11 の IE10 モードで click イベントの pointerType が undefined
\r
74 ( X_UA[ 'IE' ] === 10 && type === 'click' && ( e.pointerType = 'mouse' ) ) ){
\r
76 if( X_Dom_Event_convertMSPointerType ){
\r
77 this[ 'pointerType' ] = X_Dom_Event_convertMSPointerType[ e.pointerType ];
\r
78 this[ 'pressure' ] = isNum( e.pressure ) ? e.pressure : ( e.button !== -1 ? 0.5 : 0 );
\r
79 // ポインターの接触形状の スクリーン ピクセル単位の幅と高さ なので変換。(多分、、、)
\r
80 this[ 'width' ] = e.width / X_Dom_Event_devicePixelRatio;
\r
81 this[ 'height' ] = e.height / X_Dom_Event_devicePixelRatio;
\r
83 this[ 'pointerType' ] = e.pointerType;
\r
84 this[ 'pressure' ] = e.pressure;
\r
85 // ポインターの接触形状の CSS ピクセル単位の幅と高さ。
\r
86 this[ 'width' ] = e.width;
\r
87 this[ 'height' ] = e.height;
\r
90 switch( this[ 'pointerType' ] ){
\r
92 //Y-Z 平面と、ペンの軸が含まれる平面の間の角度を返します。Y 軸の範囲は -90 ~ +90 です。X の傾きの正の方向は右方向です。
\r
93 this[ 'tiltX' ] = e.tiltX;
\r
94 this[ 'tiltY' ] = e.tiltY;
\r
95 if( originalType === 'MSPointerHover' ){
\r
96 this[ 'type' ] = 'pointermove'; // ie10 には pointerhover と pointermoveがあり、ie11 で一本化。ie11 では buttons を見て hover 状態を判定
\r
99 this[ 'radiusX' ] = e.radiusX;
\r
100 this[ 'radiusY' ] = e.radiusY;
\r
101 this[ 'rotationAngle' ] = e.rotationAngle;
\r
105 this[ 'button' ] = e.button;
\r
106 this[ 'buttons' ] = e.buttons;
\r
108 this[ 'pointerId' ] = e.pointerId;
\r
109 this[ 'target' ] = X_Node_getXNode( e.target );
\r
110 this[ 'relatedTarget' ] = X_Node_getXNode( e.relatedTarget ); // xnode
\r
111 this[ 'isPrimary' ] = e.isPrimary;
\r
112 this[ 'hwTimestamp' ] = e.hwTimestamp;
\r
113 this[ 'timestamp' ] = e.timestamp;
\r
115 this[ 'altKey' ] = e.altKey;
\r
116 this[ 'ctrlKey' ] = e.ctrlKey;
\r
117 this[ 'metaKey' ] = e.metaKey;
\r
118 this[ 'shiftKey' ] = e.shiftKey;
\r
119 //this[ 'screenX' ] = touch.screenX;
\r
120 //this[ 'screenY' ] = touch.screenY;
\r
121 this[ 'clientX' ] = e.clientX;
\r
122 this[ 'clientY' ] = e.clientY;
\r
123 this[ 'pageX' ] = e.pageX;
\r
124 this[ 'pageY' ] = e.pageY;
\r
125 this[ 'offsetX' ] = e.offsetX;
\r
126 this[ 'offsetY' ] = e.offsetY;
\r
128 if( pointerEventType = X_Event_toPointer[ originalType ] ){
\r
130 //console.log( originalType + ' => ' + pointerEventType );
\r
132 /* e.constructor === window.TouchEvent -> e.touches for iOS3.13 */
\r
133 if( touches = e.changedTouches ){
\r
134 //console.log( originalType + ' => ' + pointerEventType );
\r
135 if( touches.length === 0 ){
\r
136 alert( 'e.changedTouches.length === 0' );
\r
138 X_Dom_Event_CANCEL_MOUSE[ xnode[ '_uid' ] ] = pointerEventType;
\r
142 ctrlKey = e.ctrlKey;
\r
143 metaKey = e.metaKey;
\r
144 shiftKey = e.shiftKey;
\r
145 time = X_Timer_now();
\r
146 force = originalType === 'touchend' || originalType === 'touchcancel' ? 0 : 0.5;
\r
147 for( i = touches.length; i; ){
\r
148 touch = touches[ --i ];
\r
149 target = touch.target;
\r
150 target = target.nodeType === 3 ? target.parentNode : target;
\r
151 xtarget = X_Node_getXNode( target );
\r
152 // https://developer.mozilla.org/en/docs/Web/API/Element/getBoundingClientRect
\r
153 // Android 2+, iOS4+
\r
154 offset = X_UA[ 'iOS' ] < 5 ? xtarget.offset() : target.getBoundingClientRect();
\r
155 related = touch.relatedTarget;
\r
157 'type' : pointerEventType,
\r
158 'pointerType' : 'touch',
\r
159 'target' : xtarget,// defeat Safari bug // xnodetouch.target,
\r
160 'currentTarget' : xnode,
\r
161 'relatedTarget' : related && X_Node_getXNode( related.nodeType === 3 ? related.parentNode : related ), // xnode iOS3 には relatedTarget がない
\r
162 'isPrimary' : true,
\r
163 'hwTimestamp' : time,
\r
164 'timestamp' : time,
\r
165 'button' : /*e.button ||*/ ( force ? 0 : -1 ),
\r
166 'buttons' : /*e.buttons || e.button ||*/ ( force ? 1 : 0 ),
\r
168 'ctrlKey' : ctrlKey,
\r
169 'metaKey' : metaKey,
\r
170 'shiftKey' : shiftKey,
\r
171 'pointerId' : touch.identifier + 2, // iOS4 は 変換が必要!
\r
172 //screenX : touch.screenX,
\r
173 //screenY : touch.screenY,
\r
174 'pageX' : touch.pageX,
\r
175 'pageY' : touch.pageY,
\r
176 // iOS4 以下では clientX が undef, pageX から scrollLeft を引く.
\r
177 // TODO getter にする?
\r
178 'clientX' : isNum( touch.clientX ) ? touch.clientX : ( touch.pageX - X_ViewPort_scrollX ),
\r
179 'clientY' : isNum( touch.clientY ) ? touch.clientY : ( touch.pageY - X_ViewPort_scrollY ),
\r
181 // iOS8 でも offsetX が undef, iOS4 以下では pageX - offset.x, iOS5 以上は clientX - getBCR.left
\r
182 // TODO getter にする?
\r
183 'offsetX' : isNum( touch.offsetX ) ? touch.offsetX : touch[ X_Dom_Event_coordinateSystemForElementFromPoint + 'X' ] - ( offset.x || offset.left || 0 ),
\r
184 'offsetY' : isNum( touch.offsetY ) ? touch.offsetY : touch[ X_Dom_Event_coordinateSystemForElementFromPoint + 'Y' ] - ( offset.y || offset.top || 0 ),
\r
185 'radiusX' : touch.radiusX || 0,
\r
186 'radiusY' : touch.radiusY || 0,
\r
187 'rotationAngle' : touch.rotationAngle || 0,
\r
188 'pressure' : touch.force || touch.webkitForce || force,
\r
189 'width' : touch.width || 0,
\r
190 'height' : touch.height || 0
\r
192 //console.log( 'e.pointerId = ' + touch.identifier );
\r
193 //X_UA[ 'iOS' ] < 5 && console.log( pointerEventType + ':[' + events[ i ].pageX + ',' + events[ i ].pageY + ']' + events[ i ].pointerId );
\r
195 return events.length === 1 ? events[ 0 ] : events;
\r
198 if( X_Dom_Event_CANCEL_MOUSE[ xnode[ '_uid' ] ] === pointerEventType ){
\r
199 delete X_Dom_Event_CANCEL_MOUSE[ xnode[ '_uid' ] ];
\r
204 this[ 'type' ] = pointerEventType;
\r
205 this[ 'pointerType' ] = 'mouse';
\r
207 this[ 'button' ] = e.button !== undefined ? e.button : e.which !== undefined ? e.which - 1 : -1;
\r
208 this[ 'buttons' ] = e.buttons !== undefined ? e.buttons : this[ 'button' ] === 0 ? 1 : this[ 'button' ] === 1 ? 2 : this[ 'button' ] === 2 ? 4 : 0;
\r
209 this[ 'pressure' ] = ( this[ 'button' ] !== -1 ? 0.5 : 0 );
\r
212 this[ 'target' ] = X_Node_getXNode( elm.nodeType === 3 ? elm.parentNode : elm );// defeat Safari bug // xnodetouch.target;
\r
213 this[ 'isPrimary' ] = true;
\r
214 this[ 'hwTimestamp' ] = this[ 'timestamp' ] = X_Timer_now();
\r
215 this[ 'altKey' ] = e.altKey;
\r
216 this[ 'ctrlKey' ] = e.ctrlKey;
\r
217 this[ 'metaKey' ] = e.metaKey;
\r
218 this[ 'shiftKey' ] = e.shiftKey;
\r
219 this[ 'pointerId' ] = 1;
\r
220 //this[ 'screenX' ] = touch.screenX;
\r
221 //this[ 'screenY' ] = touch.screenY;
\r
222 // TODO http://uupaa-js.googlecode.com/svn-history/r8/trunk/doc/reference/symbols/src/trunk_uu.module.ui.js.html
\r
223 // Safari2ではclientX,YはpageX,Yと同じ値を返す
\r
224 this[ 'clientX' ] = e.clientX;
\r
225 this[ 'clientY' ] = e.clientY;
\r
226 this[ 'pageX' ] = e.pageX;
\r
227 this[ 'pageY' ] = e.pageY;
\r
228 this[ 'offsetX' ] = isNum( e.offsetX ) ? e.offsetX : e.layerX; // 要素上の座標を取得
\r
229 this[ 'offsetY' ] = isNum( e.offsetY ) ? e.offsetY : e.layerY;
\r
231 // http://www.programming-magic.com/20090127231544/
\r
232 // Opera で button==2の場合、コンテキストメニューイベントを発火 「ツール」->「設定」->「詳細設定」->「コンテンツ」->「Javascriptオプション」で「右クリックを制御するスクリプトを許可する」
\r
233 if( originalType === 'mousedown' && this[ 'button' ] === 2 && X_UA[ 'Opera' ] ){
\r
234 events = [ X_Object_copy( this ), X_Object_copy( this ) ];
\r
235 events[ 1 ].type = 'contextmenu';
\r
242 this[ 'keyCode' ] = X_Type_isFinite( e.keyCode ) ? e.keyCode : X_Type_isFinite( e.charCode ) ? e.charCode : e.which;
\r
243 this[ 'charCode' ] = X_Type_isFinite( e.charCode ) ? e.charCode : e.which;
\r
244 this[ 'altKey' ] = e.altKey || !!( e.modifiers & 1 );
\r
245 this[ 'ctrlKey' ] = e.ctrlKey || !!( e.modifiers & 2 );
\r
246 this[ 'shiftKey' ] = e.shiftKey || !!( e.modifiers & 4 );
\r
247 this[ 'metaKey' ] = e.metaKey || !!( e.modifiers & 8 );;
\r
249 this[ 'button' ] = e.button !== undefined ? e.button :
\r
250 e.which !== undefined ? e.which - 1 : -1;
\r
251 this[ 'buttons' ] = e.buttons !== undefined ? e.buttons : this[ 'button' ] === 0 ? 1 : this[ 'button' ] === 1 ? 2 : this[ 'button' ] === 2 ? 4 : 0;
\r
253 //http://www.quirksmode.org/js/events_properties.html
\r
254 if( elm = e.target ){
\r
255 this[ 'target' ] = X_Node_getXNode( elm.nodeType === 3 ? elm.parentNode : elm );// defeat Safari bug // xnode
\r
257 if( elm = e.relatedTarget ){
\r
258 this[ 'relatedTarget' ] = X_Node_getXNode( elm.nodeType === 3 ? elm.parentNode : elm ); // xnode
\r
261 if( type === 'wheel' ){
\r
262 // https://developer.mozilla.org/ja/docs/DOM/DOM_event_reference/mousewheel
\r
264 // https://w3g.jp/blog/tools/wheelevent_crossbrowser
\r
265 // ホイール系イベント2014年版クロスブラウザ
\r
266 if( e.deltaY !== undefined ){
\r
267 this[ 'deltaX' ] = e.deltaX;
\r
268 this[ 'deltaY' ] = e.deltaY;
\r
269 this[ 'deltaZ' ] = e.deltaZ || 0;
\r
271 if( e.wheelDeltaY !== undefined ){
\r
272 this[ 'deltaX' ] = e.wheelDeltaX / 120;
\r
273 this[ 'deltaY' ] = e.wheelDeltaY / 120;
\r
274 this[ 'deltaZ' ] = e.wheelDeltaZ / 120 || 0;
\r
276 if( e.wheelDelta !== undefined ){
\r
277 this[ 'deltaX' ] = this[ 'deltaZ' ] = 0;
\r
278 this[ 'deltaY' ] = e.wheelDelta / -120;
\r
280 if( e.detail !== undefined ){
\r
281 this[ 'deltaX' ] = this[ 'deltaZ' ] = 0;
\r
282 this[ 'deltaY' ] = originalType === 'MozMousePixelScroll' ? e.detail / 45 : e.detail / 3; // 3
\r
284 this[ 'deltaX' ] = this[ 'deltaY' ] = this[ 'deltaZ' ] = 0;
\r
289 this[ 'currentTarget' ] = xnode; // xnode
\r
290 this[ 'eventPhase' ] = e.eventPhase;
\r
291 this[ 'detail' ] = e.detail;
\r
294 X_DomEvent = function( e, xnode, element ){
\r
295 var originalType = e.type, btn, type;
\r
297 this[ 'type' ] = X_Event_RenameTo[ originalType ] || originalType;
\r
298 this[ 'target' ] = X_Node_getXNode( e.srcElement ); // xnode
\r
299 if( this[ 'target' ] && !this[ 'target' ][ '_tag' ] ) this[ 'target' ] = this[ 'target' ].parent; // ie4 の fake Textnode がヒットしていないか?
\r
300 this[ 'currentTarget' ] = xnode; // xnode
\r
301 this[ 'relatedTarget' ] = X_Node_getXNode( e.formElement || e.toElement ); // xnode
\r
302 this[ 'relatedTarget' ] && console.dir( 'relatide...' );
\r
303 this[ 'eventPhase' ] = e.srcElement === element ? 2: 3;
\r
305 this[ 'keyCode' ] = e.keyCode;
\r
306 this[ 'charCode' ] = e.keyCode;
\r
307 this[ 'altKey' ] = e.altKey;
\r
308 this[ 'ctrlKey' ] = e.ctrlKey;
\r
309 this[ 'shiftKey' ] = e.shiftKey;
\r
312 switch( this[ 'type' ] ){
\r
314 this[ 'data' ] = e.data;
\r
315 this[ 'origin' ] = e.origin;
\r
316 this[ 'source' ] = e.source;
\r
319 this[ 'loaded' ] = e.loaded;
\r
320 this[ 'total' ] = e.total;
\r
324 // http://www.programming-magic.com/20090127231544/
\r
325 switch( originalType ){
\r
328 this[ 'button' ] = 0;
\r
330 case 'contextmenu' :
\r
331 this[ 'button' ] = 2;
\r
334 // mouseup, mousedown
\r
339 btn & 2 ? 1 : -1; // 左:1(click:0), 中:4, 右:2
\r
342 this[ 'buttons' ] = e.button;
\r
344 this[ 'deltaX' ] = 0;
\r
345 this[ 'deltaY' ] = e.wheelDelta / -120;
\r
347 if( type = X_Event_toPointer[ originalType ] ){
\r
348 this[ 'type' ] = type;
\r
349 this[ 'pointerType' ] = 'mouse';
\r
350 this[ 'clientX' ] = e.clientX;
\r
351 this[ 'clientY' ] = e.clientY;
\r
352 //this[ 'screenX' ] = e.screenX;
\r
353 //this[ 'screenY' ] = e.screenY;
\r
355 //if( X_ViewPort_rootElement ){ // uuu...
\r
356 this[ 'pageX' ] = e.clientX + X_ViewPort_rootElement.scrollLeft;
\r
357 this[ 'pageY' ] = e.clientY + X_ViewPort_rootElement.scrollTop;
\r
358 // DOMAssistant 2.8.1
\r
359 //event.pageX = DOMAssistant.def(e.pageX)? e.pageX : (event.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0));
\r
360 //event.pageY = DOMAssistant.def(e.pageY)? e.pageY : (event.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0));
\r
363 if( 5 <= X_UA[ 'IE' ] ){
\r
364 this[ 'offsetX' ] = e.offsetX; // イベントターゲット左上からの座標
\r
365 this[ 'offsetY' ] = e.offsetY;
\r
367 //if( e.srcElement ){
\r
368 // this[ 'offsetX' ] = e.x - e.srcElement.offsetLeft; // e.x はイベント発生要素の親要素を基準にした座標。
\r
369 // this[ 'offsetY' ] = e.y - e.srcElement.offsetTop;
\r
371 this[ 'pressure' ] = ( this[ 'button' ] !== -1 ? 0.5 : 0 );
\r
372 this[ 'isPrimary' ] = true;
\r
373 this[ 'hwTimestamp' ] = this[ 'timestamp' ] = X_Timer_now();
\r
374 this[ 'pointerId' ] = 1;
\r
375 this[ 'radiusX' ] = 0;
\r
376 this[ 'radiusY' ] = 0;
\r
377 this[ 'rotationAngle' ] = 0;
\r
378 this[ 'width' ] = 0;
\r
379 this[ 'height' ] = 0;
\r
380 this[ 'tiltX' ] = 0;
\r
381 this[ 'tiltY' ] = 0;
\r
386 // TODO load -> readystatechange this.readyState === "loaded" || this.readyState === "complete"
\r
388 // https://github.com/georgeadamson/jQuery.prefixfree-events/blob/master/jQuery.prefixfree-events.js
\r
389 // https://developer.mozilla.org/en-US/docs/Web/Events/wheel
\r
391 if( document.onwheel === undefined ){
\r
393 if( X_UA[ 'Gecko' ] && window.MouseScrollEvent ){
\r
394 if( 2 <= X_UA[ 'Gecko' ] || ( 1.9 <= X_UA[ 'Gecko' ] && 1 <= X_UA[ 'GeckoPatch' ] ) ){ // Gecko 1.9.1+ (firefox3.5+)
\r
395 console.log( 'wheel <= MozMousePixelScroll' );
\r
396 X_Event_Rename[ 'wheel' ] = 'MozMousePixelScroll';
\r
398 if( 1 <= X_UA[ 'Gecko' ] || ( 0.9 <= X_UA[ 'Gecko' ] && 7 <= X_UA[ 'GeckoPatch' ] ) ){ // Gecko 0.9.7+ (NN6.2+?)
\r
399 console.log( 'wheel <= DOMMouseScroll' );
\r
400 X_Event_Rename[ 'wheel' ] = 'DOMMouseScroll';
\r
403 X_Event_Rename[ 'wheel' ] = 'mousewheel';
\r
405 //if( document.onmousewheel !== undefined ){ // Opera で判定失敗する
\r
406 // X_Event_Rename[ 'wheel' ] = 'mousewheel';
\r
412 if( window.onwebkitanimationend !== undefined && window.onanimationend === undefined ){
\r
413 console.log( 'animationend <= webkitAnimationEnd' );
\r
414 X_Event_Rename[ 'animationend' ] = 'webkitAnimationEnd';
\r
415 X_Event_Rename[ 'animationstart' ] = 'webkitAnimationStart';
\r
416 X_Event_Rename[ 'animationiteration' ] = 'webkitAnimationIteration';
\r
418 if( window.onoanimationend !== undefined && window.onanimationend === undefined ){
\r
419 console.log( 'animationend <= oAnimationEnd' );
\r
420 X_Event_Rename[ 'animationend' ] = 'oAnimationEnd';
\r
421 X_Event_Rename[ 'animationstart' ] = 'oAnimationStart';
\r
422 X_Event_Rename[ 'animationiteration' ] = 'oAnimationIteration';
\r
425 if( window.onmozanimationend !== undefined && window.onanimationend === undefined ){
\r
426 X_Event_Rename[ 'animationend' ] = 'mozAnimationEnd';
\r
427 X_Event_RenameTo[ 'mozAnimationEnd' ] = 'animationend';
\r
428 X_Event_Rename[ 'animationstart' ] = 'mozAnimationStart';
\r
429 X_Event_RenameTo[ 'mozAnimationStart' ] = 'animationstart';
\r
430 X_Event_Rename[ 'animationiteration' ] = 'mozAnimationIteration';
\r
431 X_Event_RenameTo[ 'mozAnimationIteration' ] = 'animationiteration';
\r
433 if( document.documentElement && document.documentElement.style.msAnimation !== undefined && document.documentElement.style.animation === undefined ){ //document.documentElement.style.msAnimation
\r
434 console.log( 'animationend <= MSAnimationEnd' );
\r
435 X_Event_Rename[ 'animationend' ] = 'MSAnimationEnd';
\r
436 X_Event_Rename[ 'animationstart' ] = 'MSAnimationStart';
\r
437 X_Event_Rename[ 'animationiteration' ] = 'MSAnimationIteration';
\r
439 // https://developer.mozilla.org/en-US/docs/Web/Events/transitionend
\r
440 // chrome1+, firefox4+, IE10+, Opera10.5+, Safari3.2+, Android2.1+
\r
441 if( window.onwebkittransitionend !== undefined && window.ontransitionend === undefined ){
\r
442 console.log( 'transitionend <= webkitTransitionEnd' );
\r
443 X_Event_Rename[ 'transitionend' ] = 'webkitTransitionEnd';
\r
445 if( window.onotransitionend !== undefined && window.ontransitionend === undefined ){
\r
446 if( X_UA[ 'Opera' ] < 12 ){
\r
447 console.log( 'transitionend <= oTransitionEnd|ver.' + X_UA[ 'Opera' ] );
\r
448 X_Event_Rename[ 'transitionend' ] = 'oTransitionEnd';
\r
450 console.log( 'transitionend <= otransitionEnd|ver.' + X_UA[ 'Opera' ] );
\r
451 X_Event_Rename[ 'transitionend' ] = 'otransitionEnd';
\r
454 if( window.onmoztransitionend !== undefined && window.ontransitionend === undefined ){
\r
455 console.log( 'transitionend <= mozTransitionEnd' );
\r
456 X_Event_Rename[ 'transitionend' ] = 'mozTransitionEnd';
\r
459 if( !navigator.pointerEnabled ){
\r
460 if( navigator.msPointerEnabled ){
\r
461 console.log( 'pointerdown <= MSPointerDown' );
\r
462 X_Event_Rename[ 'pointerdown' ] = 'MSPointerDown';
\r
463 X_Event_Rename[ 'pointerup' ] = 'MSPointerUp';
\r
464 X_Event_Rename[ 'pointermove' ] = [ 'MSPointerMove', 'MSPointerHover' ];// ie10 と ie11 でペンのhoverevent の値が異なる
\r
465 X_Event_Rename[ 'pointercancel' ] = 'MSPointerCancel';
\r
466 X_Event_Rename[ 'pointerout' ] = 'MSPointerOut';
\r
467 X_Event_Rename[ 'pointerleave' ] = 'MSPointerLeave';
\r
468 // http://msdn.microsoft.com/ja-jp/library/ie/dn304886%28v=vs.85%29.aspx
\r
470 if( X_UA_HID.TOUCH ){
\r
471 // touch のみ(iOS でも脱獄したら?)、 touch と mouse(Android), mouse のみ
\r
472 X_Event_Rename[ 'pointerdown' ] = [ 'touchstart', 'mousedown' ];
\r
473 X_Event_Rename[ 'pointerup' ] = [ 'touchend', 'mouseup' ];
\r
474 X_Event_Rename[ 'pointermove' ] = [ 'touchmove', 'mousemove' ];
\r
475 X_Event_Rename[ 'pointercancel' ] = 'touchcancel';
\r
476 //X_Event_Rename[ 'pointerout' ] =
\r
477 X_Event_Rename[ 'pointerleave' ] = 'touchleave';
\r
478 // X_Event_Rename[ 'click' ] = [ 'touchstart', 'touchmove', 'touchend' ]; // ループになってしまう!直した!直ってない!
\r
480 X_Event_Rename[ 'pointerdown' ] = 'mousedown';
\r
481 X_Event_Rename[ 'pointerup' ] = 'mouseup';
\r
482 X_Event_Rename[ 'pointermove' ] = 'mousemove';
\r
483 //X_Event_Rename[ 'pointercancel' ] =
\r
484 //X_Event_Rename[ 'pointerout' ] =
\r
485 X_Event_Rename[ 'pointerleave' ] = X_elmHtml.onmouseleave !== undefined ? 'mouseleave' : 'mouseout';
\r
487 // Opera は ブラウザ設定から右クリックの通知を許可すると mousedown で e.button==2 が返る,キャンセルは可能??
\r
488 X_UA[ 'Opera' ] && ( X_Event_Rename[ 'contextmenu' ] = 'mousedown' );
\r
491 * buttons の無いブラウザには mouseup, mousedown を監視して、buttons フラグを更新し続ける
\r