rem:  this.handleEvent = function(evt) { if (this.tgt != evt.target) { this.tgt = evt.target; this.clickX = evt.clientX; this.clickY = evt.clientY; this.clickCnt = 1; if (this.pile.click) this.pile.click(this.pile, evt); return; }  var dx = evt.clientX-this.clickX; var dy = evt.clientY-this.clickY; if (dx*dx+dy*dy > 9) { this.clickX = evt.clientX; this.clickY = evt.clientY; this.clickCnt = 1; if (this.pile.click) this.pile.click(this.pile, evt); return; }  this.clickX = evt.clientX; this.clickY = evt.clientY; this.clickCnt++;  if (this.clickCnt > 2) { this.clickCnt = 1; if (this.pile.click) this.pile.click(this.pile, evt); return; }  if (this.pile.doubleClick) { this.pile.doubleClick(this.pile, evt); } } 
context: function PileClickHandler(pile) {  this.pile = pile;  this.tgt = null;  this.clickX   =0;  this.clickY   =0;  this.clickCnt =0;  this.handleEvent = function(evt) {    if (this.tgt != evt.target) {      this.tgt = evt.target;      this.clickX = evt.clientX;      this.clickY = evt.clientY;      this.clickCnt = 1;      if (this.pile.click)        this.pile.click(this.pile, evt);      return;    }        var dx = evt.clientX-this.clickX;    var dy = evt.clientY-this.clickY;    if (dx*dx+dy*dy > 9) {      this.clickX = evt.clientX;      this.clickY = evt.clientY;      this.clickCnt = 1;      if (this.pile.click)        this.pile.click(this.pile, evt);      return;    }        this.clickX = evt.clientX;    this.clickY = evt.clientY;    this.clickCnt++;    if (this.clickCnt > 2) {      this.clickCnt = 1;      if (this.pile.click)        this.pile.click(this.pile, evt);      return;    }    if (this.pile.doubleClick) {      this.pile.doubleClick(this.pile, evt);    }  }}
meta: 1407	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/1407/2c46850987c1b7c044d71489fa0fa367c5fa768a/pile.js/buggy/samples/solitaire/script/pile.js