Transcript cr; show: 'Filing in FreeDrawPane'!

GraphPane subclass: #FreeDrawPane
  instanceVariableNames: ''
  classVariableNames: ''
  poolDictionaries: '' !

!FreeDrawPane class methods ! !


!FreeDrawPane methods !

defaultDispatcherClass
        "Answer the default dispatcher class, FormEditor."
    ^FormEditor!

initTopCorner
    "Set the topCorner so that the bit
     position in the source Form is
     alligned with the one in destination."
    topCorner :=
        (frame origin x \\ 8) @ 0!

scrollHand: oldPoint to: newPoint
        "Scroll by dragging form with cursor (hand cursor)"
    | distance i |
    distance := newPoint x - oldPoint x // 8 * 8
        @ (newPoint y - oldPoint y).
    topCorner := topCorner - distance.
    [topCorner x < 0]
        whileTrue: [topCorner x: topCorner x + 8].
    topCorner y < 0
        ifTrue: [topCorner y: 0].
    i := formHolder width - frame width max: 0.
    [topCorner x > i]
        whileTrue: [topCorner x: topCorner x - 8].
    i := formHolder height - frame height max: 0.
    topCorner y > i
        ifTrue: [topCorner y: i].
    paneScanner
        sourceOrigin: topCorner;
        copyBits.
    ^oldPoint + distance! !
