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 >
2019-07-31 16:12:00 +02:00
< li class = "parent " data-name = "ButtonGroup#_stackHorizontal" > < a href = "ButtonGroup.html#_stackHorizontal" > _stackHorizontal< / a > < / li >
< li class = "parent " data-name = "ButtonGroup#_stackVertical" > < a href = "ButtonGroup.html#_stackVertical" > _stackVertical< / a > < / li >
< li class = "parent " data-name = "ButtonGroup#capture" > < a href = "ButtonGroup.html#capture" > capture< / a > < / li >
2019-03-29 08:49:53 +01:00
< 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 >
2019-07-31 16:12:00 +02:00
< li class = "parent " data-name = "ButtonGroup#stack" > < a href = "ButtonGroup.html#stack" > stack< / a > < / li >
2019-03-29 08:49:53 +01:00
< / 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 = "pixi_button.js.html" > Source: pixi/button.js< / h1 >
< section >
< header >
< div class = "header content-size" >
< h2 > pixi/button.js< / h2 >
< / div >
< / header >
< article >
2019-07-31 16:12:00 +02:00
< pre id = "source-code" class = "prettyprint source linenums" > < code > /* global */
2019-07-10 11:55:35 +02:00
import Theme from './theme.js'
2019-03-29 08:49:53 +01:00
import Tooltip from './tooltip.js'
import Badge from './badge.js'
import Events from '../events.js'
2019-07-31 16:12:00 +02:00
import { Points } from '../utils.js'
2019-03-29 08:49:53 +01:00
/**
* Callback for the button action.
*
* @callback actionCallback
* @param {object} event - The event object.
* @param {Button} button - A reference to the button (also this refers to the button).
*/
/**
* Callback for the button beforeAction.
*
* @callback beforeActionCallback
* @param {object} event - The event object.
* @param {Button} button - A reference to the button (also this refers to the button).
*/
/**
* Callback for the button afterAction.
*
* @callback afterActionCallback
* @param {object} event - The event object.
* @param {Button} button - A reference to the button (also this refers to the button).
*/
/**
* Class that represents a PixiJS Button.
*
* @example
* // Create the button
* const button = new Button({
* label: 'My Button',
* action: () => console.log('Button was clicked')
* })
*
* // Add the button to a DisplayObject
* app.scene.addChild(button)
*
* @class
* @extends PIXI.Container
* @see {@link http://pixijs.download/dev/docs/PIXI.Container.html|PIXI.Container}
* @see {@link https://www.iwm-tuebingen.de/iwmbrowser/lib/pixi/button.html|DocTest}
*/
export default class Button extends PIXI.Container {
/**
* Creates an instance of a Button.
*
* @constructor
* @param {object} [opts] - An options object to specify to style and behaviour of the button.
* @param {number} [opts.id=auto generated] - The id of the button.
* @param {string} [opts.label] - The label of the button.
* @param {number} [opts.x=0] - The x position of the button. Can be also set after creation with button.x = 0.
* @param {number} [opts.y=0] - The y position of the button. Can be also set after creation with button.y = 0.
* @param {string|Theme} [opts.theme=dark] - The theme to use for this button. Possible values are dark, light, red
* or a Theme object.
* @param {number} [opts.minWidth=44] - The minimum width of the button.
* @param {number} [opts.minHeight=44] - The minimum height of the button.
* @param {number} [opts.padding=Theme.padding] - The inner spacing (distance from icon and/or label) to the border.
* @param {string|PIXI.DisplayObject} [opts.icon] - The icon of the button. Can be a predefined one, an URL or an PIXI.DisplayObject.
* @param {string|PIXI.DisplayObject} [opts.iconActive=icon] - The icon of the button when activated. Can be a predefined one, an URL or an PIXI.DisplayObject.
* @param {string} [opts.iconPosition=left] - The position of the icon in relation to the label. Can be left or right.
* @param {number} [opts.iconColor=Theme.iconColor] - The color of the icon (set by the tint property) as a hex value.
* @param {number} [opts.iconColorActive=Theme.iconColorActive] - The color of the icon when activated.
* @param {number} [opts.fill=Theme.fill] - The color of the button background as a hex value.
* @param {number} [opts.fillAlpha=Theme.fillAlpha] - The alpha value of the background.
* @param {number} [opts.fillActive=Theme.fillActive] - The color of the button background when activated.
* @param {number} [opts.fillActiveAlpha=Theme.fillActiveAlpha] - The alpha value of the background when activated.
* @param {number} [opts.stroke=Theme.stroke] - The color of the border as a hex value.
* @param {number} [opts.strokeWidth=Theme.strokeWidth] - The width of the border in pixel.
* @param {number} [opts.strokeAlpha=Theme.strokeAlpha] - The alpha value of the border.
* @param {number} [opts.strokeActive=Theme.strokeActive] - The color of the border when activated.
* @param {number} [opts.strokeActiveWidth=Theme.strokeActiveWidth] - The width of the border in pixel when activated.
* @param {number} [opts.strokeActiveAlpha=Theme.strokeActiveAlpha] - The alpha value of the border when activated.
* @param {object} [opts.textStyle=Theme.textStyle] - A textstyle object for the styling of the label. See PIXI.TextStyle
* for possible options.
* @param {number} [opts.textStyleActive=Theme.textStyleActive] - A textstyle object for the styling of the label when the
* button is activated. See PIXI.TextStyle for possible options.
* @param {string} [opts.style=default] - A shortcut for styling options. Possible values are default, link.
* @param {number} [opts.radius=Theme.radius] - The radius of the four corners of the button (which is a rounded rectangle).
* @param {boolean} [opts.disabled=false] - Is the button disabled? When disabled, the button has a lower alpha value
* and cannot be clicked (interactive is set to false).
* @param {boolean} [opts.active=false] - Is the button initially active?
* @param {actionCallback} [opts.action] - Executed when the button was triggered (by pointerup).
* @param {beforeActionCallback} [opts.beforeAction] - Executed before the main action is triggered.
* @param {afterActionCallback} [opts.afterAction] - Executed after the main action was triggered.
* @param {string} [opts.type=default] - The type of the button. Can be default or checkbox. When the type is
* checkbox, the active state is toggled automatically.
* @param {string} [opts.align=center] - The horizontal position of the label and the icon. Possible values are
* left, center and right. Only affects the style when the minWidth is bigger than the width of the icon and label.
* @param {string} [opts.verticalAlign=middle] - The vertical position of the label and the icon. Possible values are
* top, middle and button. Only affects the style when the minHeight is bigger than the height of the icon and label.
* @param {string|object} [opts.tooltip] - A string for the label of the tooltip or an object to configure the tooltip
* to display.
* @param {string|object} [opts.badge] - A string for the label of the badge or an object to configure the badge to display.
* If the parameter is an object, all badge options can be set plus the following:
* @param {string} [opts.badge.align=right] - The horizontal alignment of the badge. Possible values: left, center, right
* @param {string} [opts.badge.verticalAlign=top] - The vertical alignment of the badge. Possible values: top, middle, bottom
* @param {number} [opts.badge.offsetLeft=0] - The horizontal shift of the badge.
* @param {number} [opts.badge.offsetTop=0] - The vertical shift of the badge.
* @param {boolean} [opts.visible=true] - Is the button initially visible (property visible)?
*/
constructor(opts = {}) {
super()
const theme = Theme.fromString(opts.theme)
this.theme = theme
2019-07-18 12:26:39 +02:00
this.opts = Object.assign(
{},
{
id: PIXI.utils.uid(),
label: null,
x: 0,
y: 0,
minWidth: 44,
minHeight: 44,
padding: theme.padding,
icon: undefined,
iconActive: undefined,
iconPosition: 'left',
iconColor: theme.iconColor,
iconColorActive: theme.iconColorActive,
fill: theme.fill,
fillAlpha: theme.fillAlpha,
fillActive: theme.fillActive,
fillActiveAlpha: theme.fillActiveAlpha,
stroke: theme.stroke,
strokeWidth: theme.strokeWidth,
strokeAlpha: theme.strokeAlpha,
strokeActive: theme.strokeActive,
strokeActiveWidth: theme.strokeActiveWidth,
strokeActiveAlpha: theme.strokeActiveAlpha,
textStyle: theme.textStyle,
textStyleActive: theme.textStyleActive,
style: 'default',
radius: theme.radius,
disabled: false,
active: false,
action: null,
beforeAction: null,
afterAction: null,
type: 'default',
align: 'center',
verticalAlign: 'middle',
tooltip: null,
badge: null,
visible: true
},
opts
)
2019-03-29 08:49:53 +01:00
this.id = this.opts.id
2019-07-31 16:12:00 +02:00
if (typeof this.opts.icon === 'undefined' & & typeof this.opts.iconActive !== 'undefined') {
2019-03-29 08:49:53 +01:00
this.opts.icon = this.opts.iconActive
2019-07-31 16:12:00 +02:00
} else if (typeof this.opts.icon !== 'undefined' & & typeof this.opts.iconActive === 'undefined') {
2019-03-29 08:49:53 +01:00
this.opts.iconActive = this.opts.icon
}
if (this.opts.style === 'link') {
2019-07-18 12:26:39 +02:00
Object.assign(this.opts, {
strokeAlpha: 0,
strokeActiveAlpha: 0,
fillAlpha: 0,
fillActiveAlpha: 0
})
2019-03-29 08:49:53 +01:00
}
this._active = null
this._disabled = null
2019-07-31 16:12:00 +02:00
this.__start = { x: null, y: null }
2019-03-29 08:49:53 +01:00
this.iconInactive = null
this.iconActive = null
this.text = null
this.button = null
this.content = null
this.tooltip = null
this.badge = null
this.visible = this.opts.visible
// setup
//-----------------
this.setup()
}
/**
* Captures an event to inform InteractionMapper about processed events.
*
* @param {event|PIXI.InteractionEvent} event - The PIXI event to capture.
*/
capture(event) {
Events.capturedBy(event.data.originalEvent, this)
}
/**
* Creates children and instantiates everything.
*
* @private
* @return {Button} A reference to the button for chaining.
*/
setup() {
// Button
//-----------------
let button = new PIXI.Graphics()
this.button = button
this.addChild(button)
// Content
//-----------------
let content = new PIXI.Container()
this.content = content
this.addChild(content)
// Text
//-----------------
if (this.opts.label) {
this.text = new PIXI.Text(this.opts.label, this.opts.textStyle)
}
// Icon
//-----------------
if (this.opts.icon) {
2019-07-31 16:12:00 +02:00
this.iconInactive = this.loadIcon(this.opts.icon, this.opts.iconColor)
2019-03-29 08:49:53 +01:00
}
if (this.opts.iconActive) {
2019-07-31 16:12:00 +02:00
this.iconActive = this.loadIcon(this.opts.iconActive, this.opts.iconColorActive)
2019-03-29 08:49:53 +01:00
}
// interaction
//-----------------
this.button.on('pointerover', e => {
this.capture(e)
2019-07-18 12:26:39 +02:00
TweenLite.to([this.button, this.content], this.theme.fast, {
alpha: 0.83,
overwrite: 'none'
})
2019-03-29 08:49:53 +01:00
})
this.button.on('pointermove', e => {
this.capture(e)
})
this.button.on('pointerout', e => {
this.capture(e)
2019-07-18 12:26:39 +02:00
TweenLite.to([this.button, this.content], this.theme.fast, {
alpha: 1,
overwrite: 'none'
})
2019-03-29 08:49:53 +01:00
})
2019-07-10 11:55:35 +02:00
// eslint-disable-next-line no-unused-vars
2019-03-29 08:49:53 +01:00
this.button.on('pointerdown', e => {
//this.capture(e)
2019-07-31 16:12:00 +02:00
this.__start.x = e.data.global.x
this.__start.y = e.data.global.y
2019-07-18 12:26:39 +02:00
TweenLite.to([this.button, this.content], this.theme.fast, {
alpha: 0.7,
overwrite: 'none'
})
2019-03-29 08:49:53 +01:00
})
this.button.on('pointerup', e => {
this.capture(e)
2019-07-31 16:12:00 +02:00
const distance = Points.distance(e.data.global, this.__start)
2019-03-29 08:49:53 +01:00
2019-07-31 16:12:00 +02:00
if (distance < 5) {
if (this.opts.beforeAction) {
this.opts.beforeAction.call(this, e, this)
}
2019-03-29 08:49:53 +01:00
2019-07-31 16:12:00 +02:00
if (this.opts.action) {
this.opts.action.call(this, e, this)
}
TweenLite.to([this.button, this.content], this.theme.fast, {
alpha: 0.83,
overwrite: 'none'
})
if (this.opts.type === 'checkbox') {
this.active = !this.active
}
2019-03-29 08:49:53 +01:00
2019-07-31 16:12:00 +02:00
if (this.opts.afterAction) {
this.opts.afterAction.call(this, e, this)
}
2019-03-29 08:49:53 +01:00
}
})
// disabled
//-----------------
this.disabled = this.opts.disabled
// active
//-----------------
2019-07-18 12:26:39 +02:00
this.active = this.opts.active // calls .layout()
2019-03-29 08:49:53 +01:00
// tooltip
//-----------------
if (this.opts.tooltip) {
if (typeof this.opts.tooltip === 'string') {
2019-07-18 12:26:39 +02:00
this.tooltip = new Tooltip({
object: this,
content: this.opts.tooltip
})
2019-03-29 08:49:53 +01:00
} else {
2019-07-31 16:12:00 +02:00
this.opts.tooltip = Object.assign({}, { object: this }, this.opts.tooltip)
2019-03-29 08:49:53 +01:00
this.tooltip = new Tooltip(this.opts.tooltip)
}
}
// badge
//-----------------
if (this.opts.badge) {
2019-07-18 12:26:39 +02:00
let opts = Object.assign(
{},
{
align: 'right',
verticalAlign: 'top',
offsetLeft: 0,
offsetTop: 0
}
)
2019-03-29 08:49:53 +01:00
if (typeof this.opts.badge === 'string') {
2019-07-10 11:55:35 +02:00
opts = Object.assign(opts, { content: this.opts.badge })
2019-03-29 08:49:53 +01:00
} else {
opts = Object.assign(opts, this.opts.badge)
}
const badge = new Badge(opts)
switch (opts.align) {
2019-07-18 12:26:39 +02:00
case 'left':
badge.x = this.x - badge.width / 2 + opts.offsetLeft
break
case 'center':
2019-07-31 16:12:00 +02:00
badge.x = this.x + this.width / 2 - badge.width / 2 + opts.offsetLeft
2019-07-18 12:26:39 +02:00
break
case 'right':
2019-07-31 16:12:00 +02:00
badge.x = this.x + this.width - badge.width / 2 + opts.offsetLeft
2019-03-29 08:49:53 +01:00
}
switch (opts.verticalAlign) {
2019-07-18 12:26:39 +02:00
case 'top':
badge.y = this.y - badge.height / 2 + opts.offsetTop
break
case 'middle':
2019-07-31 16:12:00 +02:00
badge.y = this.y + this.height / 2 - badge.height / 2 + opts.offsetTop
2019-07-18 12:26:39 +02:00
break
case 'bottom':
2019-07-31 16:12:00 +02:00
badge.y = this.y + this.height - badge.height / 2 + opts.offsetTop
2019-03-29 08:49:53 +01:00
}
this.addChild(badge)
this.badge = badge
}
// set position
//-----------------
this.position.set(this.opts.x, this.opts.y)
return this
}
/**
* Should be called to refresh the layout of the button. Can be used after resizing.
*
* @return {Button} A reference to the button for chaining.
*/
layout() {
// Clear content
//-----------------
this.removeChild(this.content)
this.content = new PIXI.Container()
this.addChild(this.content)
// Set the icon
//-----------------
let icon = null
if (!this.active & & this.iconInactive) {
icon = this.iconInactive
} else if (this.active & & this.iconActive) {
icon = this.iconActive
}
// Set the text
//-----------------
if (this.text) {
this.text.position.set(0, 0)
}
// Width and Height
//-----------------
let width = 0
if (icon & & this.text) {
width = icon.width + this.text.width + 3 * this.opts.padding
} else if (icon) {
width = icon.width + 2 * this.opts.padding
} else if (this.text) {
width = this.text.width + 2 * this.opts.padding
}
if (width < this.opts.minWidth) {
width = this.opts.minWidth
}
let height = 0
if (icon) {
height = icon.height + 2 * this.opts.padding
} else if (this.text) {
height = this.text.height + 2 * this.opts.padding
}
if (height < this.opts.minHeight) {
height = this.opts.minHeight
}
this._width = width
this._height = height
// Position icon and text
//-----------------
if (icon & & this.text) {
if (this.opts.iconPosition === 'right') {
icon.x = this.text.width + this.opts.padding
} else {
this.text.x = icon.width + this.opts.padding
}
this.content.addChild(icon, this.text)
} else if (icon) {
this.content.addChild(icon)
} else if (this.text) {
this.content.addChild(this.text)
}
this.layoutInnerContent()
this.layoutContent()
this.icon = icon
// draw
//-----------------
this.draw()
return this
}
/**
* Calculates the positions of the content children (icon and/or text).
*
* @private
* @return {Button} A reference to the button for chaining.
*/
layoutInnerContent() {
for (let child of this.content.children) {
switch (this.opts.verticalAlign) {
2019-07-18 12:26:39 +02:00
case 'top':
child.y = 0
break
case 'middle':
child.y = this.content.height / 2 - child.height / 2
break
case 'bottom':
child.y = this.content.height - child.height
break
2019-03-29 08:49:53 +01:00
}
}
return this
}
/**
* Sets the horizontal and vertical position of the content.
* Uses the option keys "align" and "verticalAlign".
*
* @private
* @return {Button} A reference to the button for chaining.
*/
layoutContent() {
switch (this.opts.align) {
2019-07-18 12:26:39 +02:00
case 'left':
this.content.x = this.opts.padding
break
case 'center':
this.content.x = (this._width - this.content.width) / 2
break
case 'right':
2019-07-31 16:12:00 +02:00
this.content.x = this._width - this.opts.padding - this.content.width
2019-07-18 12:26:39 +02:00
break
2019-03-29 08:49:53 +01:00
}
switch (this.opts.verticalAlign) {
2019-07-18 12:26:39 +02:00
case 'top':
this.content.y = this.opts.padding
break
case 'middle':
this.content.y = (this._height - this.content.height) / 2
break
case 'bottom':
2019-07-31 16:12:00 +02:00
this.content.y = this._height - this.opts.padding - this.content.height
2019-07-18 12:26:39 +02:00
break
2019-03-29 08:49:53 +01:00
}
return this
}
/**
* Draws the canvas.
*
* @private
* @return {Button} A reference to the button for chaining.
*/
draw() {
this.button.clear()
if (this.active) {
2019-07-31 16:12:00 +02:00
this.button.lineStyle(this.opts.strokeActiveWidth, this.opts.strokeActive, this.opts.strokeActiveAlpha)
this.button.beginFill(this.opts.fillActive, this.opts.fillActiveAlpha)
2019-03-29 08:49:53 +01:00
} else {
2019-07-31 16:12:00 +02:00
this.button.lineStyle(this.opts.strokeWidth, this.opts.stroke, this.opts.strokeAlpha)
2019-03-29 08:49:53 +01:00
this.button.beginFill(this.opts.fill, this.opts.fillAlpha)
}
2019-07-31 16:12:00 +02:00
this.button.drawRoundedRect(0, 0, this._width, this._height, this.opts.radius)
2019-03-29 08:49:53 +01:00
this.button.endFill()
return this
}
/**
* Gets or sets the active state.
*
* @member {boolean}
*/
get active() {
return this._active
}
set active(value) {
this._active = value
if (this._active) {
if (this.text) {
this.text.style = this.opts.textStyleActive
}
} else {
if (this.text) {
this.text.style = this.opts.textStyle
}
}
this.layout()
}
/**
* Gets or sets the disabled state. When disabled, the button cannot be clicked.
*
* @member {boolean}
*/
get disabled() {
return this._disabled
}
set disabled(value) {
this._disabled = value
if (this._disabled) {
this.button.interactive = false
this.button.buttonMode = false
2019-07-18 12:26:39 +02:00
this.button.alpha = 0.5
2019-03-29 08:49:53 +01:00
if (this.icon) {
2019-07-18 12:26:39 +02:00
this.icon.alpha = 0.5
2019-03-29 08:49:53 +01:00
}
if (this.text) {
2019-07-18 12:26:39 +02:00
this.text.alpha = 0.5
2019-03-29 08:49:53 +01:00
}
} else {
this.button.interactive = true
this.button.buttonMode = true
this.button.alpha = 1
if (this.icon) {
this.icon.alpha = 1
}
if (this.text) {
this.text.alpha = 1
}
}
}
/**
* Shows the button (sets his alpha values to 1).
*
* @return {Button} A reference to the button for chaining.
*/
show() {
this.opts.strokeAlpha = 1
this.opts.strokeActiveAlpha = 1
this.opts.fillAlpha = 1
this.opts.fillActiveAlpha = 1
this.layout()
return this
}
/**
* Hides the button (sets his alpha values to 0).
*
* @return {Button} A reference to the button for chaining.
*/
hide() {
this.opts.strokeAlpha = 0
this.opts.strokeActiveAlpha = 0
this.opts.fillAlpha = 0
this.opts.fillActiveAlpha = 0
this.layout()
return this
}
/**
* Loads an icon
*
* @private
* @param {string|PIXI.DisplayObject} icon - The icon to load.
* @param {number} color - The color of the icon (if not an PIXI.DisplayObject).
* @return {PIXI.DisplayObject} Return the icon as an PIXI.DisplayObject.
*/
loadIcon(icon, color) {
let displayObject = null
if (icon instanceof PIXI.DisplayObject) {
displayObject = icon
} else {
let size = 17
if (this.text) {
size = this.text.height
} else if (this.opts.minHeight) {
2019-07-18 12:26:39 +02:00
size = this.opts.minHeight - 2 * this.opts.padding
2019-03-29 08:49:53 +01:00
}
2019-07-31 16:12:00 +02:00
const url = Button.iconIsUrl(icon) ? icon : `../../assets/icons/${icon}.png`
2019-03-29 08:49:53 +01:00
const iconTexture = PIXI.Texture.fromImage(url, true)
const sprite = new PIXI.Sprite(iconTexture)
sprite.tint = color
sprite.width = size
sprite.height = size
displayObject = sprite
}
return displayObject
}
/**
* Tests if an icon string is an url.
*
* @private
* @static
* @param {string} url - The url to test.
* @return {boolean} true if the url is an url to an image.
*/
static iconIsUrl(url) {
return /\.(png|svg|gif|jpg|jpeg|tif|tiff)$/i.test(url)
}
/**
* Gets or sets the color of the current icon (no matter how the status is). Changing the color, changes
* the tint property of the icon sprite.
*
* @member {number}
*/
get iconColor() {
return this.icon ? this.icon.tint : null
}
set iconColor(value) {
if (this.icon) {
this.icon.tint = value
}
}
}
< / code > < / pre >
< / article >
< / section >
< footer class = "content-size" >
< div class = "footer" >
2019-08-01 10:31:05 +02:00
Documentation generated by < a href = "https://github.com/jsdoc3/jsdoc" > JSDoc 3.6.3< / a > on Thu Aug 01 2019 10:30:39 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 >