Hi
It seems that the bug is link with the fact that the cursor get outside the
bounds or not.
If you click and do not move or move but stay inside the morph it is ok
Now if you click and the mouse gets outside the bounds we get the funny and bad
behavior.
I'm definitely exhausted now to think…. but here is the code for the night
hackers :)
mouseDown: evt
oldColor := self fillStyle.
mouseMove: evt
(self containsPoint: evt cursorPoint)
ifTrue: [self setSwitchState: (oldColor = offColor)]
ifFalse: [self setSwitchState: (oldColor = onColor)].
mouseUp: evt
(self containsPoint: evt cursorPoint)
ifTrue: [ "toggle and do action"
self setSwitchState: (oldColor = offColor).
self doButtonAction]
ifFalse: [ "restore old appearance"
self setSwitchState: (oldColor = onColor)].