diff --git a/src/jsds_crafty.js b/src/jsds_crafty.js index aab88ca..481191e 100644 --- a/src/jsds_crafty.js +++ b/src/jsds_crafty.js @@ -64,7 +64,8 @@ .onHit("coll", function(hb) { /* If object hits something it shouldn't, release it from influence of mouse */ - this.stopDrag(); + var t=cur_sel.graphelement; + t.stopDrag(); if (hb[0].normal && (! isNaN(hb[0].overlap)) ) { /* If it ends up overlapping with oneo r several other objects, * push it back as long as necessary @@ -72,11 +73,11 @@ do { var nor=hb[0].normal; var ol=hb[0].overlap; - this.x += Math.ceil(nor.x * -ol); - this.y += Math.ceil(nor.y * -ol); + t.x += Math.ceil(nor.x * -ol); + t.y += Math.ceil(nor.y * -ol); } - while( (hb=this.hit("coll")) && (this.hit("coll")[0].normal) && - (this.hit("coll")[0].overlap) ); + while( (hb=t.hit("coll")) && (t.hit("coll")[0].normal) && + (t.hit("coll")[0].overlap) ); } });