Fixed push-bug

This commit is contained in:
Oliver Rümpelein 2014-10-24 17:15:24 +02:00
parent 10428e7fa1
commit 9de08a7e20
1 changed files with 6 additions and 5 deletions

View File

@ -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) );
}
});