windowmanager
Version:
A framework to manage multiple dockable, HTML windows
2,155 lines (518 loc) • 30.1 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>Vector - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BoundingBox.html">BoundingBox</a><ul class='methods'><li data-type='method'><a href="BoundingBox.html#clone">clone</a></li><li data-type='method'><a href="BoundingBox.html#difference">difference</a></li><li data-type='method'><a href="BoundingBox.html#getArea">getArea</a></li><li data-type='method'><a href="BoundingBox.html#getBoundingBox">getBoundingBox</a></li><li data-type='method'><a href="BoundingBox.html#getCenteredOnPosition">getCenteredOnPosition</a></li><li data-type='method'><a href="BoundingBox.html#getCenterPosition">getCenterPosition</a></li><li data-type='method'><a href="BoundingBox.html#getColliding">getColliding</a></li><li data-type='method'><a href="BoundingBox.html#getCollisionMesh">getCollisionMesh</a></li><li data-type='method'><a href="BoundingBox.html#getDistanceSquaredToPoint">getDistanceSquaredToPoint</a></li><li data-type='method'><a href="BoundingBox.html#getDistanceToPoint">getDistanceToPoint</a></li><li data-type='method'><a href="BoundingBox.html#getEdgeClosest">getEdgeClosest</a></li><li data-type='method'><a href="BoundingBox.html#getEdgeClosestOrder">getEdgeClosestOrder</a></li><li data-type='method'><a href="BoundingBox.html#getEdgeTouching">getEdgeTouching</a></li><li data-type='method'><a href="BoundingBox.html#getHeight">getHeight</a></li><li data-type='method'><a href="BoundingBox.html#getIntersection">getIntersection</a></li><li data-type='method'><a href="BoundingBox.html#getOtherEdgeTouching">getOtherEdgeTouching</a></li><li data-type='method'><a href="BoundingBox.html#getPosition">getPosition</a></li><li data-type='method'><a href="BoundingBox.html#getSize">getSize</a></li><li data-type='method'><a href="BoundingBox.html#getSnapDelta">getSnapDelta</a></li><li data-type='method'><a href="BoundingBox.html#getWidth">getWidth</a></li><li data-type='method'><a href="BoundingBox.html#isColliding">isColliding</a></li><li data-type='method'><a href="BoundingBox.html#isContains">isContains</a></li><li data-type='method'><a href="BoundingBox.html#isNaN">isNaN</a></li><li data-type='method'><a href="BoundingBox.html#isTouching">isTouching</a></li><li data-type='method'><a href="BoundingBox.html#moveBy">moveBy</a></li><li data-type='method'><a href="BoundingBox.html#moveTo">moveTo</a></li><li data-type='method'><a href="BoundingBox.html#resizeTo">resizeTo</a></li><li data-type='method'><a href="BoundingBox.html#set">set</a></li><li data-type='method'><a href="BoundingBox.html#someColliding">someColliding</a></li><li data-type='method'><a href="BoundingBox.html#someContains">someContains</a></li><li data-type='method'><a href="BoundingBox.html#someTouching">someTouching</a></li></ul></li><li><a href="CollisionMesh.html">CollisionMesh</a><ul class='methods'><li data-type='method'><a href="CollisionMesh.html#clone">clone</a></li><li data-type='method'><a href="CollisionMesh.html#getBoundingBox">getBoundingBox</a></li><li data-type='method'><a href="CollisionMesh.html#getColliding">getColliding</a></li><li data-type='method'><a href="CollisionMesh.html#getCollisionMesh">getCollisionMesh</a></li><li data-type='method'><a href="CollisionMesh.html#getHeight">getHeight</a></li><li data-type='method'><a href="CollisionMesh.html#getPosition">getPosition</a></li><li data-type='method'><a href="CollisionMesh.html#getSize">getSize</a></li><li data-type='method'><a href="CollisionMesh.html#getWidth">getWidth</a></li><li data-type='method'><a href="CollisionMesh.html#isColliding">isColliding</a></li><li data-type='method'><a href="CollisionMesh.html#isContains">isContains</a></li><li data-type='method'><a href="CollisionMesh.html#isTouching">isTouching</a></li><li data-type='method'><a href="CollisionMesh.html#moveBy">moveBy</a></li><li data-type='method'><a href="CollisionMesh.html#moveTo">moveTo</a></li><li data-type='method'><a href="CollisionMesh.html#someColliding">someColliding</a></li><li data-type='method'><a href="CollisionMesh.html#someContains">someContains</a></li><li data-type='method'><a href="CollisionMesh.html#someTouching">someTouching</a></li></ul></li><li><a href="EventHandler.html">EventHandler</a><ul class='methods'><li data-type='method'><a href="EventHandler.html#addPipe">addPipe</a></li><li data-type='method'><a href="EventHandler.html#clearEvent">clearEvent</a></li><li data-type='method'><a href="EventHandler.html#emit">emit</a></li><li data-type='method'><a href="EventHandler.html#off">off</a></li><li data-type='method'><a href="EventHandler.html#on">on</a></li><li data-type='method'><a href="EventHandler.html#once">once</a></li><li data-type='method'><a href="EventHandler.html#removePipe">removePipe</a></li></ul></li><li><a href="Position.html">Position</a></li><li><a href="Size.html">Size</a></li><li><a href="Vector.html">Vector</a><ul class='methods'><li data-type='method'><a href="Vector.html#add">add</a></li><li data-type='method'><a href="Vector.html#clone">clone</a></li><li data-type='method'><a href="Vector.html#distance">distance</a></li><li data-type='method'><a href="Vector.html#distanceSquared">distanceSquared</a></li><li data-type='method'><a href="Vector.html#getBoundingBox">getBoundingBox</a></li><li data-type='method'><a href="Vector.html#getCollisionMesh">getCollisionMesh</a></li><li data-type='method'><a href="Vector.html#getVector">getVector</a></li><li data-type='method'><a href="Vector.html#isNaN">isNaN</a></li><li data-type='method'><a href="Vector.html#moveBy">moveBy</a></li><li data-type='method'><a href="Vector.html#moveTo">moveTo</a></li><li data-type='method'><a href="Vector.html#set">set</a></li><li data-type='method'><a href="Vector.html#setMax">setMax</a></li><li data-type='method'><a href="Vector.html#setMin">setMin</a></li><li data-type='method'><a href="Vector.html#subtract">subtract</a></li></ul></li><li><a href="Window.html">Window</a><ul class='methods'><li data-type='method'><a href="Window.html#.getAll">getAll</a></li><li data-type='method'><a href="Window.html#.getByID">getByID</a></li><li data-type='method'><a href="Window.html#.getCurrent">getCurrent</a></li><li data-type='method'><a href="Window.html#addPipe">addPipe</a></li><li data-type='method'><a href="Window.html#bringToFront">bringToFront</a></li><li data-type='method'><a href="Window.html#clearEvent">clearEvent</a></li><li data-type='method'><a href="Window.html#close">close</a></li><li data-type='method'><a href="Window.html#dock">dock</a></li><li data-type='method'><a href="Window.html#emit">emit</a></li><li data-type='method'><a href="Window.html#focus">focus</a></li><li data-type='method'><a href="Window.html#getBounds">getBounds</a></li><li data-type='method'><a href="Window.html#getHeight">getHeight</a></li><li data-type='method'><a href="Window.html#getPosition">getPosition</a></li><li data-type='method'><a href="Window.html#getSize">getSize</a></li><li data-type='method'><a href="Window.html#getTitle">getTitle</a></li><li data-type='method'><a href="Window.html#getWidth">getWidth</a></li><li data-type='method'><a href="Window.html#hide">hide</a></li><li data-type='method'><a href="Window.html#isClosed">isClosed</a></li><li data-type='method'><a href="Window.html#isHidden">isHidden</a></li><li data-type='method'><a href="Window.html#isMaximized">isMaximized</a></li><li data-type='method'><a href="Window.html#isMinimized">isMinimized</a></li><li data-type='method'><a href="Window.html#isReady">isReady</a></li><li data-type='method'><a href="Window.html#isRestored">isRestored</a></li><li data-type='method'><a href="Window.html#isShown">isShown</a></li><li data-type='method'><a href="Window.html#maximize">maximize</a></li><li data-type='method'><a href="Window.html#minimize">minimize</a></li><li data-type='method'><a href="Window.html#moveBy">moveBy</a></li><li data-type='method'><a href="Window.html#moveTo">moveTo</a></li><li data-type='method'><a href="Window.html#off">off</a></li><li data-type='method'><a href="Window.html#on">on</a></li><li data-type='method'><a href="Window.html#once">once</a></li><li data-type='method'><a href="Window.html#onReady">onReady</a></li><li data-type='method'><a href="Window.html#removePipe">removePipe</a></li><li data-type='method'><a href="Window.html#resizeTo">resizeTo</a></li><li data-type='method'><a href="Window.html#restore">restore</a></li><li data-type='method'><a href="Window.html#setBounds">setBounds</a></li><li data-type='method'><a href="Window.html#setTitle">setTitle</a></li><li data-type='method'><a href="Window.html#show">show</a></li><li data-type='method'><a href="Window.html#undock">undock</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="geometry.html">geometry</a></li><li><a href="messagebus.html">messagebus</a><ul class='methods'><li data-type='method'><a href="messagebus.html#.off">off</a></li><li data-type='method'><a href="messagebus.html#.on">on</a></li><li data-type='method'><a href="messagebus.html#.send">send</a></li></ul></li><li><a href="windowmanager.html">windowmanager</a><ul class='methods'><li data-type='method'><a href="windowmanager.html#.isReady">isReady</a></li><li data-type='method'><a href="windowmanager.html#.onReady">onReady</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<div id="main">
<h1 class="page-title">Vector</h1>
<section>
<header>
<h2>
Vector
</h2>
<div class="class-description"><p>A Vector class.</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="Vector"><span class="type-signature"></span>new Vector<span class="signature">(left, top)</span><span class="type-signature"></span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>left</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"><p>The position of the vector's x-axis.</p></td>
</tr>
<tr>
<td class="name"><code>top</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"><p>The position of the vector's y-axis.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="add"><span class="type-signature"></span>add<span class="signature">(other)</span><span class="type-signature"> → {Number}</span></h4>
<div class="description">
<p>Add <code>other</code> to <code>this</code>.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>other</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="clone"><span class="type-signature"></span>clone<span class="signature">()</span><span class="type-signature"> → {<a href="Vector.html">Vector</a>}</span></h4>
<div class="description">
<p>Clone the current vector to a new object.</p>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A clone of this instance</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Vector.html">Vector</a></span>
</dd>
</dl>
<h4 class="name" id="distance"><span class="type-signature"></span>distance<span class="signature">(other)</span><span class="type-signature"> → {Number}</span></h4>
<div class="description">
<p>Returns the distance between <code>this</code> and <code>other</code>.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>other</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="distanceSquared"><span class="type-signature"></span>distanceSquared<span class="signature">(other)</span><span class="type-signature"> → {Number}</span></h4>
<div class="description">
<p>Returns the squared distance between <code>this</code> and <code>other</code>.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>other</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="getBoundingBox"><span class="type-signature"></span>getBoundingBox<span class="signature">()</span><span class="type-signature"> → {<a href="BoundingBox.html">BoundingBox</a>}</span></h4>
<div class="description">
<p>Returns a BoundingBox instance version of this vector similar to:<br></p>
<pre class="prettyprint source lang-javascript"><code>new BoundingBox(Vector.left, Vector.top, Vector.left, Vector.top)</code></pre>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="BoundingBox.html">BoundingBox</a></span>
</dd>
</dl>
<h4 class="name" id="getCollisionMesh"><span class="type-signature"></span>getCollisionMesh<span class="signature">()</span><span class="type-signature"> → {<a href="CollisionMesh.html">CollisionMesh</a>}</span></h4>
<div class="description">
<p>Returns a <a href="CollisionMesh.html">CollisionMesh</a> instance version of this vector similar to:<br></p>
<pre class="prettyprint source lang-javascript"><code>new CollisionMesh(Vector.getBoundingBox())</code></pre>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="CollisionMesh.html">CollisionMesh</a></span>
</dd>
</dl>
<h4 class="name" id="getVector"><span class="type-signature"></span>getVector<span class="signature">()</span><span class="type-signature"> → {<a href="Vector.html">Vector</a>}</span></h4>
<div class="description">
<p>Resolve this object down to a <a href="Vector.html">Vector</a> instance.
Since this instance is already a vector, it returns itself.</p>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>self</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Vector.html">Vector</a></span>
</dd>
</dl>
<h4 class="name" id="isNaN"><span class="type-signature"></span>isNaN<span class="signature">()</span><span class="type-signature"> → {Boolean}</span></h4>
<div class="description">
<p>Checks if any property on <code>this</code> is NaN.</p>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id="moveBy"><span class="type-signature"></span>moveBy<span class="signature">(deltaLeft<span class="signature-attributes">opt</span>, deltaTop<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="Vector.html">Vector</a>}</span></h4>
<div class="description">
<p>Move <code>this</code> relatively to position by <code>deltaLeft</code> and/or <code>deltaTop</code>.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>deltaLeft</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
null
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>deltaTop</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
null
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>self</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Vector.html">Vector</a></span>
</dd>
</dl>
<h4 class="name" id="moveTo"><span class="type-signature"></span>moveTo<span class="signature">(left<span class="signature-attributes">opt</span>, top<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="Vector.html">Vector</a>}</span></h4>
<div class="description">
<p>Move <code>this</code> to position at <code>left</code> and/or <code>top</code>.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>left</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
null
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>top</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
null
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>self</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Vector.html">Vector</a></span>
</dd>
</dl>
<h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(other)</span><span class="type-signature"> → {<a href="Vector.html">Vector</a>}</span></h4>
<div class="description">
<p>Sets <code>this.left</code> to <code>other.left</code>, and sets <code>this.top</code> to <code>other.top</code>.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>other</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>self</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Vector.html">Vector</a></span>
</dd>
</dl>
<h4 class="name" id="setMax"><span class="type-signature"></span>setMax<span class="signature">(other)</span><span class="type-signature"> → {Number}</span></h4>
<div class="description">
<p>Sets <code>this</code>'s properties if <code>other</code>'s is larger.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>other</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="setMin"><span class="type-signature"></span>setMin<span class="signature">(other)</span><span class="type-signature"> → {Number}</span></h4>
<div class="description">
<p>Sets <code>this</code>'s properties if <code>other</code>'s is smaller.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>other</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="subtract"><span class="type-signature"></span>subtract<span class="signature">(other)</span><span class="type-signature"> → {Number}</span></h4>
<div class="description">
<p>Subtract <code>other</code> from <code>this</code>.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>other</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Jan 26 2017 13:33:48 GMT-0500 (Eastern Standard Time) using the Minami theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>