Indeed is weird. I think it has to explicitly call runStepMethods,
because it's not forking , thus taking control of the ui process, does
it make sense?

I would remove the method (and all the similar ones found in the
image, that explicitly reference Sensor and while doing "true
whileTrue:[ ...]", if needed it would be have to re-done using the new
event model with announcements.

Fernando

On Sun, May 13, 2012 at 10:20 AM, Stéphane Ducasse
<[email protected]> wrote:
> Hi
>
> I'm cleaning Sensor use so that we end up with a better layered system.
> Now I see this method and I wonder (replacing Sensor by hand does not work.
> But I do not understand why this methods has to explicitly invoke 
> runStepMethods… to me it looks like a broken behavior
> due probably to the lack of a functionality or ticking behavior.
>
> What do you think?
>
> fromHand: hand
>        "Let the user draw a polygon, clicking at each vertex, and ending
>                by clicking within 5 of the first point..."
>        "self fromHand: ActiveHand"
>
>        | p1 poly oldVerts pN opposite |
>        Cursor crossHair showWhile:
>                [[Sensor anyButtonPressed] whileFalse:
>                        [self currentWorld displayWorldSafely; runStepMethods].
>                p1 := Sensor cursorPoint].
>        opposite := (Display colorAt: p1) negated.
>        opposite = Color transparent ifTrue: [opposite := Color red].
>        (poly := LineMorph from: p1 to: p1 color: opposite width: 2) 
> openInWorld.
>        oldVerts := {p1}.
>        self currentWorld displayWorldSafely; runStepMethods.
>        [true] whileTrue:
>                [[Sensor anyButtonPressed] whileTrue:
>                        [pN := Sensor cursorPoint.
>                        poly setVertices: (oldVerts copyWith: pN).
>                        self currentWorld displayWorldSafely; runStepMethods].
>                (oldVerts size > 1 and: [(pN dist: p1) < 5]) ifTrue:
>                        [hand position: Sensor cursorPoint.  "Done -- update 
> hand pos"
>                        ^ (poly setVertices: (poly vertices copyWith: p1)) 
> delete].
>                oldVerts := poly vertices.
>                [Sensor anyButtonPressed] whileFalse:
>                        [pN := Sensor cursorPoint.
>                        poly setVertices: (oldVerts copyWith: pN).
>                        self currentWorld displayWorldSafely; runStepMethods]].
>
>

Reply via email to