sendBackwards and bringForward methods #241

Closed
gazrawicz opened this Issue Aug 20, 2012 · 3 comments

Comments

Projects
None yet
2 participants

I suggest following changes:

adding one line in sendBackwards:

    for (var i=idx-1; i>=0; --i) {
      if (object.intersectsWithObject(this._objects[i]) ||
          object.isContainedWithinObject(this._objects[i]) ||
          (this._objects[i]).isContainedWithinObject(object)) {   //<--- I think this line is necessary
        nextIntersectingIdx = i;
        break;
      }
    }

analogically in bringForward:

    // traverse up the stack looking for the nearest intersecting object
    for (var i = idx + 1, l = this._objects.length; i < l; ++i) {
      if (object.intersectsWithObject(objects[i]) ||
          object.isContainedWithinObject(this._objects[i]) ||
          (this._objects[i]).isContainedWithinObject(object)) {     //<--- this line
        nextIntersectingIdx = i;
        break;
      }
    }
Owner

kangax commented Aug 20, 2012

Why is this necessary?

I can't bring forward greater object to cover whole lesser object. But maybe I shouldn't be able to do this?

More precisely: I have two rectangles - rect A spanned by (0,0) and (100,100), rect B spanned by (20,20) and (80,80). If the rect A is under the rect B and I invoke method bringForward with rect A as active - nothing happens (I have to call bringToFront()).

Owner

kangax commented Aug 27, 2012

Yes, I remember we did it like this on purpose. I don't remember what exactly that purpose was :/

@kangax kangax closed this in 48443c1 Oct 28, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment