[Laszlo-dev] How should I factor platform-specific methods of LFC classes?

Max Carlson max at openlaszlo.org
Wed Aug 2 17:46:12 EDT 2006


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


More information about the Laszlo-dev mailing list