Skip to content

Drawer

Overview

A drawer that opens/closes to show/hide its contents.

@author Chris Malley (PixelZoom, Inc.)

Class Drawer

import { Drawer } from 'scenerystack/scenery-phet';

Constructor

new Drawer( contentsNode : Node, provideOptions? : DrawerOptions )

Instance Methods

dispose()

reset( animationEnabled? : boolean )

@param [animationEnabled]

setAnimationEnabled( animationEnabled : boolean )

Determines whether animation is enabled for opening/closing drawer.

getAnimationEnabled() : boolean

Is animation enabled for opening/closing drawer?

Instance Properties

openProperty : Property<boolean>

(readonly)

is the drawer open?

contentsNode : Node

(readonly)

what's in the drawer

Type DrawerOptions

import type { DrawerOptions } from 'scenerystack/scenery-phet';
  • size?: Dimension2 | null
    drawer
  • cornerRadius?: number
  • xMargin?: number
  • yMargin?: number
  • open?: boolean
  • handlePosition?: "top" | "bottom"
    handle
  • handleSize?: Dimension2
  • handleCornerRadius?: number
  • handleFill?: TColor
  • handleTouchAreaXDilation?: number
  • handleTouchAreaYDilation?: number
  • handleMouseAreaXDilation?: number
  • handleMouseAreaYDilation?: number
  • grippyDotRadius?: number
    grippy dots on handle
  • grippyDotColor?: TColor
  • grippyDotRows?: number
  • grippyDotColumns?: number
  • grippyDotXSpacing?: number
  • grippyDotYSpacing?: number
  • beforeOpen?: () => void
    Callbacks. The default behavior is to make contentNode visible only while the drawer is open. This can provide performance gains if your contentNode updates only while visible.
  • afterClose?: () => void
  • animationEnabled?: boolean
    animation
  • animationDuration?: number
  • stepEmitter?: TReadOnlyEmitter<[ number ]> | null
  • & StrictOmit<NodeOptions, "children" | "clipArea">

Source Code

See the source for Drawer.ts in the scenery-phet repository.