[squeak-dev] The Trunk: Morphic-ar.195.mcz

Hans-Martin Mosner hmm at heeg.de
Sun Oct 4 20:02:22 UTC 2009


commits at source.squeak.org schrieb:
> Andreas Raab uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-ar.195.mcz
>   
The method LayoutFrame>>minExtentFrom: in that version raises a division
by zero exception if leftFraction=rightFraction or
topFraction=bottomFraction.
The following version avoids this.

Cheers,
Hans-Martin

minExtentFrom: minExtent
    "Return the minimal extent the given bounds can be represented in"
    | width height left right top bottom |
    left := leftFraction ifNil: [0.0].
    right := rightFraction ifNil: [1.0].
    width := left = right
        ifTrue: [0]
        ifFalse: [minExtent x / (right - left)].
    top := topFraction ifNil: [0.0].
    bottom := bottomFraction ifNil: [1.0].
    height := top = bottom
        ifTrue: [0]
        ifFalse: [minExtent y / (bottom - top)].
    leftOffset ifNotNil:[width := width + leftOffset].
    rightOffset ifNotNil:[width := width + rightOffset].
    topOffset ifNotNil:[height := height + topOffset].
    bottomOffset ifNotNil:[height := height + bottomOffset].
    ^width truncated @ height truncated




More information about the Squeak-dev mailing list