Skip to content

Commit

Permalink
updated docs with new clampOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfig committed Apr 3, 2021
1 parent 5336687 commit 1e969c7
Show file tree
Hide file tree
Showing 25 changed files with 99 additions and 76 deletions.
2 changes: 1 addition & 1 deletion docs/jsdoc/EventEmitter-.html
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ <h4 class="name" id="EventEmitter">

<footer class="content-size">
<div class="footer">
Documentation generated by <a target="_blank" href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a target="_blank" href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/Plugin.html
Original file line number Diff line number Diff line change
Expand Up @@ -1667,7 +1667,7 @@ <h5>Returns:</h5>

<footer class="content-size">
<div class="footer">
Documentation generated by <a target="_blank" href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a target="_blank" href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/PluginManager.html
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ <h4 class="name" id="resume">

<footer class="content-size">
<div class="footer">
Documentation generated by <a target="_blank" href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a target="_blank" href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/Viewport.html
Original file line number Diff line number Diff line change
Expand Up @@ -10534,7 +10534,7 @@ <h5>Type:</h5>

<footer class="content-size">
<div class="footer">
Documentation generated by <a target="_blank" href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a target="_blank" href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
19 changes: 18 additions & 1 deletion docs/jsdoc/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,23 @@ <h4 class="name" id="ClampOptions">
</dt>
<dd>

<div class="description">
<p>There are three ways to clamp:</p>
<ol>
<li>direction: 'all' = the world is clamped to its world boundaries, ie, you cannot drag any part of the world offscreen
direction: 'x' | 'y' = only the x or y direction is clamped to its world boundary</li>
<li>left, right, top, bottom = true | number = the world is clamped to the world's pixel location for each side;
if any of these are set to true, then the location is set to the boundary [0, viewport.worldWidth/viewport.worldHeight]
eg: to allow the world to be completely dragged offscreen, set [-viewport.worldWidth, -viewport.worldHeight, viewport.worldWidth * 2, viewport.worldHeight * 2]</li>
</ol>
<p>Underflow determines what happens when the world is smaller than the viewport</p>
<ol>
<li>none = the world is clamped but there is no special behavior</li>
<li>center = the world is centered on the viewport</li>
<li>combination of top/bottom/center and left/right/center (case insensitive) = the world is stuck to the appropriate boundaries</li>
</ol>
</div>



<dl class="details">
Expand Down Expand Up @@ -5817,7 +5834,7 @@ <h4 class="name" id="event:snap-zoom-end(Viewport)emittedeachtimefitreachesitsta

<footer class="content-size">
<div class="footer">
Documentation generated by <a target="_blank" href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a target="_blank" href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ <h2>license</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a target="_blank" href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a target="_blank" href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/node_modules_eventemitter3_index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ <h2>node_modules/eventemitter3/index.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ <h2>node_modules/eventemitter3/umd/eventemitter3.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_ease.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ <h2>src/ease.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_input-manager.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ <h2>src/input-manager.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_plugin-manager.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ <h2>src/plugin-manager.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_plugins_animate.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ <h2>src/plugins/animate.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_plugins_bounce.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ <h2>src/plugins/bounce.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_plugins_clamp-zoom.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ <h2>src/plugins/clamp-zoom.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
110 changes: 58 additions & 52 deletions docs/jsdoc/src_plugins_clamp.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,18 @@ <h2>src/plugins/clamp.js</h2>
<pre id="source-code" class="prettyprint source "><code>import { Plugin } from './plugin'

/**
* There are three ways to clamp:
* 1. direction: 'all' = the world is clamped to its world boundaries, ie, you cannot drag any part of the world offscreen
* direction: 'x' | 'y' = only the x or y direction is clamped to its world boundary
* 2. left, right, top, bottom = true | number = the world is clamped to the world's pixel location for each side;
* if any of these are set to true, then the location is set to the boundary [0, viewport.worldWidth/viewport.worldHeight]
* eg: to allow the world to be completely dragged offscreen, set [-viewport.worldWidth, -viewport.worldHeight, viewport.worldWidth * 2, viewport.worldHeight * 2]
*
* Underflow determines what happens when the world is smaller than the viewport
* 1. none = the world is clamped but there is no special behavior
* 2. center = the world is centered on the viewport
* 3. combination of top/bottom/center and left/right/center (case insensitive) = the world is stuck to the appropriate boundaries
*
* @typedef ClampOptions
* @property {(number|boolean)} [left=false] clamp left; true = 0
* @property {(number|boolean)} [right=false] clamp right; true = viewport.worldWidth
Expand Down Expand Up @@ -488,33 +500,30 @@ <h2>src/plugins/clamp.js</h2>
if (this.options.left !== null || this.options.right !== null)
{
let moved = false
if (this.parent.screenWorldWidth &lt; this.parent.screenWidth)
if (!this.noUnderflow &amp;&amp; this.parent.screenWorldWidth &lt; this.parent.screenWidth)
{
if (!this.noUnderflow)
switch (this.underflowX)
{
switch (this.underflowX)
{
case -1:
if (this.parent.x !== 0)
{
this.parent.x = 0
moved = true
}
break
case 1:
if (this.parent.x !== this.parent.screenWidth - this.parent.screenWorldWidth)
{
this.parent.x = this.parent.screenWidth - this.parent.screenWorldWidth
moved = true
}
break
default:
if (this.parent.x !== (this.parent.screenWidth - this.parent.screenWorldWidth) / 2)
{
this.parent.x = (this.parent.screenWidth - this.parent.screenWorldWidth) / 2
moved = true
}
}
case -1:
if (this.parent.x !== 0)
{
this.parent.x = 0
moved = true
}
break
case 1:
if (this.parent.x !== this.parent.screenWidth - this.parent.screenWorldWidth)
{
this.parent.x = this.parent.screenWidth - this.parent.screenWorldWidth
moved = true
}
break
default:
if (this.parent.x !== (this.parent.screenWidth - this.parent.screenWorldWidth) / 2)
{
this.parent.x = (this.parent.screenWidth - this.parent.screenWorldWidth) / 2
moved = true
}
}
}
else
Expand Down Expand Up @@ -546,33 +555,30 @@ <h2>src/plugins/clamp.js</h2>
if (this.options.top !== null || this.options.bottom !== null)
{
let moved = false
if (this.parent.screenWorldHeight &lt; this.parent.screenHeight)
if (!this.noUnderflow &amp;&amp; this.parent.screenWorldHeight &lt; this.parent.screenHeight)
{
if (!this.noUnderflow)
switch (this.underflowY)
{
switch (this.underflowY)
{
case -1:
if (this.parent.y !== 0)
{
this.parent.y = 0
moved = true
}
break
case 1:
if (this.parent.y !== this.parent.screenHeight - this.parent.screenWorldHeight)
{
this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight)
moved = true
}
break
default:
if (this.parent.y !== (this.parent.screenHeight - this.parent.screenWorldHeight) / 2)
{
this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight) / 2
moved = true
}
}
case -1:
if (this.parent.y !== 0)
{
this.parent.y = 0
moved = true
}
break
case 1:
if (this.parent.y !== this.parent.screenHeight - this.parent.screenWorldHeight)
{
this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight)
moved = true
}
break
default:
if (this.parent.y !== (this.parent.screenHeight - this.parent.screenWorldHeight) / 2)
{
this.parent.y = (this.parent.screenHeight - this.parent.screenWorldHeight) / 2
moved = true
}
}
}
else
Expand Down Expand Up @@ -607,7 +613,7 @@ <h2>src/plugins/clamp.js</h2>
this.last.scaleY = this.parent.scale.y
}

reset()
reset()
{
this.update();
}
Expand All @@ -625,7 +631,7 @@ <h2>src/plugins/clamp.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_plugins_decelerate.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ <h2>src/plugins/decelerate.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_plugins_drag.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ <h2>src/plugins/drag.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_plugins_follow.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ <h2>src/plugins/follow.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_plugins_mouse-edges.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ <h2>src/plugins/mouse-edges.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_plugins_pinch.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ <h2>src/plugins/pinch.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_plugins_plugin.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ <h2>src/plugins/plugin.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_plugins_snap-zoom.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ <h2>src/plugins/snap-zoom.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_plugins_snap.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ <h2>src/plugins/snap.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdoc/src_plugins_wheel.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ <h2>src/plugins/wheel.js</h2>

<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sat Apr 03 2021 06:27:57 GMT+0800 (Taipei Standard Time)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Sun Apr 04 2021 07:23:25 GMT+0800 (Taipei Standard Time)
</div>
</footer>
</div>
Expand Down
Loading

0 comments on commit 1e969c7

Please sign in to comment.