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> 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> dasherize( str ) → {string}

Transforms a string to dash-case https:\\/\\/github.com/shahata/dasherize

Parameters
Name Type Description
str string
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> forEach( object, callback )

Description

Loops over enumerable properties of an object

Parameters
Name Type Description
object object
callback ForEach
Details

<static> fullscreenEvent() → {string}

Gets the event name for fullscreen

Returns
Details

<static> getAngle( position1, position2 ) → {number}

Computes the angle between the current position and a target position

Parameters
Name Type Description
position1 PhotoSphereViewer.Position
position2 PhotoSphereViewer.Position
Returns
Details

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

Gets the closest parent (can by itself)

Parameters
Name Type Description
el HTMLElement | SVGElement
selector string
Returns
Details

<static> getEventKey( evt ) → {string}

Returns the key name of a KeyboardEvent

Parameters
Name Type Description
evt KeyboardEvent
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> isDeviceOrientationSupported() → {Promise.<boolean>}

Detects if device orientation is supported

Description

We can only be sure device orientation is supported once received an event with coherent data

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> isTouchEnabled() → {Promise.<boolean>}

Detects if the user is using a touch screen

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> normalizeWheel( event ) → {Object}

Normalize mousewheel values accross browsers

Parameters
Name Type Description
event MouseWheelEvent
Returns
Details

Facebook


<static> parseAngle( angle [, zeroCenter [, halfCircle ] ] ) → {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

zeroCenter boolean <optional>
false

normalize between -Pi/2 - Pi/2 instead of 0 - 2*Pi

halfCircle boolean <optional>
zeroCenter

normalize between -Pi - Pi instead of -Pi/2 - Pi/2

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

Type Definitions


ForEach( value, key )

Parameters
Name Type Description
value *
key string
Details
function