Faking a Marquee Selection

Date: Fri, 26 Jul 1996 15:45:45 -0700
From: "WM (Shelly) Harris" 
Subject: creating a circle/square sizable marquee in Director
To: levine@maricopa.edu
MIME-version: 1.0
This is not a earthshaking tip, but its small and nice to have around for special occasions.

This is a script for letting a user resize a precisely circular/square selection marquee (like when holding down the shift key in Photoshop). This script lets users resize the marquee until they click, others might want to have it resize while the stillDown.

The other necessary ingredient is the sprite of a circular/square marquee bitmap castmember with a centered registration point.

on setRadius aSprite
  -- Take over the cursor (while they drag out a radius)
  -- until they click.
  -- For best results, aSprite should be registered at
  -- its center with a bitmap castmember, and puppetted.
  -- A custom cursor would be nice too.
  repeat while (the mouseUp = TRUE)
    
    set distX = abs(the mouseH - the locH of sprite aSprite)
    set distY = abs(the mouseV - the locV of sprite aSprite)
    
    if distX > distY then
      set newDiameter = 2 * distX
    else
      set newDiameter = 2 * distY
    end if
    
    set the height of sprite aSprite = newDiameter
    set the width of sprite aSprite = newDiameter

    updateStage
  end repeat
end setRadius

URL: