No strong dislike either way.

It doesn't actually make it much clearer and seems like it's a rename for
its own sake.

I'll follow the convention that p2d.java goes with no matter my opinion, but
for now I'm just making it match.

On 1 September 2010 15:48, Michael Heuer <heue...@gmail.com> wrote:

> Shoot, you don't like the new method names suggested in Issue 166?  ;)
>
>   michael
>
>
> On Wed, Sep 1, 2010 at 2:46 PM,  <piccol...@googlecode.com> wrote:
> > Revision: 1067
> > Author: allain.lalonde
> > Date: Wed Sep  1 12:45:28 2010
> > Log: JS: Adding moveToFront and moveToBack to PNode
> > http://code.google.com/p/piccolo2d/source/detail?r=1067
> >
> > Modified:
> >  /piccolo2d.js/trunk/piccolo2d.js
> >  /piccolo2d.js/trunk/test.html
> >
> > =======================================
> > --- /piccolo2d.js/trunk/piccolo2d.js    Wed Sep  1 12:01:18 2010
> > +++ /piccolo2d.js/trunk/piccolo2d.js    Wed Sep  1 12:45:28 2010
> > @@ -509,6 +509,32 @@
> >
> >         getScale: function() {
> >           return this.transform.getScale();
> > +        },
> > +
> > +        moveToFront: function() {
> > +            if (this.parent && this.parent.children.length > 1) {
> > +                this.parent.children =
> this.parent.children.remove(this);
> > +                this.parent.children.push(this);
> > +
> > +                this.invalidatePaint();
> > +            }
> > +            return this;
> > +        },
> > +
> > +        moveToBack: function() {
> > +            if (this.parent && this.parent.children.length > 1) {
> > +                var newSiblings = [this];
> > +                for (var i=0, n = this.parent.children.length; i<n; i++)
> {
> > +                    if (this.parent.children[i] != this) {
> > +                      newSiblings.push(this.parent.children[i]);
> > +                    }
> > +                }
> > +
> > +                this.parent.children = newSiblings;
> > +
> > +                this.invalidatePaint();
> > +            }
> > +            return this;
> >         }
> >     });
> >
> > @@ -743,10 +769,10 @@
> >             function dispatchEvent(type, event, pickedNodes) {
> >                 var currentNode, listener;
> >
> > -                for (var nodeIndex  = 0; nodeIndex < pickedNodes.length;
> > nodeIndex += 1) {
> > +                for (var nodeIndex  = 0, pickedNodeCount =
> > pickedNodes.length; nodeIndex < pickedNodeCount; nodeIndex += 1) {
> >                     currentNode = pickedNodes[nodeIndex];
> >                     while (currentNode) {
> > -                        for (var i = 0; i <
> currentNode.listeners.length; i
> > += 1) {
> > +                        for (var i = 0, listenerCount =
> > currentNode.listeners.length; i < listenerCount; i += 1) {
> >                             listener = currentNode.listeners[i];
> >                             if (listener[type]) {
> >                                 listener[type]({
> > =======================================
> > --- /piccolo2d.js/trunk/test.html       Wed Sep  1 12:01:18 2010
> > +++ /piccolo2d.js/trunk/test.html       Wed Sep  1 12:45:28 2010
> > @@ -465,6 +465,36 @@
> >             testNode.getFullBounds();
> >             ok(layoutChildrenCalled, "layoutChildren was not called");
> >         });
> > +
> > +        test("Move to front places child node at end of its parent's
> > children", function() {
> > +            var a = new PNode();
> > +            var b = new PNode();
> > +            var parent = new PNode();
> > +            parent.addChild(a);
> > +            parent.addChild(b);
> > +            a.moveToFront();
> > +            same(parent.children[1], a);
> > +        });
> > +
> > +        test("Move to back places child node at front of its parent's
> > children", function() {
> > +            var a = new PNode();
> > +            var b = new PNode();
> > +            var parent = new PNode();
> > +            parent.addChild(a);
> > +            parent.addChild(b);
> > +            b.moveToBack();
> > +            same(parent.children[0], b);
> > +        });
> > +
> > +        test("Move to front does nothing if child has no parent",
> > function() {
> > +            var a = new PNode();
> > +            a.moveToFront();
> > +        });
> > +
> > +        test("Move to back does nothing if child has no parent",
> function()
> > {
> > +            var a = new PNode();
> > +            a.moveToBack();
> > +        });
> >       }
> >
> >       function testPRoot() {
> >
> > --
> > Piccolo2D Developers Group:
> > http://groups.google.com/group/piccolo2d-dev?hl=en
>
> --
> Piccolo2D Developers Group:
> http://groups.google.com/group/piccolo2d-dev?hl=en
>

-- 
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en

Reply via email to