[squeak-dev] Fractional co-ordinates
Rodney Polkinghorne
rodneyp at physics.uq.edu.au
Fri May 20 02:30:19 UTC 2011
Hi again
I've noticed that Morphic handes floating-point co-ordinates such as
0.5, but raises a error with rational ones such as (1/2). See change
set below. I think this behaviour is inherited from the drawing
primitives.
To my mind, this is clearly wrong - if I can reduce things by 2.0, I
should be able to reduce them by 2. As a workaround, I'm inclined to
add an "asFloat" to PolygonMorph>>vertexAt:Put:. Being new to
Smalltalk, I don't know what's right in general.
I tried to make this a test case, which asserted that a 0.5 morph lit
up the same pixels as a 1/2 one. I couldn't think of a way to do
that. Is it possible?
Rodney
Change set follows:
'From Squeak4.2 of 4 February 2011 [latest update: #10966] on 20 May
2011 at 12:08:59 pm'!
Morph subclass: #BrokenMorph
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Variational-Morphs'!
!BrokenMorph methodsFor: 'as yet unclassified' stamp: 'resp 5/20/2011 10:45'!
drawOn: aCanvas
"This works if 1/2 is replaced by 0.5"
aCanvas fillRectangle: (self bounds insetBy: 1/2) color: Color red! !
More information about the Squeak-dev
mailing list
|