Skip to content

Orientation

Overview

Either horizontal or vertical, with helper values. Moved from Area Model Common on Nov 7, 2019

@author Jonathan Olson <jonathan.olson@colorado.edu> @author Sam Reid (PhET Interactive Simulations)

Class Orientation

import { Orientation } from 'scenerystack/phet-core';

Constructor

new Orientation( coordinate : 'x' | 'y', centerCoordinate : 'centerX' | 'centerY', minCoordinate : 'minX' | 'minY', maxCoordinate : 'maxX' | 'maxY', minSide : 'left' | 'top', maxSide : 'right' | 'bottom', minSize : 'minWidth' | 'minHeight', maxSize : 'maxWidth' | 'maxHeight', rectCoordinate : 'rectX' | 'rectY', rectSize : 'rectWidth' | 'rectHeight', flowBoxOrientation : 'horizontal' | 'vertical', size : 'width' | 'height', line : 'column' | 'row', preferredSize : 'preferredWidth' | 'preferredHeight', localPreferredSize : 'localPreferredWidth' | 'localPreferredHeight', sizable : 'widthSizable' | 'heightSizable', modelToView : ( m: MVT, n: number ) => number, viewToModel : ( m: MVT, n: number ) => number, toVector : <T>( n: number, m: number, VectorType: new ( x: number, y: number, ...args: IntentionalAny[] ) => T ) => T )

Instance Methods

Instance Properties

coordinate : 'x' | 'y'

(readonly)

centerCoordinate : 'centerX' | 'centerY'

(readonly)

minCoordinate : 'minX' | 'minY'

(readonly)

maxCoordinate : 'maxX' | 'maxY'

(readonly)

minSide : 'left' | 'top'

(readonly)

maxSide : 'right' | 'bottom'

(readonly)

minSize : 'minWidth' | 'minHeight'

(readonly)

maxSize : 'maxWidth' | 'maxHeight'

(readonly)

rectCoordinate : 'rectX' | 'rectY'

(readonly)

rectSize : 'rectWidth' | 'rectHeight'

(readonly)

flowBoxOrientation : 'horizontal' | 'vertical'

(readonly)

size : 'width' | 'height'

(readonly)

line : 'column' | 'row'

(readonly)

preferredSize : 'preferredWidth' | 'preferredHeight'

(readonly)

localPreferredSize : 'localPreferredWidth' | 'localPreferredHeight'

(readonly)

sizable : 'widthSizable' | 'heightSizable'

(readonly)

ariaOrientation : 'horizontal' | 'vertical'

(readonly)

modelToView : ( m: MVT, n: number ) => number

Returns the single coordinate transformed by the appropriate dimension.

viewToModel : ( m: MVT, n: number ) => number

toVector : <T>( n: number, m: number, VectorType: Constructor<T> ) => T

Creates a vector (primary,secondary) for horizontal orientations, and (secondary,primary) for vertical orientations.

opposite : Orientation

@ts-expect-error - Assigned after instantiation, see below

Static Methods

fromLayoutOrientation( layoutOrientation : 'horizontal' | 'vertical' ) : Orientation

Static Properties

HORIZONTAL : Orientation

(readonly)

VERTICAL : Orientation

(readonly)

enumeration : Enumeration

(readonly)

Source Code

See the source for Orientation.ts in the phet-core repository.