PSVUtils

Description

Static utilities for PSV

Details

Members


<static, readonly> HalfPI :float

Short-Hand for PI/2

Details
float

<static, readonly> svgNS :string

Namespace for SVG creation

Details
string

<static, readonly> TwoPI :float

Short-Hand for PI*2

Details
float

Methods


<static> addClasses( element, className )

Adds one or several CSS classes to an element

Parameters
Name Type Description
element HTMLElement
className string
Details

<static> animation( options ) → {Promise}

Interpolates each property with an easing and optional delay

Parameters
Name Type Description
options Object
Name Type Attributes Default Description
properties Array.<Object>
properties[].start number
properties[].end number
duration int
delay int <optional>
0
easing string <optional>
'linear'
onTick AnimationOnTick

called on each frame

Returns

Promise with an additional "cancel" method

Details

<static> bound( x, min, max ) → {number}

Ensures that a number is in a given interval

Parameters
Name Type Description
x number
min number
max number
Returns
Details

<static> checkTHREE( ...components ) → {boolean}

Checks if some three.js components are loaded

Parameters
Name Type Attributes Description
components string <repeatable>
Returns
Details

<static> cleanTHREEScene( scene )

Removes all children of a three.js scene and dispose all textures

Parameters
Name Type Description
scene THREE.Scene
Details

<static> clone( src ) → {Object}

Clones an object

Parameters
Name Type Description
src Object
Returns
Details

<static> deepmerge( target, src ) → {Object}

Merges the enumerable attributes of two objects

Description

Replaces arrays and alters the target object.

Parameters
Name Type Description
target Object
src Object
Returns

target

Details

Nicholas Fisher <nfisher110@gmail.com>


<static> exitFullscreen()

Exits fullscreen mode

Details

<static> fullscreenEvent() → {string}

Gets the event name for fullscreen

Returns
Details

<static> getClosest( el, selector ) → {HTMLElement}

Gets the closest parent (can by itself)

Parameters
Name Type Description
el HTMLElement

(HTMLElement)

selector string
Returns
Details

<static> getMaxTextureWidth() → {int}

Gets max texture width in WebGL context

Returns
Details

<static> getShortestArc( from, to ) → {float}

Compute the shortest offset between two longitudes

Parameters
Name Type Description
from float
to float
Returns
Details

<static> getStyle( elt, prop ) → {*}

Gets an element style

Parameters
Name Type Description
elt HTMLElement
prop string
Returns
Details

<static> getWebGLCtx() → {WebGLRenderingContext}

Tries to return a canvas webgl context

Returns
Details

<static> getXMPValue( data, attr )

Returns the value of a given attribute in the panorama metadata

Parameters
Name Type Description
data string
attr string
Returns

(string)

Details

<static> hasParent( el, parent ) → {boolean}

Searches if an element has a particular parent at any level including itself

Parameters
Name Type Description
el HTMLElement
parent HTMLElement
Returns
Details

<static> isCanvasSupported() → {boolean}

Detects if canvas is supported

Returns
Details

<static> isFullscreenEnabled( elt ) → {boolean}

Detects if fullscreen is enabled

Parameters
Name Type Description
elt HTMLElement
Returns
Details

<static> isInteger( value ) → {boolean}

Checks if a value is an integer

Parameters
Name Type Description
value *
Returns
Details

<static> isPlainObject( obj ) → {boolean}

Test if an object is a plain object

Description

Test if an object is a plain object, i.e. is constructed by the built-in Object constructor and inherits directly from Object.prototype or null. Some built-in objects pass the test, e.g. Math which is a plain object and some host or exotic objects may pass also. http://stackoverflow.com/a/5878101/1207670

Parameters
Name Type Description
obj *
Returns
Details

<static> isWebGLSupported() → {boolean}

Detects if WebGL is supported

Returns
Details

<static> mouseWheelEvent() → {string}

Gets the event name for mouse wheel

Returns
Details

<static> parseAngle( angle [, reference ] ) → {float}

Parses an angle value in radians or degrees and returns a normalized value in radians

Parameters
Name Type Attributes Default Description
angle string | number

eg: 3.14, 3.14rad, 180deg

reference float | boolean <optional>
0

base value for normalization, false to disable

Returns
Throws

when the angle cannot be parsed

Details

<static> parsePosition( value ) → {Object}

Translate CSS values like "top center" or "10% 50%" as top and left positions

Description

The implementation is as close as possible to the "background-position" specification https://developer.mozilla.org/en-US/docs/Web/CSS/background-position

Parameters
Name Type Description
value string
Returns
Details

<static> parseSpeed( speed ) → {float}

Parses an speed

Parameters
Name Type Description
speed string

The speed, in radians/degrees/revolutions per second/minute

Returns

radians per second

Throws

when the speed cannot be parsed

Details

<static> removeClasses( element, className )

Removes one or several CSS classes to an element

Parameters
Name Type Description
element HTMLElement
className string
Details

<static> requestFullscreen( elt )

Enters fullscreen mode

Parameters
Name Type Description
elt HTMLElement
Details

<static> sum( array ) → {number}

Computes the sum of an array

Parameters
Name Type Description
array Array.<number>
Returns
Details

<static> throttle( func, wait ) → {function}

Returns a function, that, when invoked, will only be triggered at most once during a given window of time.

Parameters
Name Type Description
func function
wait int
Returns
Details

underscore.js - modified by Clément Prévost http://stackoverflow.com/a/27078401


<static> toggleClass( element, className [, active ] )

Toggles a CSS class

Parameters
Name Type Attributes Description
element HTMLElement | SVGElement
className string
active boolean <optional>

forced state

Details