Ben

I started to understand what is wrong: 
- if I click on the moprh + keep down and slightly move
-> the morph toggles as if I would have released the mouse button.

and this is not linked to the fact that I get outside the bounds of the morph.

Stef


On May 20, 2013, at 10:55 PM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote:

I will try to have a look tomorrow afternoon :)

Ben

On May 20, 2013, at 10:50 PM, St�phane Ducasse <stephane.ducasse@inria.fr> wrote:

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)].