mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Interaction: Initiail MSPointer implementation.
This commit is contained in:
parent
7332f0e0dd
commit
a13894672a
58
ui/jquery.ui.interaction.js
vendored
58
ui/jquery.ui.interaction.js
vendored
@ -118,6 +118,8 @@ var touchHook = interaction.hooks.touch = {
|
|||||||
|
|
||||||
handle: function( widget ) {
|
handle: function( widget ) {
|
||||||
function touchmove( event ) {
|
function touchmove( event ) {
|
||||||
|
// TODO: test non-Apple WebKits to see if they allow
|
||||||
|
// zooming/scrolling if we don't preventDefault()
|
||||||
var touch = getTouch( event );
|
var touch = getTouch( event );
|
||||||
if ( !touch ) {
|
if ( !touch ) {
|
||||||
return;
|
return;
|
||||||
@ -153,4 +155,60 @@ var touchHook = interaction.hooks.touch = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: test mouse, pen
|
||||||
|
var pointerHook = interaction.hooks.msPointer = {
|
||||||
|
setup: function( widget, start ) {
|
||||||
|
widget._bind({
|
||||||
|
"MSPointerDown": function( event ) {
|
||||||
|
if ( pointerHook.id ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pointerHook.id = event.originalEvent.pointerId;
|
||||||
|
event.originalEvent.preventManipulation();
|
||||||
|
start( event, {
|
||||||
|
left: event.pageX,
|
||||||
|
top: event.pageY
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handle: function( widget ) {
|
||||||
|
function pointermove( event ) {
|
||||||
|
// always prevent manipulation to avoid zooming/scrolling
|
||||||
|
event.originalEvent.preventManipulation();
|
||||||
|
|
||||||
|
if ( event.originalEvent.pointerId !== pointerHook.id ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
widget._interactionMove( event, {
|
||||||
|
left: event.pageX,
|
||||||
|
top: event.pageY
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function pointerup( event ) {
|
||||||
|
if ( event.originalEvent.pointerId !== pointerHook.id ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
widget._interactionStop( event, {
|
||||||
|
left: event.pageX,
|
||||||
|
top: event.pageY
|
||||||
|
});
|
||||||
|
pointerHook.id = null;
|
||||||
|
widget.document
|
||||||
|
.unbind( "MSPointerMove", pointermove )
|
||||||
|
.unbind( "MSPointerUp", pointerup );
|
||||||
|
}
|
||||||
|
|
||||||
|
widget._bind( widget.document, {
|
||||||
|
"MSPointerMove": pointermove,
|
||||||
|
"MSPointerUp": pointerup
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
})( jQuery );
|
})( jQuery );
|
||||||
|
Loading…
Reference in New Issue
Block a user