From 9de08a7e20608f17a04a9f09b2c6885cbbbf4104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= Date: Fri, 24 Oct 2014 17:15:24 +0200 Subject: [PATCH] Fixed push-bug --- src/jsds_crafty.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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) ); } });