Automattic / Iris

A(n awesome) Color Picker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add simple touch capability

ugate opened this issue · comments

It seems like it would be fairly simple to add touch support to your control by changing:

line 556 from:

}).on( 'mousedown mouseup', function( event ) {

to:

}).on( 'mousedown mouseup touchmove touchend', function( event ) {

and line 594 from:

square.mousedown( function( event ) {

to:

square.on('mousedown touchmove', function( event ) {

btw, very nice plugin!

If you need touch support, I recommend using jQuery UI Touch Punch, which is how we support touch in WordPress core.

Have you actually tested your suggestion? It doesn't seem like it'll work.

I looked into touch punch, but thought it would be more bloat than what was needed for such a simple feature.

I have not tried it as it was intended as an illustration versus a patch. There would be a few more minor edits within the functions needed to distinguish down/move vs up/end events, but this should be fairly easy to implement. If you don't think it's worth the effort I'll understand.

Thanks for the quick response!

Fire me a functional pull request that accomplishes touch support without Touch Punch and I'll take a look. But since Iris requires jQuery UI for much of its functionality, things are not as simple as they might seem. Touch Punch makes everything (that I've tested) Just Work™ and is actually quite lightweight.