[Seaside] javascript canvas

Yan Laporte spamlessyan at gmail.com
Mon May 26 18:48:29 UTC 2008


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
>


More information about the seaside mailing list