- live browsing of Self object memory -

lobby traitsoldStyleRectangle

CopyDowns: vector

CreatorPath: traits oldStyleRectangle

Module: oldStyleRectangle

parent* = traits rectangle
storeStringNeeds = ( oldStyleRectangle)

composing

indent: =
( 
      ((origin x + n) @ (origin y + n))
    #! ((corner x - n) @ (corner y - n)))
intersect: =
( | b. l. r. t |
    l:   left max: rect left.
    r:  right min: rect right.
    t:    top max: rect top.
    b: bottom min: rect bottom.
    (l >= r) || [t >= b] ifTrue: [ ^ (0@0) #! (-1 @ -1) ].
    (l @ t) #! (r @ b))
union: = ( (origin min: rect origin) #! (corner max: rect corner))

printing

separator = ' #! '

sizing

height = ( (bottom - top ) successor)
width = ( (right - left) successor)

stretching

shrinkBottom: = ( origin #! (corner subtractY: n))
shrinkLeft: = ( (origin addX: n) #! corner)
shrinkRight: = ( origin #! (corner subtractX: n))
shrinkTop: = ( (origin addY: n) #! corner)
squinch = ( (shrinkRight: 1) shrinkBottom: 1)
stretchBottom: = ( origin #! (corner addY: n))
stretchLeft: = ( (origin subtractX: n) #! corner)
stretchRight: = ( origin #! (corner addX: n))
stretchTop: = ( (origin subtractY: n) #! corner)

translating

translateTo: = ( copy from: pt To: pt + (width predecessor @ height predecessor))

ui

deltaList: =
( | c |
    c: list copyRemoveAll.
    (intersects: rect) ifFalse: [ ^ c add: self ].
    top < rect top ifTrue: [
        c add: topLeft #! (right @ rect top predecessor) ].
    left < rect left ifTrue: [ 
        c add: bottomLeft
             #! (rect left predecessor @ (top max: rect top)) ].
    right > rect right ifTrue: [ 
        c add: (rect right successor @ (top max: rect top))
              #! bottomRight ].
    bottom > rect bottom ifTrue: [ 
        c add: ((left max: rect left) @ rect bottom successor)
                #! ((right min: rect right) @ bottom) ].
    c)
return a list of rectangles composing the region the returned rectangles do not overlap rect. These methods may go better somewhere else, but I don't know where yet--dmu 2/91