Friday, January 07, 2005

More Event Processing

I am still working to get a complete mental image of the event flow. Lets follow a left mouse down event from Morph to TObject in the world.

TeapotMorph >> handlesMouseDown is true, so TeapotMorph >> mouseDown is called, which calls activeCamera mouseDown.
TUserCamera >> mouseDown determines that it is a left (red) button, and calls
avatar selection: pointer selection pointerDown: evt.

"pointer selection" returns the TObject picked by the activeCamera's TPointer the last time the TPointer was rendered, which is happening constantly, whenever the TSpace is rendered.

TAvatar >> selection:pointerDown is where it gets fuzzy for me. The TAvatar belonging to the activeCamera has it's own distinct TCamera and TPointer. The class comments say that the TPointer is a replicated copy of the pointer in the activeCamera, but the only replication I have found refers to positioning the avatar's TLaser. It is also unclear what purpose the avatar's camera serves - the comments refer to it as a pseudo-camera.

Anyway, TAvatar >> selection:pointerDown first sets the avatar's camera's localtransform to that of the selected TObject, then sets the avatar's pointer's selected TObject, and then calls pointerDown on the avatar's pointer. Note: TAvatar has a selection:x: message for each possible event and they all do the same thing.

TPointer >> pointerDown then examines the pointer's selected TObject, and if it returns true for isComponant and handlesPointerDown, it's handlePointer message is sent. Thus the mouse click has made it from the morph to the TObject.