EvandroLG / selecting

:fishing_pole_and_fish: A library that allows you to access the text selected by the user
92 stars 12 forks source link

Finger friendly closes #2 #3 #6

Closed felquis closed 9 years ago

felquis commented 9 years ago

The commit you need to check is this one https://github.com/felquis/selecting/commit/c8e673454834b8818e2fc91d653f39580f4075b0 the other is just small improvements

Well, I made a research about selecting text on touchable devices, since this plugin wasn't working properly on touches devices, so I tested in Android and iPad, and the selection spend about 700ms to select a texting, so the user must hold the finger on the screen for about 700ms to select a text.

I made this script to start checking for text selection when the use put the finger on the screen (touchstart), we start a setInterval, and is some text is selected, we stop the setInterval because the user successfully selected text. But, once the user select the first work with a tab-hold event. We aren't able to detect for changes in the current text selection, so for this reason I need to setup another setInterval, the will look for changes in the current selected text, and every time we notice some change in the selected text we fired the callback.

Still some work to do, It is hard to example all the problems, but I think this is a beginning, it merged, I'll create some issues

Tested on Android (Chrome 39) iPad,iOS8.1 (Chrome/Safari)

felquis commented 9 years ago

I couldn't write any test for this :/ I'll take a look at the code and turn it in something testable.

Also, two tests are failing right now, can you provide some help to me about these tests?

EvandroLG commented 9 years ago

It's great! Good job! o/ The solution is good, but I think this code needs to be refactored.

felquis commented 9 years ago

Of course :) I made this to work, it should be improved.