home *** CD-ROM | disk | FTP | other *** search
/ Knitting Made Easy / Knitting.iso / App / Patterns.dxr / Text_127_textp17.ls < prev    next >
Encoding:
Text File  |  2002-04-18  |  1.4 KB  |  46 lines

  1. property pTextSprite, pTextMember, pTextLowerLImit, pTextRange, pLineSize, pPageSize, pTextOrigin
  2.  
  3. on beginSprite me
  4.   pLineSize = 13
  5.   totalLines = 15
  6.   pPageSize = totalLines * pLineSize
  7.   pTextSprite = me.spriteNum
  8.   pTextOrigin = the locV of sprite pTextSprite
  9.   pTextMember = the member of sprite pTextSprite
  10.   lastOffset = integer(0.5 * totalLines) * pLineSize
  11.   textUpperLimit = member(pTextMember).height - lastOffset
  12.   pTextLowerLImit = 0
  13.   pTextRange = 2750
  14. end
  15.  
  16. on scrollText me, direction, scrollType
  17.   case 1 of
  18.     voidp(scrollType):
  19.       scrollAmount = pLineSize
  20.     (scrollType = #page):
  21.       scrollAmount = pPageSize
  22.   end case
  23.   if symbolp(direction) then
  24.     case direction of
  25.       #down:
  26.         scrollDirection = 1
  27.       #up:
  28.         scrollDirection = -1
  29.     end case
  30.     scrollVector = scrollAmount * scrollDirection
  31.     currentPosition = pTextOrigin - the locV of sprite pTextSprite
  32.     nextPosition = currentPosition + scrollVector
  33.     if nextPosition > (pTextLowerLImit + pTextRange) then
  34.       nextPosition = pTextLowerLImit + pTextRange
  35.     else
  36.       if nextPosition < pTextLowerLImit then
  37.         nextPosition = pTextLowerLImit
  38.       end if
  39.     end if
  40.   else
  41.     nextPosition = direction * pTextRange
  42.   end if
  43.   set the locV of sprite pTextSprite to pTextOrigin - nextPosition
  44.   sendAllSprites(#positionIndicator, float(nextPosition) / pTextRange)
  45. end
  46.