2019-03-29 08:49:53 +01:00
<!DOCTYPE html>
< html >
< head >
< meta charset = "utf-8" >
< title > iwmlib API Documentation< / title >
< meta name = "description" content = "The IWM Browser: One Browser for all apps." / >
< meta property = "og:title" content = "iwmlib API Documentation" / >
< meta property = "og:type" content = "website" / >
< meta property = "og:image" content = "" / >
< meta property = "og:url" content = "https://www.iwm-tuebingen.de" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1" >
< script src = "scripts/prettify/prettify.js" > < / script >
< script src = "scripts/prettify/lang-css.js" > < / script >
< script src = "scripts/jquery.min.js" > < / script >
<!-- [if lt IE 9]>
< script src = "//html5shiv.googlecode.com/svn/trunk/html5.js" > < / script >
<![endif]-->
< link href = "https://fonts.googleapis.com/css?family=Libre+Franklin:400,700" rel = "stylesheet" >
< link type = "text/css" rel = "stylesheet" href = "styles/prettify-tomorrow.css" >
< link type = "text/css" rel = "stylesheet" href = "styles/bootstrap.min.css" >
< link type = "text/css" rel = "stylesheet" href = "styles/main.css" >
< script >
var config = {"monospaceLinks":false,"cleverLinks":false,"applicationName":"iwmlib","disqus":"","googleAnalytics":"","openGraph":{"title":"iwmlib API Documentation","type":"website","image":"","site_name":"","url":"https://www.iwm-tuebingen.de"},"meta":{"title":"iwmlib API Documentation","description":"The IWM Browser: One Browser for all apps.","keyword":""},"linenums":true,"cleverlinks":true,"default":{"outputSourceFiles":true,"useLongnameInNav":false}};
< / script >
< / head >
< body >
< div id = "wrap" class = "clearfix" >
< div class = "navigation" >
< h3 class = "applicationName" > < a href = "index.html" > iwmlib< / a > < / h3 >
< button id = "menuToggle" class = "btn btn-link btn-lg menu-toggle" >
< span class = "glyphicon glyphicon-menu-hamburger" > < / span >
< / button >
< div class = "search" >
< input id = "search" type = "text" class = "form-control input-md" placeholder = "Search..." >
< / div >
< ul class = "list" >
< li class = "item" data-name = "global" >
< span class = "title namespace " >
< span class = "namespaceTag" >
< span class = "glyphicon glyphicon-globe" > < / span >
< / span >
< a href = "global.html" > Global< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< span class = "subtitle" > Typedefs< / span >
< li class = "parent" data-name = "actionActiveCallback" > < a href = "global.html#actionActiveCallback" > actionActiveCallback< / a > < / li >
< li class = "parent" data-name = "actionCallback" > < a href = "global.html#actionCallback" > actionCallback< / a > < / li >
< li class = "parent" data-name = "actionCallback" > < a href = "global.html#actionCallback" > actionCallback< / a > < / li >
< li class = "parent" data-name = "afterActionCallback" > < a href = "global.html#afterActionCallback" > afterActionCallback< / a > < / li >
< li class = "parent" data-name = "afterActionCallback" > < a href = "global.html#afterActionCallback" > afterActionCallback< / a > < / li >
< li class = "parent" data-name = "beforeActionCallback" > < a href = "global.html#beforeActionCallback" > beforeActionCallback< / a > < / li >
< li class = "parent" data-name = "beforeActionCallback" > < a href = "global.html#beforeActionCallback" > beforeActionCallback< / a > < / li >
< li class = "parent" data-name = "onCompleteCallback" > < a href = "global.html#onCompleteCallback" > onCompleteCallback< / a > < / li >
< li class = "parent" data-name = "onCompleteCallback" > < a href = "global.html#onCompleteCallback" > onCompleteCallback< / a > < / li >
< li class = "parent" data-name = "onStartCallback" > < a href = "global.html#onStartCallback" > onStartCallback< / a > < / li >
< li class = "parent" data-name = "onStartCallback" > < a href = "global.html#onStartCallback" > onStartCallback< / a > < / li >
< li class = "parent" data-name = "onUpdateCallback" > < a href = "global.html#onUpdateCallback" > onUpdateCallback< / a > < / li >
< li class = "parent" data-name = "onUpdateCallback" > < a href = "global.html#onUpdateCallback" > onUpdateCallback< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "AbstractPopup" >
< span class = "title " >
< a href = "AbstractPopup.html" > AbstractPopup< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = "parent " data-name = "AbstractPopup#content" > < a href = "AbstractPopup.html#content" > content< / a > < / li >
< li class = "parent " data-name = "AbstractPopup#header" > < a href = "AbstractPopup.html#header" > header< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "AbstractPopup#hide" > < a href = "AbstractPopup.html#hide" > hide< / a > < / li >
< li class = "parent " data-name = "AbstractPopup#layout" > < a href = "AbstractPopup.html#layout" > layout< / a > < / li >
< li class = "parent " data-name = "AbstractPopup#show" > < a href = "AbstractPopup.html#show" > show< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "Badge" >
< span class = "title " >
< a href = "Badge.html" > Badge< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = " " data-name = "Badge#content" > < a href = "Badge.html#content" > content< / a > < / li >
< li class = " " data-name = "Badge#header" > < a href = "Badge.html#header" > header< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = " " data-name = "Badge#hide" > < a href = "Badge.html#hide" > hide< / a > < / li >
< li class = " " data-name = "Badge#layout" > < a href = "Badge.html#layout" > layout< / a > < / li >
< li class = " " data-name = "Badge#show" > < a href = "Badge.html#show" > show< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "BlurFilter" >
< span class = "title " >
< a href = "BlurFilter.html" > BlurFilter< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = "parent " data-name = "BlurFilter#blur" > < a href = "BlurFilter.html#blur" > blur< / a > < / li >
< li class = "parent " data-name = "BlurFilter#shape" > < a href = "BlurFilter.html#shape" > shape< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "Button" >
< span class = "title " >
< a href = "Button.html" > Button< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = "parent " data-name = "Button#active" > < a href = "Button.html#active" > active< / a > < / li >
< li class = "parent " data-name = "Button#disabled" > < a href = "Button.html#disabled" > disabled< / a > < / li >
< li class = "parent " data-name = "Button#iconColor" > < a href = "Button.html#iconColor" > iconColor< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "Button#capture" > < a href = "Button.html#capture" > capture< / a > < / li >
< li class = "parent " data-name = "Button#hide" > < a href = "Button.html#hide" > hide< / a > < / li >
< li class = "parent " data-name = "Button#layout" > < a href = "Button.html#layout" > layout< / a > < / li >
< li class = "parent " data-name = "Button#show" > < a href = "Button.html#show" > show< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "ButtonGroup" >
< span class = "title " >
< a href = "ButtonGroup.html" > ButtonGroup< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = "parent " data-name = "ButtonGroup#disabled" > < a href = "ButtonGroup.html#disabled" > disabled< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "ButtonGroup#hide" > < a href = "ButtonGroup.html#hide" > hide< / a > < / li >
< li class = "parent " data-name = "ButtonGroup#layout" > < a href = "ButtonGroup.html#layout" > layout< / a > < / li >
< li class = "parent " data-name = "ButtonGroup#show" > < a href = "ButtonGroup.html#show" > show< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "DeepZoomImage" >
< span class = "title " >
< a href = "DeepZoomImage.html" > DeepZoomImage< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = "parent " data-name = "DeepZoomImage#baseSize" > < a href = "DeepZoomImage.html#baseSize" > baseSize< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#foreground" > < a href = "DeepZoomImage.html#foreground" > foreground< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#height" > < a href = "DeepZoomImage.html#height" > height< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#maxScale" > < a href = "DeepZoomImage.html#maxScale" > maxScale< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#pixelSize" > < a href = "DeepZoomImage.html#pixelSize" > pixelSize< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#width" > < a href = "DeepZoomImage.html#width" > width< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "DeepZoomImage#_calculateBounds" > < a href = "DeepZoomImage.html#_calculateBounds" > _calculateBounds< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#_createTiles" > < a href = "DeepZoomImage.html#_createTiles" > _createTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#activate" > < a href = "DeepZoomImage.html#activate" > activate< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#addTiles" > < a href = "DeepZoomImage.html#addTiles" > addTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#allTiles" > < a href = "DeepZoomImage.html#allTiles" > allTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#bringTilesToFront" > < a href = "DeepZoomImage.html#bringTilesToFront" > bringTilesToFront< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#calculateBounds" > < a href = "DeepZoomImage.html#calculateBounds" > calculateBounds< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#changedTiles" > < a href = "DeepZoomImage.html#changedTiles" > changedTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#deactivate" > < a href = "DeepZoomImage.html#deactivate" > deactivate< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#destroyObsoleteTiles" > < a href = "DeepZoomImage.html#destroyObsoleteTiles" > destroyObsoleteTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#destroyTiles" > < a href = "DeepZoomImage.html#destroyTiles" > destroyTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#destroyTilesAboveLevel" > < a href = "DeepZoomImage.html#destroyTilesAboveLevel" > destroyTilesAboveLevel< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#destroyUnneededTiles" > < a href = "DeepZoomImage.html#destroyUnneededTiles" > destroyUnneededTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#ensureAllTiles" > < a href = "DeepZoomImage.html#ensureAllTiles" > ensureAllTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#ensureTiles" > < a href = "DeepZoomImage.html#ensureTiles" > ensureTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#levelAndAlphaForScale" > < a href = "DeepZoomImage.html#levelAndAlphaForScale" > levelAndAlphaForScale< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#levelForScale" > < a href = "DeepZoomImage.html#levelForScale" > levelForScale< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#neededTiles" > < a href = "DeepZoomImage.html#neededTiles" > neededTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#populateAllTiles" > < a href = "DeepZoomImage.html#populateAllTiles" > populateAllTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#populateTiles" > < a href = "DeepZoomImage.html#populateTiles" > populateTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#setup" > < a href = "DeepZoomImage.html#setup" > setup< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#setupTiles" > < a href = "DeepZoomImage.html#setupTiles" > setupTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#thumbnail" > < a href = "DeepZoomImage.html#thumbnail" > thumbnail< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#tintObsoleteTiles" > < a href = "DeepZoomImage.html#tintObsoleteTiles" > tintObsoleteTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomImage#transformed" > < a href = "DeepZoomImage.html#transformed" > transformed< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "DeepZoomInfo" >
< span class = "title " >
< a href = "DeepZoomInfo.html" > DeepZoomInfo< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "DeepZoomInfo#dimensions" > < a href = "DeepZoomInfo.html#dimensions" > dimensions< / a > < / li >
< li class = "parent " data-name = "DeepZoomInfo#getDimensions" > < a href = "DeepZoomInfo.html#getDimensions" > getDimensions< / a > < / li >
< li class = "parent " data-name = "DeepZoomInfo#getNumTiles" > < a href = "DeepZoomInfo.html#getNumTiles" > getNumTiles< / a > < / li >
< li class = "parent " data-name = "DeepZoomInfo#getScale" > < a href = "DeepZoomInfo.html#getScale" > getScale< / a > < / li >
< li class = "parent " data-name = "DeepZoomInfo#imageForURL" > < a href = "DeepZoomInfo.html#imageForURL" > imageForURL< / a > < / li >
< li class = "parent " data-name = "DeepZoomInfo#urlForTile" > < a href = "DeepZoomInfo.html#urlForTile" > urlForTile< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "Flippable" >
< span class = "title " >
< a href = "Flippable.html" > Flippable< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = "parent " data-name = "Flippable#flipped" > < a href = "Flippable.html#flipped" > flipped< / a > < / li >
< li class = "parent " data-name = "Flippable#frontSideInFront" > < a href = "Flippable.html#frontSideInFront" > frontSideInFront< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "Flippable#layout" > < a href = "Flippable.html#layout" > layout< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "FontInfo" >
< span class = "title " >
< a href = "FontInfo.html" > FontInfo< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "Hypenate" >
< span class = "title " >
< a href = "Hypenate.html" > Hypenate< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "Hypenate.splitLines" > < a href = "Hypenate.html#.splitLines" > splitLines< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "InteractivePopup" >
< span class = "title " >
< a href = "InteractivePopup.html" > InteractivePopup< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = " " data-name = "InteractivePopup#content" > < a href = "InteractivePopup.html#content" > content< / a > < / li >
< li class = " " data-name = "InteractivePopup#header" > < a href = "InteractivePopup.html#header" > header< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = " " data-name = "InteractivePopup#hide" > < a href = "InteractivePopup.html#hide" > hide< / a > < / li >
< li class = "parent " data-name = "InteractivePopup#layout" > < a href = "InteractivePopup.html#layout" > layout< / a > < / li >
< li class = " " data-name = "InteractivePopup#show" > < a href = "InteractivePopup.html#show" > show< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "LabeledGraphics" >
< span class = "title " >
< a href = "LabeledGraphics.html" > LabeledGraphics< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "LabeledGraphics#clear" > < a href = "LabeledGraphics.html#clear" > clear< / a > < / li >
< li class = "parent " data-name = "LabeledGraphics#debugInfos" > < a href = "LabeledGraphics.html#debugInfos" > debugInfos< / a > < / li >
< li class = "parent " data-name = "LabeledGraphics#ensureLabel" > < a href = "LabeledGraphics.html#ensureLabel" > ensureLabel< / a > < / li >
< li class = "parent " data-name = "LabeledGraphics#getLabel" > < a href = "LabeledGraphics.html#getLabel" > getLabel< / a > < / li >
< li class = "parent " data-name = "LabeledGraphics#hideLabel" > < a href = "LabeledGraphics.html#hideLabel" > hideLabel< / a > < / li >
< li class = "parent " data-name = "LabeledGraphics#removeLabel" > < a href = "LabeledGraphics.html#removeLabel" > removeLabel< / a > < / li >
< li class = "parent " data-name = "LabeledGraphics#truncateLabel" > < a href = "LabeledGraphics.html#truncateLabel" > truncateLabel< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "LabeledGraphics.exports.LabeledGraphics" >
< span class = "title " >
< a href = "LabeledGraphics.exports.LabeledGraphics.html" > LabeledGraphics.exports.LabeledGraphics< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "List" >
< span class = "title " >
< a href = "List.html" > List< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = "parent " data-name = "List#innerHeight" > < a href = "List.html#innerHeight" > innerHeight< / a > < / li >
< li class = "parent " data-name = "List#innerWidth" > < a href = "List.html#innerWidth" > innerWidth< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "List#capture" > < a href = "List.html#capture" > capture< / a > < / li >
< li class = "parent " data-name = "List#layout" > < a href = "List.html#layout" > layout< / a > < / li >
< li class = "parent " data-name = "List#resize" > < a href = "List.html#resize" > resize< / a > < / li >
< li class = "parent " data-name = "List#setItems" > < a href = "List.html#setItems" > setItems< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "Message" >
< span class = "title " >
< a href = "Message.html" > Message< / a >
< / span >
< ul class = "members itemMembers" >
2019-05-14 14:03:32 +02:00
< span class = "subtitle" > Members< / span >
< li class = " " data-name = "Message#content" > < a href = "Message.html#content" > content< / a > < / li >
< li class = " " data-name = "Message#header" > < a href = "Message.html#header" > header< / a > < / li >
2019-03-29 08:49:53 +01:00
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
2019-05-14 14:03:32 +02:00
< li class = " " data-name = "Message#hide" > < a href = "Message.html#hide" > hide< / a > < / li >
2019-03-29 08:49:53 +01:00
< li class = "parent " data-name = "Message#layout" > < a href = "Message.html#layout" > layout< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
2019-05-14 14:03:32 +02:00
< li class = "item" data-name = "MessageInteractivePopup" >
< span class = "title " >
< a href = "MessageInteractivePopup.html" > MessageInteractivePopup< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "MessageMessageInteractivePopup" >
< span class = "title " >
< a href = "MessageMessageInteractivePopup.html" > MessageMessageInteractivePopup< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
2019-03-29 08:49:53 +01:00
< li class = "item" data-name = "Modal" >
< span class = "title " >
< a href = "Modal.html" > Modal< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = "parent " data-name = "Modal#content" > < a href = "Modal.html#content" > content< / a > < / li >
< li class = "parent " data-name = "Modal#header" > < a href = "Modal.html#header" > header< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "Modal#hide" > < a href = "Modal.html#hide" > hide< / a > < / li >
< li class = "parent " data-name = "Modal#layout" > < a href = "Modal.html#layout" > layout< / a > < / li >
< li class = "parent " data-name = "Modal#show" > < a href = "Modal.html#show" > show< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
2019-05-14 14:03:32 +02:00
< li class = "item" data-name = "ModalInteractivePopup" >
< span class = "title " >
< a href = "ModalInteractivePopup.html" > ModalInteractivePopup< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "ModalModalInteractivePopup" >
< span class = "title " >
< a href = "ModalModalInteractivePopup.html" > ModalModalInteractivePopup< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
2019-03-29 08:49:53 +01:00
< li class = "item" data-name = "PIXIApp" >
< span class = "title " >
< a href = "PIXIApp.html" > PIXIApp< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = "parent " data-name = "PIXIApp#center" > < a href = "PIXIApp.html#center" > center< / a > < / li >
< li class = "parent " data-name = "PIXIApp#size" > < a href = "PIXIApp.html#size" > size< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "PIXIApp#addFpsDisplay" > < a href = "PIXIApp.html#addFpsDisplay" > addFpsDisplay< / a > < / li >
< li class = "parent " data-name = "PIXIApp#checkOrientation" > < a href = "PIXIApp.html#checkOrientation" > checkOrientation< / a > < / li >
< li class = "parent " data-name = "PIXIApp#convertPointFromNodeToPage" > < a href = "PIXIApp.html#convertPointFromNodeToPage" > convertPointFromNodeToPage< / a > < / li >
< li class = "parent " data-name = "PIXIApp#convertPointFromPageToNode" > < a href = "PIXIApp.html#convertPointFromPageToNode" > convertPointFromPageToNode< / a > < / li >
< li class = "parent " data-name = "PIXIApp#draw" > < a href = "PIXIApp.html#draw" > draw< / a > < / li >
< li class = "parent " data-name = "PIXIApp#expandRenderer" > < a href = "PIXIApp.html#expandRenderer" > expandRenderer< / a > < / li >
< li class = "parent " data-name = "PIXIApp#layout" > < a href = "PIXIApp.html#layout" > layout< / a > < / li >
< li class = "parent " data-name = "PIXIApp#loadSprites" > < a href = "PIXIApp.html#loadSprites" > loadSprites< / a > < / li >
< li class = "parent " data-name = "PIXIApp#loadTextures" > < a href = "PIXIApp.html#loadTextures" > loadTextures< / a > < / li >
< li class = "parent " data-name = "PIXIApp#message" > < a href = "PIXIApp.html#message" > message< / a > < / li >
< li class = "parent " data-name = "PIXIApp#modal" > < a href = "PIXIApp.html#modal" > modal< / a > < / li >
< li class = "parent " data-name = "PIXIApp#mutate" > < a href = "PIXIApp.html#mutate" > mutate< / a > < / li >
< li class = "parent " data-name = "PIXIApp#orientation" > < a href = "PIXIApp.html#orientation" > orientation< / a > < / li >
< li class = "parent " data-name = "PIXIApp#orientationChanged" > < a href = "PIXIApp.html#orientationChanged" > orientationChanged< / a > < / li >
< li class = "parent " data-name = "PIXIApp#progress" > < a href = "PIXIApp.html#progress" > progress< / a > < / li >
< li class = "parent " data-name = "PIXIApp#query" > < a href = "PIXIApp.html#query" > query< / a > < / li >
< li class = "parent " data-name = "PIXIApp#resize" > < a href = "PIXIApp.html#resize" > resize< / a > < / li >
< li class = "parent " data-name = "PIXIApp#setup" > < a href = "PIXIApp.html#setup" > setup< / a > < / li >
< li class = "parent " data-name = "PIXIApp#subscribe" > < a href = "PIXIApp.html#subscribe" > subscribe< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "Popup" >
< span class = "title " >
< a href = "Popup.html" > Popup< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = " " data-name = "Popup#content" > < a href = "Popup.html#content" > content< / a > < / li >
< li class = " " data-name = "Popup#header" > < a href = "Popup.html#header" > header< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = " " data-name = "Popup#hide" > < a href = "Popup.html#hide" > hide< / a > < / li >
< li class = " " data-name = "Popup#layout" > < a href = "Popup.html#layout" > layout< / a > < / li >
< li class = " " data-name = "Popup#show" > < a href = "Popup.html#show" > show< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
2019-05-14 14:03:32 +02:00
< li class = "item" data-name = "PopupInteractivePopup" >
< span class = "title " >
< a href = "PopupInteractivePopup.html" > PopupInteractivePopup< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
2019-03-29 08:49:53 +01:00
< li class = "item" data-name = "PopupMenu" >
< span class = "title " >
< a href = "PopupMenu.html" > PopupMenu< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = " " data-name = "PopupMenu#content" > < a href = "PopupMenu.html#content" > content< / a > < / li >
< li class = " " data-name = "PopupMenu#header" > < a href = "PopupMenu.html#header" > header< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = " " data-name = "PopupMenu#hide" > < a href = "PopupMenu.html#hide" > hide< / a > < / li >
< li class = " " data-name = "PopupMenu#layout" > < a href = "PopupMenu.html#layout" > layout< / a > < / li >
< li class = " " data-name = "PopupMenu#show" > < a href = "PopupMenu.html#show" > show< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
2019-05-14 14:03:32 +02:00
< li class = "item" data-name = "PopupMenuPopupInteractivePopup" >
< span class = "title " >
< a href = "PopupMenuPopupInteractivePopup.html" > PopupMenuPopupInteractivePopup< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "PopupMenuPopupMenuPopupInteractivePopup" >
< span class = "title " >
< a href = "PopupMenuPopupMenuPopupInteractivePopup.html" > PopupMenuPopupMenuPopupInteractivePopup< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "PopupMenuPopupMenuPopupPopupInteractivePopup" >
< span class = "title " >
< a href = "PopupMenuPopupMenuPopupPopupInteractivePopup.html" > PopupMenuPopupMenuPopupPopupInteractivePopup< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "PopupMenuPopupPopupInteractivePopup" >
< span class = "title " >
< a href = "PopupMenuPopupPopupInteractivePopup.html" > PopupMenuPopupPopupInteractivePopup< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "PopupPopupInteractivePopup" >
< span class = "title " >
< a href = "PopupPopupInteractivePopup.html" > PopupPopupInteractivePopup< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
2019-03-29 08:49:53 +01:00
< li class = "item" data-name = "Progress" >
< span class = "title " >
< a href = "Progress.html" > Progress< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = "parent " data-name = "Progress#progress" > < a href = "Progress.html#progress" > progress< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "Progress#hide" > < a href = "Progress.html#hide" > hide< / a > < / li >
< li class = "parent " data-name = "Progress#layout" > < a href = "Progress.html#layout" > layout< / a > < / li >
< li class = "parent " data-name = "Progress#show" > < a href = "Progress.html#show" > show< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
2019-05-14 14:03:32 +02:00
< li class = "item" data-name = "Scrollview" >
< span class = "title " >
< a href = "Scrollview.html" > Scrollview< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "Scrollview#layout" > < a href = "Scrollview.html#layout" > layout< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
2019-03-29 08:49:53 +01:00
< li class = "item" data-name = "Slider" >
< span class = "title " >
< a href = "Slider.html" > Slider< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = "parent " data-name = "Slider#disabled" > < a href = "Slider.html#disabled" > disabled< / a > < / li >
< li class = "parent " data-name = "Slider#value" > < a href = "Slider.html#value" > value< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "Slider#hide" > < a href = "Slider.html#hide" > hide< / a > < / li >
< li class = "parent " data-name = "Slider#layout" > < a href = "Slider.html#layout" > layout< / a > < / li >
< li class = "parent " data-name = "Slider#show" > < a href = "Slider.html#show" > show< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "Switch" >
< span class = "title " >
< a href = "Switch.html" > Switch< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = "parent " data-name = "Switch#active" > < a href = "Switch.html#active" > active< / a > < / li >
< li class = "parent " data-name = "Switch#disabled" > < a href = "Switch.html#disabled" > disabled< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "Switch#hide" > < a href = "Switch.html#hide" > hide< / a > < / li >
< li class = "parent " data-name = "Switch#layout" > < a href = "Switch.html#layout" > layout< / a > < / li >
< li class = "parent " data-name = "Switch#show" > < a href = "Switch.html#show" > show< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "TextLabel.TextLabel" >
< span class = "title " >
< a href = "TextLabel.TextLabel.html" > TextLabel.TextLabel< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "Theme" >
< span class = "title " >
< a href = "Theme.html" > Theme< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "Theme.fromString" > < a href = "Theme.html#.fromString" > fromString< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "ThemeDark" >
< span class = "title " >
< a href = "ThemeDark.html" > ThemeDark< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "ThemeLight" >
< span class = "title " >
< a href = "ThemeLight.html" > ThemeLight< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "ThemeRed" >
< span class = "title " >
< a href = "ThemeRed.html" > ThemeRed< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "TileQuadNode" >
< span class = "title " >
< a href = "TileQuadNode.html" > TileQuadNode< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "TileQuadNode#link" > < a href = "TileQuadNode.html#link" > link< / a > < / li >
< li class = "parent " data-name = "TileQuadNode#noQuads" > < a href = "TileQuadNode.html#noQuads" > noQuads< / a > < / li >
< li class = "parent " data-name = "TileQuadNode#unlink" > < a href = "TileQuadNode.html#unlink" > unlink< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "Tooltip" >
< span class = "title " >
< a href = "Tooltip.html" > Tooltip< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = " " data-name = "Tooltip#content" > < a href = "Tooltip.html#content" > content< / a > < / li >
< li class = " " data-name = "Tooltip#header" > < a href = "Tooltip.html#header" > header< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = " " data-name = "Tooltip#hide" > < a href = "Tooltip.html#hide" > hide< / a > < / li >
< li class = " " data-name = "Tooltip#layout" > < a href = "Tooltip.html#layout" > layout< / a > < / li >
< li class = " " data-name = "Tooltip#show" > < a href = "Tooltip.html#show" > show< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "UITest" >
< span class = "title " >
< a href = "UITest.html" > UITest< / a >
< / span >
< ul class = "members itemMembers" >
< span class = "subtitle" > Members< / span >
< li class = "parent " data-name = "UITest#timeline" > < a href = "UITest.html#timeline" > timeline< / a > < / li >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "UITest#clear" > < a href = "UITest.html#clear" > clear< / a > < / li >
< li class = "parent " data-name = "UITest#pan" > < a href = "UITest.html#pan" > pan< / a > < / li >
< li class = "parent " data-name = "UITest#pinch" > < a href = "UITest.html#pinch" > pinch< / a > < / li >
< li class = "parent " data-name = "UITest#restart" > < a href = "UITest.html#restart" > restart< / a > < / li >
< li class = "parent " data-name = "UITest#start" > < a href = "UITest.html#start" > start< / a > < / li >
< li class = "parent " data-name = "UITest#stop" > < a href = "UITest.html#stop" > stop< / a > < / li >
< li class = "parent " data-name = "UITest#tap" > < a href = "UITest.html#tap" > tap< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< li class = "item" data-name = "Volatile" >
< span class = "title " >
< a href = "Volatile.html" > Volatile< / a >
< / span >
< ul class = "members itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "typedefs itemMembers" >
< / ul >
< ul class = "methods itemMembers" >
< span class = "subtitle" > Methods< / span >
< li class = "parent " data-name = "Volatile#layout" > < a href = "Volatile.html#layout" > layout< / a > < / li >
< / ul >
< ul class = "events itemMembers" >
< / ul >
< / li >
< / ul >
< / div >
< div class = "main" >
< h1 class = "page-title" data-filename = "uitest.js.html" > Source: uitest.js< / h1 >
< section >
< header >
< div class = "header content-size" >
< h2 > uitest.js< / h2 >
< / div >
< / header >
< article >
< pre id = "source-code" class = "prettyprint source linenums" > < code > /* globals Power0 */
/* eslint no-console: ["error", { allow: ["log", "info", "warn", "error"] }] */
/**
* Imports
*/
/**
* A class that can be used to perform automated user interface tests.
*
* @example
* // Create the UITest object
* const test = new UITest({
* timeScale: 2
* })
*
* // Add an action to the test case
* test.tap(button, {eventType: 'click'})
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* // Start the test case
* test.start()
*
* @class
* @see {@link https://www.iwm-tuebingen.de/iwmbrowser/lib/pixi/uitest.html|DocTest}
*/
export default class UITest {
/**
* Creates an instance of an UITest.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* In the background, the class UITest uses the Greensock TimelineMax class. The opts object is passed directly to the TimelineMax class, so it can use any key that uses the TimelineMax class.
*
* @constructor
* @param {object} [opts] - An options object to specify the behaviour of the test case.
* @param {number} [opts.timeScale=1] - The speed at which the test should run, see https://greensock.com/docs/TimelineMax/timeScale().
* @param {string} [opts.eventType=auto] - The type of events which should be used. Possible values: pointer, touch, mouse, auto. If set to auto, the eventType is set depending on the support of the browser used.
* @param {boolean} [opts.debug=false] - If set to true, multiple informations will be print to the console.
* @param {number} [opts.defaultInterval] - The interval used when no action is specified for an action.
*/
constructor(opts = {}) {
2019-07-18 12:26:39 +02:00
this.opts = Object.assign(
{},
{
timeScale: 1,
eventType: 'auto',
debug: false,
defaultInterval: null
},
opts
)
2019-03-29 08:49:53 +01:00
// timeline
//--------------------
2019-07-18 12:26:39 +02:00
this._timeline = new TimelineMax(
Object.assign(
{},
{
paused: true
},
this.opts
)
)
2019-03-29 08:49:53 +01:00
this._timeline.timeScale(this.opts.timeScale)
// eventType
//--------------------
if (this.opts.eventType === 'auto') {
if (window.PointerEvent) {
this.opts.eventType = 'pointer'
} else if ('ontouchstart' in window) {
this.opts.eventType = 'touch'
} else {
this.opts.eventType = 'mouse'
}
}
if (this.opts.debug) {
console.log(`Event type: ${this.opts.eventType}`)
}
this._timelinePositions = [0]
this._actions = 0
// setup
//-----------------
this.setup()
}
/**
* Generates the required structure.
*
* @private
* @return {UITest} A reference to the UITest for chaining.
*/
setup() {
return this
}
/**
* Gets the Greensock TimelineMax object, used in the background of UITest.
*
* @member {TimelineMax}
*/
get timeline() {
return this._timeline
}
/**
* Starts the test case and executes the corresponding statements in the specified order.
*
* @return {UITest} A reference to the UITest for chaining.
*/
start() {
this._timeline.play()
return this
}
/**
* Stops the test case and stops executing any further instructions.
*
* @return {UITest} A reference to the UITest for chaining.
*/
stop() {
this._timeline.pause()
return this
}
/**
* Clears all instructions of the test case.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @return {UITest} A reference to the UITest for chaining.
*/
clear() {
this._timeline.clear()
return this
}
/**
* Restarts the test case.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @return {UITest} A reference to the UITest for chaining.
*/
restart() {
this._timeline.restart()
return this
}
/**
* Executes a tap event (pointerdown, pointerup) on a specific element.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @param {HTMLElement|string} element - The HTML element on which the event is to be executed, e.g. button, document, h2, canvas, etc. or an selector string. If a selector has been specified, it is evaluated immediately before the event is called using the querySelector method.
* @param {number[]|object|PIXI.DisplayObject} [position=The center of the element.] - The local position of the event in the context of the specified HTML element. If no position is specified, the center of the HTML element is used. The position can be specified as an array of numbers, as an object with the two properties x and y, or as a PIXI.Display object.
* @param {number} [timelinePosition=One second after the last action.] - The position in seconds when the event should be triggered, see shttps://greensock.com/docs/TimelineMax/addCallback().
* @param {object} [opts] - An options object to specify the behaviour of the action.
* @param {function} [opts.onStart] - A function that runs after the first event is fired. Will not be fired if only one event is running (for example, a click event). Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
* @param {function} [opts.onComplete] - A function that runs after the second event is fired. Always fired, even if only one event is running (for example, a click event). Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
* @param {string[]} [opts.eventTypes=['pointerdown', 'pointerup']] - The event types to use. If no types are specified, the event types specified in the UITest constructor are used (or auto if not specified).
* @param {string} [opts.eventType] - If you want the tap method to fire only one event (for example, a click event), you can specify the opts.eventType parameter. If eventType is not null, the parameter opts.eventTypes is ignored.
* @param {Window|Frame} [opts.context=window] - The context within which the optionally specified element selector should be executed.
* @param {boolean} [opts.bubbles=true] - The Event property bubbles indicates whether the event bubbles up through the DOM or not.
* @param {boolean} [opts.cancelable=true] - Events' cancelable property indicates if the event can be canceled, and therefore prevented as if the event never happened. If the event is not cancelable, then its cancelable property will be false and the event listener cannot stop the event from occurring.
*/
tap(element, position, timelinePosition, opts = {}) {
// arguments
//--------------------
2019-07-18 12:26:39 +02:00
;[position, timelinePosition, opts] = this.reorderArguments(arguments)
2019-03-29 08:49:53 +01:00
this._timelinePositions.push(timelinePosition)
// debug
//--------------------
2019-07-18 12:26:39 +02:00
if (this.opts.debug)
console.log('tap params', {
element,
position,
timelinePosition,
opts
})
2019-03-29 08:49:53 +01:00
// opts
//--------------------
2019-07-18 12:26:39 +02:00
opts = Object.assign(
{},
{
onStart: null,
onComplete: null,
eventTypes: this.resolveEvents(['down', 'up']),
eventType: null,
context: window,
bubbles: true,
cancelable: true
},
opts
)
2019-03-29 08:49:53 +01:00
if (opts.eventType) {
opts.eventTypes = opts.eventType
}
2019-07-18 12:26:39 +02:00
opts.eventTypes = Array.isArray(opts.eventTypes)
? opts.eventTypes
: [opts.eventTypes]
2019-03-29 08:49:53 +01:00
// timeline
//--------------------
2019-07-18 12:26:39 +02:00
this._timeline.addCallback(
position => {
// element
//--------------------
const elem = Util.extractElement(opts.context, element)
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// position
//--------------------
if (position === null) {
const rect = elem.getBoundingClientRect()
position = [rect.width / 2, rect.height / 2]
}
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// coords
//--------------------
const coords = Util.extractPosition(position)
if (this.opts.debug) console.log('local coords', coords)
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// eventTypes
//--------------------
if (opts.eventTypes.length === 1) {
opts.eventTypes.unshift(null)
}
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// event opts
//--------------------
const eventOpts = {
bubbles: opts.bubbles,
cancelable: opts.cancelable
}
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
if (opts.eventTypes[0]) {
// create and dispatch event
//--------------------
const eventStart = Event.create(
elem,
coords,
opts.eventTypes[0],
eventOpts
)
if (this.opts.debug)
console.log('dispatch event', eventStart)
elem.dispatchEvent(eventStart)
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// onStart
//--------------------
if (opts.onStart) {
opts.onStart.call(this, eventStart)
}
}
2019-03-29 08:49:53 +01:00
// create and dispatch event
//--------------------
2019-07-18 12:26:39 +02:00
const eventComplete = Event.create(
elem,
coords,
opts.eventTypes[1],
eventOpts
)
if (this.opts.debug)
console.log('dispatch event', eventComplete)
elem.dispatchEvent(eventComplete)
// onComplete
2019-03-29 08:49:53 +01:00
//--------------------
2019-07-18 12:26:39 +02:00
if (opts.onComplete) {
opts.onComplete.call(this, eventComplete)
2019-03-29 08:49:53 +01:00
}
2019-07-18 12:26:39 +02:00
},
timelinePosition,
[position]
)
2019-03-29 08:49:53 +01:00
this._actions++
return this
}
/**
* Executes a pan event (pointerdown, pointermove, pointerup) on a specific element.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @param {HTMLElement|string} element - The HTML element on which the event is to be executed, e.g. button, document, h2, canvas, etc. or an selector string. If a selector has been specified, it is evaluated immediately before the event is called using the querySelector method.
* @param {number[]|object|PIXI.DisplayObject} [position=The center of the element.] - The local position of the event in the context of the specified HTML element. If no position is specified, the center of the HTML element is used. The position can be specified as an array of numbers, as an object with the two properties x and y, or as a PIXI.Display object.
* @param {number} [timelinePosition=One second after the last action.] - The position in seconds when the event should be triggered, see shttps://greensock.com/docs/TimelineMax/addCallback().
* @param {object} [opts] - An options object to specify the behaviour of the action.
* @param {function} [opts.onStart] - A function that runs after the first event is fired. Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
* @param {function} [opts.onUpdate] - A function that runs after each execution of the second event. Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
* @param {function} [opts.onComplete] - A function that runs after the third event is fired. Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
* @param {number[]|object|PIXI.DisplayObject} [opts.to={x: 0, y: 0}] - The target of the pan process. The position can be specified as an array of numbers, as an object with the two properties x and y, or as a PIXI.Display object.
* @param {number} [opts.duration=1] - The duration of the pan animation in seconds, see https://greensock.com/docs/TweenLite/duration().
* @param {Ease} [opts.ease=Power0.easeNone] - The easing of the pan animation, see https://greensock.com/docs/Easing.
* @param {string[]} [opts.eventTypes=['pointerdown', 'pointermove', 'pointerup']] - The event types to use. If no types are specified, the event types specified in the UITest constructor are used (or auto if not specified).
* @param {Window|Frame} [opts.context=window] - The context within which the optionally specified element selector should be executed.
* @param {boolean} [opts.bubbles=true] - The Event property bubbles indicates whether the event bubbles up through the DOM or not.
* @param {boolean} [opts.cancelable=true] - Events' cancelable property indicates if the event can be canceled, and therefore prevented as if the event never happened. If the event is not cancelable, then its cancelable property will be false and the event listener cannot stop the event from occurring.
*/
pan(element, position, timelinePosition, opts = {}) {
// arguments
//--------------------
2019-07-18 12:26:39 +02:00
;[position, timelinePosition, opts] = this.reorderArguments(arguments)
2019-03-29 08:49:53 +01:00
this._timelinePositions.push(timelinePosition)
// debug
//--------------------
2019-07-18 12:26:39 +02:00
if (this.opts.debug)
console.log('tap params', {
element,
position,
timelinePosition,
opts
})
2019-03-29 08:49:53 +01:00
// opts
//--------------------
2019-07-18 12:26:39 +02:00
opts = Object.assign(
{},
{
onStart: null,
onUpdate: null,
onComplete: null,
to: { x: 0, y: 0 },
duration: 1,
ease: Power0.easeNone,
eventTypes: this.resolveEvents(['down', 'move', 'up']),
context: window,
bubbles: true,
cancelable: true
},
opts
)
2019-03-29 08:49:53 +01:00
// timeline
//--------------------
2019-07-18 12:26:39 +02:00
this._timeline.addCallback(
position => {
// element
//--------------------
const elem = Util.extractElement(opts.context, element)
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// coords
//--------------------
const from = Util.extractPosition(position)
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// event opts
//--------------------
const eventOpts = {
bubbles: opts.bubbles,
cancelable: opts.cancelable
}
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
const gsOpts = {
ease: opts.ease,
onStart: () => {
// create and dispatch event
//--------------------
const event = Event.create(
elem,
from,
opts.eventTypes[0],
eventOpts
)
if (this.opts.debug)
console.log('dispatch event', event)
elem.dispatchEvent(event)
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// onStart
//--------------------
if (opts.onStart) {
opts.onStart.call(this, event)
}
},
onUpdate: () => {
// create and dispatch event
//--------------------
const event = Event.create(
elem,
from,
opts.eventTypes[1],
eventOpts
)
if (this.opts.debug)
console.log('dispatch event', event)
elem.dispatchEvent(event)
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// onUpdate
//--------------------
if (opts.onUpdate) {
opts.onUpdate.call(this, event)
}
},
onComplete: () => {
// create and dispatch event
//--------------------
const event = Event.create(
elem,
from,
opts.eventTypes[2],
eventOpts
)
if (this.opts.debug)
console.log('dispatch event', event)
elem.dispatchEvent(event)
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// onComplete
//--------------------
if (opts.onComplete) {
opts.onComplete.call(this, event)
}
2019-03-29 08:49:53 +01:00
}
}
2019-07-18 12:26:39 +02:00
// to
//--------------------
const object = Util.extractTo(opts)
Object.assign(gsOpts, object)
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// drag animation
//--------------------
TweenLite.to(from, opts.duration, gsOpts)
},
timelinePosition,
[position]
)
2019-03-29 08:49:53 +01:00
this._actions++
return this
}
/**
* Executes a pinch event (pointerdown, pointermove, pointerup) on a specific element with two "fingers" simultaneously.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @param {HTMLElement|string} element - The HTML element on which the event is to be executed, e.g. button, document, h2, canvas, etc. or an selector string. If a selector has been specified, it is evaluated immediately before the event is called using the querySelector method.
* @param {number[]|object|PIXI.DisplayObject} [position=The center of the element.] - The local position of the event in the context of the specified HTML element. If no position is specified, the center of the HTML element is used. The position can be specified as an array of numbers, as an object with the two properties x and y, or as a PIXI.Display object.
* @param {number} [timelinePosition=One second after the last action.] - The position in seconds when the event should be triggered, see shttps://greensock.com/docs/TimelineMax/addCallback().
* @param {object} [opts] - An options object to specify the behaviour of the action.
* @param {function} [opts.onStart] - A function that runs after the first events are fired. Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
* @param {function} [opts.onUpdate] - A function that runs after each execution of the second events. Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
* @param {function} [opts.onComplete] - A function that runs after the third events are fired. Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
* @param {boolean} [opts.doubleCallbacks=false] - The callbacks onStart, onUpdate and onComplete will be fired only for one finger. If set to true, the events will be fired for both fingers.
* @param {number} [opts.distance=100] - The distance in pixels, how far the two "fingers" should move apart. If to or bezier specified, distance is ignored.
* @param {number[][]|object[]|PIXI.DisplayObject[]} [opts.to] - The targets of the pinch process. The position must be an array with two entries. An entry can be specified as an array of numbers, as an object with the two properties x and y, or as a PIXI.Display object. If bezier is specified, to is ignored.
* @param {number[][]|object[]|PIXI.DisplayObject[]} [opts.bezier] - The targets of the pinch process. The position must be an array with two entries. An entry may be an array of positions or a bezier object (https://greensock.com/docs/Plugins/BezierPlugin). A position in the array or the values array of the bezier object can be specified as an array of numbers, as an object with the two properties x and y, or as a PIXI.Display object. If bezier is specified, to is ignored.
* @param {number} [opts.duration=1] - The duration of the pan animation in seconds, see https://greensock.com/docs/TweenLite/duration().
* @param {Ease} [opts.ease=Power0.easeNone] - The easing of the pan animation, see https://greensock.com/docs/Easing.
* @param {string[]} [opts.eventTypes=['pointerdown', 'pointermove', 'pointerup']] - The event types to use. If no types are specified, the event types specified in the UITest constructor are used (or auto if not specified).
* @param {Window|Frame} [opts.context=window] - The context within which the optionally specified element selector should be executed.
* @param {boolean} [opts.bubbles=true] - The Event property bubbles indicates whether the event bubbles up through the DOM or not.
* @param {boolean} [opts.cancelable=true] - Events' cancelable property indicates if the event can be canceled, and therefore prevented as if the event never happened. If the event is not cancelable, then its cancelable property will be false and the event listener cannot stop the event from occurring.
*/
pinch(element, position, timelinePosition, opts = {}) {
// arguments
//--------------------
2019-07-18 12:26:39 +02:00
;[position, timelinePosition, opts] = this.reorderArguments(arguments)
2019-03-29 08:49:53 +01:00
this._timelinePositions.push(timelinePosition)
// debug
//--------------------
2019-07-18 12:26:39 +02:00
if (this.opts.debug)
console.log('tap params', {
element,
position,
timelinePosition,
opts
})
2019-03-29 08:49:53 +01:00
// opts
//--------------------
2019-07-18 12:26:39 +02:00
opts = Object.assign(
{},
{
onStart: null,
onUpdate: null,
onComplete: null,
doubleCallbacks: false,
duration: 1,
distance: 100,
to: null,
bezier: null,
ease: Power0.easeNone,
eventTypes: this.resolveEvents(['down', 'move', 'up']),
context: window,
bubbles: true,
cancelable: true
},
opts
)
2019-03-29 08:49:53 +01:00
// timeline
//--------------------
2019-07-18 12:26:39 +02:00
this._timeline.addCallback(
position => {
// element
2019-03-29 08:49:53 +01:00
//--------------------
2019-07-18 12:26:39 +02:00
const elem = Util.extractElement(opts.context, element)
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// from
2019-03-29 08:49:53 +01:00
//--------------------
2019-07-18 12:26:39 +02:00
let from1 = null
let from2 = null
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
if (Array.isArray(position) & & !Util.isNumber(position[0])) {
from1 = Util.extractPosition(position[0])
from2 = Util.extractPosition(position[1])
} else {
from1 = Util.extractPosition(position)
from2 = { x: from1.x, y: from1.y }
}
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// to
//--------------------
let gsOpts1 = {}
let gsOpts2 = {}
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
if (opts.to || opts.bezier) {
;[gsOpts1, gsOpts2] = Util.extractMultiTo(opts)
} else {
const distance = opts.distance != null ? opts.distance : 100
gsOpts1.x = from1.x - distance / 2
gsOpts1.y = from1.y
gsOpts2.x = from2.x + distance / 2
gsOpts2.y = from2.y
}
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// pointers
//--------------------
const pointers = new Map()
pointers.set(0, { element: from1, gsOpts: gsOpts1 })
pointers.set(1, { element: from2, gsOpts: gsOpts2 })
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// loop
//--------------------
pointers.forEach((value, key) => {
// from
//--------------------
const from = value.element
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// event opts
//--------------------
const eventOpts = {
bubbles: opts.bubbles,
cancelable: opts.cancelable,
pointerId: key,
isPrimary: key === 0
}
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
const gsOpts = {
ease: opts.ease,
onStart: () => {
// create and dispatch event
//--------------------
const event = Event.create(
elem,
from,
opts.eventTypes[0],
eventOpts
)
if (this.opts.debug)
console.log('dispatch event', event)
elem.dispatchEvent(event)
// onStart
//--------------------
if (
opts.onStart & &
(opts.doubleCallbacks || key === 0)
) {
opts.onStart.call(this, event)
}
},
onUpdate: () => {
// create and dispatch event
//--------------------
const event = Event.create(
elem,
from,
opts.eventTypes[1],
eventOpts
)
if (this.opts.debug)
console.log('dispatch event', event)
elem.dispatchEvent(event)
// onUpdate
//--------------------
if (
opts.onUpdate & &
(opts.doubleCallbacks || key === 0)
) {
opts.onUpdate.call(this, event)
}
},
onComplete: () => {
// create and dispatch event
//--------------------
const event = Event.create(
elem,
from,
opts.eventTypes[2],
eventOpts
)
if (this.opts.debug)
console.log('dispatch event', event)
elem.dispatchEvent(event)
// onComplete
//--------------------
if (
opts.onComplete & &
(opts.doubleCallbacks || key === 0)
) {
opts.onComplete.call(this, event)
}
2019-03-29 08:49:53 +01:00
}
}
2019-07-18 12:26:39 +02:00
// to
//--------------------
Object.assign(gsOpts, value.gsOpts)
2019-03-29 08:49:53 +01:00
2019-07-18 12:26:39 +02:00
// drag animation
//--------------------
TweenLite.to(from, opts.duration, gsOpts)
})
},
timelinePosition,
[position]
)
2019-03-29 08:49:53 +01:00
this._actions++
return this
}
// /**
// * Adds a tap event to the timeline.
// *
// * @return {UITest} A reference to the uitest for chaining.
// */
// rotate() {
// return this
// }
// /**
// * Adds a tap event to the timeline.
// *
// * @return {UITest} A reference to the uitest for chaining.
// */
// swipe() {
// return this
// }
// /**
// * Adds a tap event to the timeline.
// *
// * @return {UITest} A reference to the uitest for chaining.
// */
// press() {
// return this
// }
// /**
// * Adds a tap event to the timeline.
// *
// * @return {UITest} A reference to the uitest for chaining.
// */
// event() {
// return this
// }
/**
* Sorts the parameters so that the second, third, and fourth parameters can be optional (and possibly slip forward).
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @private
* @param {arguments} params - The arguments which were passed to the function.
* @returns {array} - Returns an array of the position, the timelinePosition and the opts object.
*/
reorderArguments(params) {
// first parameter
//--------------------
const element = params[0]
// other parameter
//--------------------
let position = null
let timelinePosition = null
let opts = null
2019-07-18 12:26:39 +02:00
2019-03-29 08:49:53 +01:00
// second parameter
//--------------------
if (Util.isNumber(params[1])) {
timelinePosition = params[1]
2019-07-18 12:26:39 +02:00
} else if (
Util.isObject(params[1]) & &
!Util.isPixiDisplayObject(params[1]) & &
(params[1].x == null || params[1].y == null)
) {
2019-03-29 08:49:53 +01:00
opts = params[1]
} else if (params[1] != null) {
position = params[1]
}
// third parameter
//--------------------
if (Util.isNumber(params[2])) {
timelinePosition = params[2]
} else if (Util.isObject(params[2])) {
opts = params[2]
}
// fourth parameter
//--------------------
if (Util.isObject(params[3])) {
opts = params[3]
}
// defaults
//--------------------
if (position === null) {
// will later be filled...
}
if (timelinePosition === null) {
if (this.opts.defaultInterval === null & & this._actions > 1) {
2019-07-18 12:26:39 +02:00
throw new Error(
'No execution time was specified for this action, and a default interval was not set in the class constructor!'
)
2019-03-29 08:49:53 +01:00
}
2019-07-18 12:26:39 +02:00
timelinePosition =
Math.max(...this._timelinePositions) +
(this.opts.defaultInterval || 1)
2019-03-29 08:49:53 +01:00
}
if (opts === null) {
opts = {}
}
return [position, timelinePosition, opts]
}
/**
* Converts event type shortcuts to real event names.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @private
* @param {string[]} events - An array of event types.
*/
resolveEvents(events) {
const data = []
if (this.opts.eventType === 'pointer') {
events.forEach(it => {
if (it === 'down') {
data.push('pointerdown')
} else if (it === 'move') {
data.push('pointermove')
} else if (it === 'up') {
data.push('pointerup')
}
})
} else if (this.opts.eventType === 'touch') {
events.forEach(it => {
if (it === 'down') {
data.push('touchstart')
} else if (it === 'move') {
data.push('touchmove')
} else if (it === 'up') {
data.push('touchend')
}
})
} else {
events.forEach(it => {
if (it === 'down') {
data.push('mousedown')
} else if (it === 'move') {
data.push('mousemove')
} else if (it === 'up') {
data.push('mouseup')
}
})
}
return data
}
}
/**
* Helper class.
*
* @example
* // Checks if a thing is a number.
* const num = Util.isNumber(20)
*
* @private
* @ignore
* @class
*/
class Util {
/**
* Resolves the element from a specific context.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @static
* @param {Window|Frame} context - The context within which the optionally specified element selector should be executed.
* @return {HTMLElement|string} element - The HTML element on which the event is to be executed, e.g. button, document, h2, canvas, etc. or an selector string. If a selector has been specified, it is evaluated immediately before the event is called using the querySelector method.
*/
static extractElement(context, element) {
2019-07-18 12:26:39 +02:00
const cont = Util.isFrame(context)
? context.contentDocument
: context.document
const elem = Util.isString(element)
? cont.querySelector(element)
: element
2019-03-29 08:49:53 +01:00
return elem
}
/**
* Extracts the position of the second parameter.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @static
* @param {object} object - Something were the coords should be extracted.
* @return {object} - Returns an object with the keys x and y.
*/
static extractPosition(object) {
// event coords
//--------------------
2019-07-18 12:26:39 +02:00
const position = { x: 0, y: 0 }
2019-03-29 08:49:53 +01:00
// get the position
//--------------------
if (!object) {
position.x = 0
position.y = 0
} else if (typeof object.getBounds === 'function') {
const bounds = object.getBounds()
position.x = bounds.x + bounds.width / 2
position.y = bounds.y + bounds.height / 2
} else if (Array.isArray(object)) {
position.x = object[0]
position.y = object[1]
} else if (object.x != null & & object.y != null) {
position.x = object.x
position.y = object.y
}
return position
}
/**
* Extracts the to or bezier key.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @static
* @param {object} opts - An options object where to or bezier should be extracted.
* @return {object} - Returns an object with the to or bezier keys.
*/
static extractTo(opts) {
const object = {}
if (opts.bezier) {
let bezier = null
if (Array.isArray(opts.bezier)) {
bezier = {
values: opts.bezier.map(it => Util.extractPosition(it)),
type: 'thru'
}
} else {
2019-07-18 12:26:39 +02:00
opts.bezier.values = opts.bezier.values.map(it =>
Util.extractPosition(it)
)
2019-03-29 08:49:53 +01:00
bezier = opts.bezier
}
object.bezier = bezier
} else {
const to = Util.extractPosition(opts.to)
object.x = to.x
object.y = to.y
}
return object
}
/**
* Extracts multiple to or bezier keys.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @static
* @param {object} opts - An options object where to or bezier should be extracted.
* @return {object[]} - Returns an array of objects with the keys x and y.
*/
static extractMultiTo(opts) {
const objects = []
if (opts.bezier) {
opts.bezier.forEach(it => {
let bezier = null
if (Array.isArray(it)) {
bezier = {
values: it.map(it => Util.extractPosition(it)),
type: 'thru'
}
} else {
it.values = it.values.map(it => Util.extractPosition(it))
bezier = it
}
objects.push({
bezier
})
})
} else {
opts.to.forEach(it => {
const to = Util.extractPosition(it)
objects.push({
x: to.x,
y: to.y
})
})
}
return objects
}
/**
* Checks if a thing is a string.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @static
* @param {object} object - The object to test for.
* @return {boolean} - true if the thing is a string, otherwise false.
*/
static isString(object) {
return typeof object === 'string'
}
/**
* Checks if a thing is a number.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @static
* @param {object} object - The object to test for.
* @return {boolean} - true if the thing is a number, otherwise false.
*/
static isNumber(object) {
return typeof object === 'number'
}
/**
* Checks if a thing is an object.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @static
* @param {object} object - The object to test for.
* @return {boolean} - true if the thing is an object, otherwise false.
*/
static isObject(object) {
return typeof object === 'object' & & !Array.isArray(object)
}
/**
* Checks if a thing is an PIXI.DisplayObject.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @static
* @param {object} object - The object to test for.
* @return {boolean} - true if the thing is a PIXI.DisplayObject, otherwise false.
*/
static isPixiDisplayObject(object) {
2019-07-18 12:26:39 +02:00
return (
typeof object.getBounds === 'function' & &
typeof object.renderWebGL === 'function' & &
typeof object.setTransform === 'function'
)
2019-03-29 08:49:53 +01:00
}
/**
* Checks if a thing is a frame.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @static
* @param {object} object - The object to test for.
* @return {boolean} - true if the thing is a frame, otherwise false.
*/
static isFrame(object) {
return object.contentDocument != null
}
}
/**
* Event helper class.
*
* @example
* // Creates an event object.
* const event = Event.create(h2, {x: 5, y: 10}, 'touchstart')
*
* @private
* @ignore
* @class
*/
class Event {
/**
* Creates an event object.
2019-07-18 12:26:39 +02:00
*
2019-03-29 08:49:53 +01:00
* @static
* @param {HTMLElement} target - The element on which the event should be executed.
* @param {object} position - The local position of the event in relation to the target. The object must have the keys x and y.
* @param {string} type - The type of the event, see https://developer.mozilla.org/de/docs/Web/Events
* @param {object} opts - An options object. Every paramter of the event object can be overridden, see e.g. https://developer.mozilla.org/de/docs/Web/API/MouseEvent for all the properties.
*/
2019-07-18 12:26:39 +02:00
static create(
target,
position = { x: 0, y: 0 },
type = 'pointerup',
opts = {}
) {
const rect =
typeof target.getBoundingClientRect === 'function'
? target.getBoundingClientRect()
: { x: 0, y: 0 }
2019-03-29 08:49:53 +01:00
// EventInit
const eventOpts = {
bubbles: true,
cancelable: true,
composed: false
}
// UIEventInit
const uiEventOpts = {
detail: 0,
view: window
}
// MouseEvent
const mouseEventOpts = {
2019-07-10 11:55:35 +02:00
screenX: window.screenX + (target.offsetLeft || 0) + position.x,
screenY: window.screenY + (target.offsetTop || 0) + position.y,
2019-03-29 08:49:53 +01:00
clientX: rect.x + position.x,
clientY: rect.y + position.y,
ctrlKey: false,
shiftKey: false,
altKey: false,
metaKey: false,
button: 0,
buttons: 1,
relatedTarget: null,
region: null
}
// TouchEvent
const touchEventOpts = {
touches: [],
targetTouches: [],
changedTouches: [],
ctrlKey: false,
shiftKey: false,
altKey: false,
metaKey: false
}
// PointerEvent
const pointerEventOpts = {
pointerId: 0,
width: 1,
height: 1,
pressure: 0,
tangentialPressure: 0,
tiltX: 0,
tiltY: 0,
twist: 0,
pointerType: 'touch',
isPrimary: true
}
if (type.startsWith('pointer')) {
2019-07-18 12:26:39 +02:00
return new PointerEvent(
type,
Object.assign(
{},
eventOpts,
uiEventOpts,
mouseEventOpts,
pointerEventOpts,
opts
)
)
2019-03-29 08:49:53 +01:00
} else if (type.startsWith('touch')) {
2019-07-18 12:26:39 +02:00
return new TouchEvent(
type,
Object.assign({}, eventOpts, uiEventOpts, touchEventOpts, opts)
)
2019-03-29 08:49:53 +01:00
} else {
2019-07-18 12:26:39 +02:00
return new MouseEvent(
type,
Object.assign({}, eventOpts, uiEventOpts, mouseEventOpts, opts)
)
2019-03-29 08:49:53 +01:00
}
}
}
< / code > < / pre >
< / article >
< / section >
< footer class = "content-size" >
< div class = "footer" >
2019-07-18 12:26:39 +02:00
Documentation generated by < a href = "https://github.com/jsdoc3/jsdoc" > JSDoc 3.6.3< / a > on Thu Jul 18 2019 12:16:18 GMT+0200 (Mitteleuropäische Sommerzeit)
2019-03-29 08:49:53 +01:00
< / div >
< / footer >
< / div >
< / div >
< script > prettyPrint ( ) ; < / script >
< script src = "scripts/main.js" > < / script >
< / body >
< / html >