[Seaside] javascript canvas

Sebastian Sastre ssastre at seaswork.com
Tue May 27 14:01:57 UTC 2008


Hi Yan,
	
	I don’t know about anything to do that but sounds like a convenient way
to factor (encapsulating in a new object) all that drawing code. I think it
should be a concrete one like a Square class child of Shape class. Nothing stops
you to creating those. I use a lot the "Seaside scriptaculous way" of
serializing objects to javascript code similar to that. In fact that's the way
we are (slowly) providing access to jQuery features.

	cheers,

Sebastian Sastre


> -----Mensaje original-----
> De: seaside-bounces at lists.squeakfoundation.org 
> [mailto:seaside-bounces at lists.squeakfoundation.org] En nombre 
> de Yan Laporte
> Enviado el: Lunes, 26 de Mayo de 2008 15:48
> Para: Seaside - general discussion
> Asunto: Re: [Seaside] javascript canvas
> 
> Yes, but not quite.. What I see in the HTML5 package is just the
> canvas tag, not the facilities to draw to this canvas. I'll explain
> what I mean with a small example that works without the facilities I
> imagine.
> 
> html canvas width:100;height:100;script:(
> 	(((html javascript element) call: #getContext
> argument:'2d')assignLocalTo:#myDrawing)
> 		after:((html javascript alias:#myDrawing) 
> access:#fillStyle;
> assign:Color blue);
> 		after:((html javascript alias:#myDrawing)call:#fillRect
> arguments:#(10 10 40 40))).
> 
> The code above draws a simple blue square.
> Now I far form an expert and I suspect this code could be lighter so I
> am open to suggestions.
> 
> Now, what I meant by classes to make this easier would beto allow
> something along the lines of:
> |myCanvas|
> ...
> html canvas width:100;height:10.
> (DrawingContext on:myCanvas)
>     fillStyle:ColorBlue;
>     fillRect:(10 at 10 extent:40 at 40).
> Where DrawingContext is this thing that doesn't exist yet...
> 
> yl
> 
> 
> 
> 
> 
> 
> 2008/5/26 Philippe Marschall <philippe.marschall at gmail.com>:
> > 2008/5/26 Yan Laporte <spamlessyan at gmail.com>:
> >> I remember someone was working on smalltalk classes to 
> make it easier
> >> to draw to a canvas element using javascript. I now find myself
> >> wanting to do exactly that and was wondering if there is anything
> >> available before I duplicate efforts.
> >> I didn't find anything relevant in squeaksource. Anyone?
> >
> > HTML5 from the Seaside repository?
> >
> > Cheers
> > Philippe
> > _______________________________________________
> > seaside mailing list
> > seaside at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list