rem:  this.mousemove = function(evt) { var pt = localPt(this.parent, evt.clientX, evt.clientY); var dx = pt.x-this.startPt.x; var dy = pt.y-this.startPt.y; if (!this.moved && ((dx*dx+dy*dy) < 4)) return;  if (!this.moved) { this.moved = true;  for (var i=0; i<this.cards.length; i++) { this.cards[i].pile = null; this.cards[i].rect.style.removeProperty("pointer-events"); this.group.appendChild(this.cards[i].elem); } }  this.group.setAttribute("transform", "translate(" + dx + ", " + dy + ")"); };  this.mouseup = function(evt) { this.root.removeEventListener("mousemove", this.fmm, false); this.root.removeEventListener("mouseup", this.fmu, false); this.group.setAttribute("transform",""); if (!this.moved) { for (var i=0; i<this.cards.length; i++) { this.pile.cards.push(this.cards[i]); } return; }  var pt = localPt(this.parent, evt.clientX, evt.clientY); var dx = pt.x-this.startPt.x; var dy = pt.y-this.startPt.y;  var moveInfo = false; var destPile = findPile(this.board, evt.target); if (destPile && destPile.dropCheck) { moveInfo = destPile.dropCheck(this.pile, destPile, this.cards); }  switch(moveInfo) { case true:  this.pile.board.notifyMoveDone(); return; case false:  for (var i=0; i<this.cards.length; i++) { var c = this.cards[i]; c.setPos(c.x+dx, c.y+dy); } this.pile.moveCardsTo(cards, 40); return; default:  this.pile.board.saveMove(moveInfo); this.pile.board.notifyMoveDone(); return; } } } 
add: }; 
context: function CardMoveManager(group, pile, cards, x, y) {  this.pile = pile;  this.board = pile.board;  this.cards = cards;  this.group = group;  this.parent = group.parentNode;  this.root = this.group.getOwnerDocument().getRootElement();  this.startPt = localPt(this.parent, x, y);  this.fmm = new ForwardMouseMove(this);  this.fmu = new ForwardMouseUp(this);  this.root.addEventListener("mousemove", this.fmm, false);  this.root.addEventListener("mouseup", this.fmu, false);  this.moved = false;  this.mousemove = function(evt) {    var pt = localPt(this.parent, evt.clientX, evt.clientY);    var dx = pt.x-this.startPt.x;    var dy = pt.y-this.startPt.y;    if (!this.moved && ((dx*dx+dy*dy) < 4))      return;    if (!this.moved) {      this.moved = true;      // Now move cards       for (var i=0; i<this.cards.length; i++) {        this.cards[i].pile = null;        this.cards[i].rect.style.removeProperty("pointer-events");        this.group.appendChild(this.cards[i].elem);      }    }            this.group.setAttribute("transform", "translate(" + dx + ", " + dy + ")");  };  this.mouseup = function(evt) {    this.root.removeEventListener("mousemove", this.fmm, false);    this.root.removeEventListener("mouseup", this.fmu, false);    this.group.setAttribute("transform","");    if (!this.moved) {      for (var i=0; i<this.cards.length; i++) {        this.pile.cards.push(this.cards[i]);      }      return;    }    var pt = localPt(this.parent, evt.clientX, evt.clientY);    var dx = pt.x-this.startPt.x;    var dy = pt.y-this.startPt.y;    var moveInfo = false;    var destPile = findPile(this.board, evt.target);    if (destPile && destPile.dropCheck) {      moveInfo = destPile.dropCheck(this.pile, destPile, this.cards);    }    switch(moveInfo) {    case true:      // Drop succeeded but no move info.      this.pile.board.notifyMoveDone();      return;    case false:      // Drop failed move back to original.      for (var i=0; i<this.cards.length; i++) {        var c = this.cards[i];        c.setPos(c.x+dx, c.y+dy);      }      this.pile.moveCardsTo(cards, 40);      return;    default:      // Drop succeed record move info.      this.pile.board.saveMove(moveInfo);      this.pile.board.notifyMoveDone();      return;    }  }}
meta: 1407	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/1407/2c46850987c1b7c044d71489fa0fa367c5fa768a/pile.js/buggy/samples/solitaire/script/pile.js