Wednesday, February 23, 2011

I want to go to there

From the excellent Deprecating the Observer Pattern by Odersky et al:

// step 1:
val path = new Path((self next mouseDown).position) 

// step 2: 
self loopUntil mouseUp {
 val m = self next mouseMove 
 path.lineTo(m.position) 
 draw(path)
}

// step 3:
path.close()
draw(path)

This is a complete implementation of a sketching application using scala-react.

No comments:

Post a Comment