[Laszlo-dev] How should I factor platform-specific methods of LFC classes?
Henry Minsky
henry.minsky at gmail.com
Thu Aug 3 13:26:40 EDT 2006
There is basically only one sprite that gets created with isroot = true, so
I am planning to
make it so only that sprite calls back to its owner with a mouseMoved(x,y)
callback.
I'm going to add this to LzSprite:
if (isroot) {
...
...
LzSprite.rootSprite = this;
So there will be a global named LzSprite.rootSprite which represents the
canvas' sprite in the
kernel, and various methods that really want to talk to the canvas can talk
to LzSprite.rootSprite.owner
Does that sound sensible?
On 8/2/06, Henry Minsky <henry.minsky at gmail.com> wrote:
>
> Is this THE way that mouse x and y are passed to the LFC? I ask because I
> want to add support to the SVG kernel as well :-)
>
>
> On 8/2/06, Max Carlson < max at openlaszlo.org> wrote:
> >
> > Henry Minsky wrote:
> > >
> > >
> > > For example, in the DHTML canvas file there is a method
> > >
> > > LzCanvas.prototype.mouseMoved = function ( e ){
> > > //Debug.info('mouseMoved', e);
> > > var p = this.sprite.getPos();
> > > if (e.pageX || e.pageY ) {
> > > this.mousex = e.pageX - p.x;
> > > this.mousey = e.pageY - p.y;
> > > } else if (e.clientX || e.clientY) {
> > > this.mousex = e.clientX - p.x;
> > > this.mousey = e.clientY - p.y;
> > > }
> > >
> > > //Debug.write( this.uid , this.mousex , this.mousey );
> > > }
> > >
> > > which gets passed a DHTML-specific event object.
> > >
> > > I don't want to have another file which defines methods on LzCanvas,
> > but
> > > I'd like to have an API so that
> > > we can attach platform-specific objects. In this case I guess we have
> > a
> > > specially designated root LzSprite object
> > > attached to the canvas, so these methods should probably go on
> > LzSprite.
> > > The question is how to ensure that the
> > > mousex and mousey values get set on LzCanvas. Maybe a callback API for
> > > the kernel, like updateMousePosition which
> > > canvas (or view) has to support?
> >
> > I think you hit the nail on the head. Can you update the kernel API
> > spec to reflect this? Thanks!
> >
> > -Max
> >
>
>
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>
>
--
Henry Minsky
Software Architect
hminsky at laszlosystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20060803/32ace653/attachment.html
More information about the Laszlo-dev
mailing list