function EmulateDoubleClick()
{
  this.touchstart_event = this.touchstart_event.bindAsEventListener(this);
  this.touchend_event = this.touchend_event.bindAsEventListener(this);
  this.last_click = null;

  window.addEventListener("touchstart", this.touchstart_event, false);
  window.addEventListener("touchend", this.touchend_event, false);
}
/*
 * Work around a bug on many touchscreen browsers: even when the page isn't
 * zoomable, dblclick is never fired.  We have to emulate it.
 *
 * This isn't an exact emulation of the event behavior:
 *
 * - It triggers from touchstart rather than mousedown.  The second mousedown
 *   of a double click isn't being fired reliably in Android's WebKit.
 *
 * - preventDefault on the triggering event should prevent a dblclick, but
 *   we can't find out if it's been called; there's nothing like Firefox's
 *   getPreventDefault.  We could mostly emulate this by overriding
 *   Event.preventDefault to set a flag that we can read.
 *
 * - The conditions for a double click won't match the ones of the platform.
 *
 * This is needed on Android and iPhone's WebKit.
 *
 * Note that this triggers a minor bug on Android: after firing a dblclick event,
 * we no longer receive mousemove events until the touch is released, which means
 * PreventDragScrolling can't cancel dragging.
 */
Work around a bug on many touchscreen browsers: even when the page isn't
zoomable, dblclick is never fired.  We have to emulate it.

This isn't an exact emulation of the event behavior.

- It triggers from touchstart rather than mousedown.  The second mousedown
of a double click isn't being fired reliably in Android's WebKit.

- preventDefault on the triggering event should prevent a dblclick, but
we can't find out if it's been called; there's nothing like Firefox's
getPreventDefault.  We could mostly emulate this by overriding
Event.preventDefault to set a flag that we can read.

- The conditions for a double click won't match the ones of the platform.

This is needed on Android and iPhone's WebKit.

Note that this triggers a minor bug on Android: after firing a dblclick event,
we no longer receive mousemove events until the touch is released, which means
PreventDragScrolling can't cancel dragging.
Work around a bug on many touchscreen browsers : even when the page isn ' t zoomable dblclick is never fired . We have to emulate it . This isn ' t an exact emulation of the event behavior . - It triggers from touchstart rather than mousedown . The second mousedown of a double click isn ' t being fired reliably in Android ' s WebKit . - preventDefault on the triggering event should prevent a dblclick but we can ' t find out if it ' s been called ; there ' s nothing like Firefox ' s getPreventDefault . We could mostly emulate this by overriding Event . preventDefault to set a flag that we can read . - The conditions for a double click won ' t match the ones of the platform . This is needed on Android and iPhone ' s WebKit . Note that this triggers a minor bug on Android : after firing a dblclick event we no longer receive mousemove events until the touch is released which means PreventDragScrolling can ' t cancel dragging .
function EmulateDoubleClick()
{
  this.touchstart_event = this.touchstart_event.bindAsEventListener(this);
  this.touchend_event = this.touchend_event.bindAsEventListener(this);
  this.last_click = null;
  window.addEventListener("touchstart", this.touchstart_event, false);
  window.addEventListener("touchend", this.touchend_event, false);
}
function EmulateDoubleClick ( ) { this . touchstart_event = this . touchstart_event . bindAsEventListener ( this ) ; this . touchend_event = this . touchend_event . bindAsEventListener ( this ) ; this . last_click = null ; window . addEventListener ( "touchstart" , this . touchstart_event , false ) ; window . addEventListener ( "touchend" , this . touchend_event , false ) ; }
Work around a bug on many touchscreen browsers: even when the page isn't
 zoomable, dblclick is never fired.
Work around a bug on many touchscreen browsers : even when the page isn ' t zoomable dblclick is never fired .