MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Kindle Developer's Corner (https://www.mobileread.com/forums/forumdisplay.php?f=150)
-   -   Javascript double click (https://www.mobileread.com/forums/showthread.php?t=175900)

silver18 04-19-2012 05:04 PM

Javascript double click
 
Good evening to all!
I'm working on a WAF (Image Gallery) and I need to use the ondblclick event to catch a double click.

It seems that Kindle Touch can't use it! :blink:

I could simulate the double tap using onclick and a time delay, but it isn't a good solution as I always get that delay and it isn't funny.

In the WAF's config.xml I found this:

Code:

<param name="multi_tap" value="yes"/>
and that's exactly what I need.
Is there a way to catch that event?
Thanks a lot!!! :thanks:

eureka 04-19-2012 05:41 PM

I've tried to use dblclick event, but for Pillow stuff. Anyway, Pillow and WAF are backed by the same system-wide WebKit library, so my experience could be possibly applied for your case.

So, in my experiments, double tap should've been made VERY fast to produce dblclick event. No, really, VERY FAST.

(And with dblclick, click event was also produced.)

silver18 04-19-2012 05:56 PM

Really so fast???:eek:
I was tapping at 100 Hz!! :p

I already managed the two onclick events produced by doubleclick, but I couldn't get the Kindle to catch the double click!

I tried a different way, but ondblclick still remains the better thing to do!

I'll try it again and let you know!:thanks:

eureka 04-19-2012 06:04 PM

100 Hz is fast enough :) so maybe Pillow app can catch dblclick but WAF app can't...

silver18 04-19-2012 06:30 PM

I tried it again, but no luck!

I came to manage the double click with onclick and timedelay, using an if condition so that I don't get the delay every time!

It works, by now....but definitely not elegant!

mr.w0lf 04-20-2012 09:49 AM

"multi_tap" may stand for "tap with more than 1 finger" :rolleyes:

silver18 04-20-2012 10:46 AM

I think the multi-tap it's actually just like the double-click.
2 fingers should be managed by:

Code:

<param name="pinchzoom" value="yes" properties="fire-on-zoom:1"/>

idoit 04-20-2012 12:56 PM

Somehow related to your question:
Is there any way to make dictionary work in browser (Kindle Touch)? select a word by touching and showing the menu as in the ebook reader.

Spoiler:
I saw the following in config.xml of browser which confirms that it's possible:
<param name="hold" value="yes"/>

silver18 05-06-2012 01:26 PM

Here's how I fixed this problem:

Code:

var doubleclicks = 0;
var timer;

function doubleClick () {

        doubleclicks = 0;
        clearTimeout(timer);
        ENTER WHAT DO YOU WANT TO DO HERE
                       
}

function simulateDoubleClick () {
                       
        doubleclicks = doubleclicks + 1;
        if (timer) clearTimeout(timer);
        timer = setTimeout(function() { singleClick (); }, 550);
               
        if (doubleclicks == 2) {
                doubleClick ();
        }
}

function singleClick() {
       
        ENTER WHAT DO YOU WANT TO DO HERE
                       
}

and here's how to call it:

Code:

onClick="simulateDoubleClick ()"


All times are GMT -4. The time now is 09:21 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.