Re: [Sugar-devel] [Karma] Re: progress and issues w/ adding_up

2009-09-04 Thread Bryan Berry
On Fri, 2009-09-04 at 02:14 -0500, Felipe López Toledo wrote:
> I like the objective, but I dislike the name. 

we can stay w/ KLayer then ;)

> I think, you're referring to "saving"  like taking a canvas snapshot
> and "restoring" it, rigth?

exactly!

-- 
Bryan W. Berry
Technology Director
OLE Nepal, http://www.olenepal.org

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [Karma] Re: progress and issues w/ adding_up

2009-09-04 Thread Felipe López Toledo
>
> I think it could be useful to rename klayer to KArea or KZone, an object
> that gives u easy access to the canvas and context.
>
I like the objective, but I dislike the name.

I think it could be useful to rename klayer to KArea or KZone, an object
> that gives u easy access to the canvas and context. We would also need
> this object later when we try to save its image state, i.e. save what
> has been drawn so we can come back they don't lose everything that has
> happened on the canvas. I am talking about save() and restore() in a
> more complex and powerful way than ctx.save() or ctx.restore(), which
> only save the drawing state.
>
I think, you're referring to "saving"  like taking a canvas snapshot and
"restoring" it, rigth?

2009/9/3 Bryan Berry 

> also another issue i have is that I can't attach a kbutton to a specific
> context. I hacked it by adding the event listener directly to the canvas
> element.
>
> I think it could be useful to rename klayer to KArea or KZone, an object
> that gives u easy access to the canvas and context. We would also need
> this object later when we try to save its image state, i.e. save what
> has been drawn so we can come back they don't lose everything that has
> happened on the canvas. I am talking about save() and restore() in a
> more complex and powerful way than ctx.save() or ctx.restore(), which
> only save the drawing state.
>
> also, with KArea or KZone, we could use that object to move the html
> element around, be shrink it, reposition it on the page.
>
> On Thu, 2009-09-03 at 17:56 +0545, Bryan Berry wrote:
> > I have adding_up kind of working w/ the new html layout, but it doesn't
> > actually add up to the correct sum :(
> >
> > Problem #1
> >
> > I kept getting an infinite loop in this section in the distance2() call
> >
> > I have to admit I don't exactly understand what distance2 is doing
> >
> http://git.sugarlabs.org/projects/karma/repos/mainline/blobs/multicanvas/examples/adding_up_to_10/js/lesson.js#line142
> >
> > for ( var j=0; j >   if ( k.geometry.distance2( pos[j], {"x": x, "y": y} ) < 80 ) {
> flag
> > = true;
> >   break; }  }
> > }while ( flag === true );
> > pos.push( { "x":x, "y": y } );
> > k.library.images[ imgId ].draw(ctx, x, y )}
> >
> > Also, i don't understand how u can call distance2 w/ pos[j] when pos is
> > still an empty array. Maybe it is because js just does a lot of weird
> > stuff.
> >
> > Problem #2
> >
> > None of the answer boxes holds the correct sum :(
> >
> > I am not sure where the logic error is but I am hunting for it!
> >
> > as we discussed yesterday, i have put all this work on the "multicanvas"
> > tree.
> > http://git.sugarlabs.org/projects/karma/repos/mainline/trees/multicanvas
> >
> >
> --
> Bryan W. Berry
> Technology Director
> OLE Nepal, http://www.olenepal.org
>
>


-- 
Felipe López Toledo
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [Karma] Re: progress and issues w/ adding_up

2009-09-03 Thread Bryan Berry
also another issue i have is that I can't attach a kbutton to a specific
context. I hacked it by adding the event listener directly to the canvas
element.

I think it could be useful to rename klayer to KArea or KZone, an object
that gives u easy access to the canvas and context. We would also need
this object later when we try to save its image state, i.e. save what
has been drawn so we can come back they don't lose everything that has
happened on the canvas. I am talking about save() and restore() in a
more complex and powerful way than ctx.save() or ctx.restore(), which
only save the drawing state.

also, with KArea or KZone, we could use that object to move the html
element around, be shrink it, reposition it on the page.

On Thu, 2009-09-03 at 17:56 +0545, Bryan Berry wrote:
> I have adding_up kind of working w/ the new html layout, but it doesn't
> actually add up to the correct sum :(
> 
> Problem #1 
> 
> I kept getting an infinite loop in this section in the distance2() call
> 
> I have to admit I don't exactly understand what distance2 is doing
> http://git.sugarlabs.org/projects/karma/repos/mainline/blobs/multicanvas/examples/adding_up_to_10/js/lesson.js#line142
> 
> for ( var j=0; j   if ( k.geometry.distance2( pos[j], {"x": x, "y": y} ) < 80 ) { flag
> = true; 
>   break; }  }
> }while ( flag === true ); 
> pos.push( { "x":x, "y": y } ); 
> k.library.images[ imgId ].draw(ctx, x, y )}
> 
> Also, i don't understand how u can call distance2 w/ pos[j] when pos is
> still an empty array. Maybe it is because js just does a lot of weird
> stuff. 
> 
> Problem #2
> 
> None of the answer boxes holds the correct sum :(
> 
> I am not sure where the logic error is but I am hunting for it!
> 
> as we discussed yesterday, i have put all this work on the "multicanvas"
> tree.
> http://git.sugarlabs.org/projects/karma/repos/mainline/trees/multicanvas
> 
> 
-- 
Bryan W. Berry
Technology Director
OLE Nepal, http://www.olenepal.org

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel