[Pharo-project] Strange logic in PolygonMorph>>fromHand: hand
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]].
Stéphane Ducasse wrote
Now I see this method and I wonder (replacing Sensor by hand does not work. ... What do you think?
I'm reimplementing it without Sensor, integrated well with Morphic... It's almost done... I'll try to upload tonight. Sean -- View this message in context: http://forum.world.st/Strange-logic-in-PolygonMorph-fromHand-hand-tp4629957p... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
On 13 May 2012 22:13, Sean P. DeNigris <sean@clipperadams.com> wrote:
Stéphane Ducasse wrote
Now I see this method and I wonder (replacing Sensor by hand does not work. ... What do you think?
I'm reimplementing it without Sensor, integrated well with Morphic... It's almost done... I'll try to upload tonight.
You're too slow. We did it already :) Today, when i left Stef's place there was only 27 users of Sensor left .. :)
Sean
-- View this message in context: http://forum.world.st/Strange-logic-in-PolygonMorph-fromHand-hand-tp4629957p... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Best regards, Igor Stasenko.
Igor Stasenko wrote
You're too slow. We did it already :)
WTF!!! You guys are getting too good, lol. One thing... The instance creation should be: poly := PolygonMorph vertices: { p1. p1 } color: Color transparent borderWidth: 2 borderColor: opposite. poly openInWorld. Right now it's returning a LineMorph. -- View this message in context: http://forum.world.st/Strange-logic-in-PolygonMorph-fromHand-hand-tp4629957p... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
On 14 May 2012 04:33, Sean P. DeNigris <sean@clipperadams.com> wrote:
Igor Stasenko wrote
You're too slow. We did it already :)
WTF!!! You guys are getting too good, lol.
One thing... The instance creation should be:
    poly := PolygonMorph         vertices: { p1. p1 }         color: Color transparent         borderWidth: 2         borderColor: opposite.     poly openInWorld.
Right now it's returning a LineMorph.
yeah, i wonder myself why it using LineMorph. but we were concentrated on replacing other parts of code.
-- View this message in context: http://forum.world.st/Strange-logic-in-PolygonMorph-fromHand-hand-tp4629957p... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Best regards, Igor Stasenko.
Sean thanks a lot. pay attention we already did it. Check less sensor bug entry: http://code.google.com/p/pharo/issues/detail?id=5887 Stef On May 13, 2012, at 10:13 PM, Sean P. DeNigris wrote:
Stéphane Ducasse wrote
Now I see this method and I wonder (replacing Sensor by hand does not work. ... What do you think?
I'm reimplementing it without Sensor, integrated well with Morphic... It's almost done... I'll try to upload tonight.
Sean
-- View this message in context: http://forum.world.st/Strange-logic-in-PolygonMorph-fromHand-hand-tp4629957p... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
participants (3)
-
Igor Stasenko -
Sean P. DeNigris -
Stéphane Ducasse