[Questions]Events

Ned Konz ned at bike-nomad.com
Sat Jul 22 02:15:02 UTC 2000


"Raab, Andreas" wrote:
> 
> > Karl Ramberg wrote:
> > >
> > > I'm making some morphic stuff and use mouseEnter/mouseLeave events.
> > > But the morphs seem to miss about one out of five
> > > of the events.:-(
> >
> > This could be because of the polling; if the mouse doesn't happen
> > to be over the morph when we check position, then they don't get
> > called.
> 
> That's actually very unlikely. The way the hand works it should never miss a
> single #mouseEnter/#mouseLeave event. It could be that it misses the two of
> them together (e.g., when you rapidly move 'in-out-in' or 'out-in-out') but
> never a single one. If it does, it's a bug in HandMorph not in any event
> code.

I was thinking of the case where the HandMorph would not see any mouse positions
inside the morph (and so both the mouseEnter and mouseLeave events would not
be fired).

Think about really skinny morphs that the mouse is flying over... (like,
perhaps,
the halo morphs, or a StringMorph). If we're polling at 5 per second, and the
morph is, say, 8 pixels tall, then if the mouse is going faster than 40 pixels
per second it could be missed altogether. And my mouse goes as fast as 2800
pixels per second sometimes, per this test:


delay _ Delay forMilliseconds: 300.
max _ 0.
lastPoint _ Sensor mousePoint.
lastTime _ Time millisecondClockValue.
[
	delay wait.
	now _ Time millisecondClockValue.
	here _ Sensor mousePoint.
	rate _ ((lastPoint dist: here) / (now - lastTime)) * 1000.0 .
	lastTime _ now.
	lastPoint _ here.
	max _ rate max: max.
	max asString displayAt: 10 at 10.
	Sensor anyButtonPressed
] whileFalse.


So at 5/second poll rate, I could miss things that were smaller than 400
pixels or so!

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com





More information about the Squeak-dev mailing list