2
0

Viewport.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Class: Viewport</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Class: Viewport</h1>
  17. <section>
  18. <header>
  19. <h2><span class="attribs"><span class="type-signature"></span></span>Viewport<span class="signature">(canvas)</span><span class="type-signature"></span></h2>
  20. </header>
  21. <article>
  22. <div class="container-overview">
  23. <h4 class="name" id="Viewport"><span class="type-signature"></span>new Viewport<span class="signature">(canvas)</span><span class="type-signature"></span></h4>
  24. <div class="description">
  25. Used to indicate how the user views the content inside of the canvas.
  26. </div>
  27. <h5>Parameters:</h5>
  28. <table class="params">
  29. <thead>
  30. <tr>
  31. <th>Name</th>
  32. <th>Type</th>
  33. <th class="last">Description</th>
  34. </tr>
  35. </thead>
  36. <tbody>
  37. <tr>
  38. <td class="name"><code>canvas</code></td>
  39. <td class="type">
  40. <span class="param-type"><a href="DOM.html">DOM</a></span>
  41. </td>
  42. <td class="description last">Canvas DOM element where the viewport is being rendered.</td>
  43. </tr>
  44. </tbody>
  45. </table>
  46. <dl class="details">
  47. <dt class="tag-source">Source:</dt>
  48. <dd class="tag-source"><ul class="dummy"><li>
  49. <a href="Viewport.js.html">Viewport.js</a>, <a href="Viewport.js.html#line14">line 14</a>
  50. </li></ul></dd>
  51. </dl>
  52. </div>
  53. <h3 class="subsection-title">Members</h3>
  54. <h4 class="name" id="canvas"><span class="type-signature"></span>canvas<span class="type-signature"></span></h4>
  55. <div class="description">
  56. Canvas DOM element where the viewport is being rendered.
  57. </div>
  58. <dl class="details">
  59. <dt class="tag-source">Source:</dt>
  60. <dd class="tag-source"><ul class="dummy"><li>
  61. <a href="Viewport.js.html">Viewport.js</a>, <a href="Viewport.js.html#line24">line 24</a>
  62. </li></ul></dd>
  63. </dl>
  64. <h4 class="name" id="inverseMatrix"><span class="type-signature"></span>inverseMatrix<span class="type-signature"></span></h4>
  65. <div class="description">
  66. Inverse of the local transformation matrix.
  67. </div>
  68. <dl class="details">
  69. <dt class="tag-source">Source:</dt>
  70. <dd class="tag-source"><ul class="dummy"><li>
  71. <a href="Viewport.js.html">Viewport.js</a>, <a href="Viewport.js.html#line49">line 49</a>
  72. </li></ul></dd>
  73. </dl>
  74. <h4 class="name" id="matrix"><span class="type-signature"></span>matrix<span class="type-signature"></span></h4>
  75. <div class="description">
  76. Local transformation matrix applied to the object.
  77. </div>
  78. <dl class="details">
  79. <dt class="tag-source">Source:</dt>
  80. <dd class="tag-source"><ul class="dummy"><li>
  81. <a href="Viewport.js.html">Viewport.js</a>, <a href="Viewport.js.html#line44">line 44</a>
  82. </li></ul></dd>
  83. </dl>
  84. <h4 class="name" id="matrixNeedsUpdate"><span class="type-signature"></span>matrixNeedsUpdate<span class="type-signature"></span></h4>
  85. <div class="description">
  86. If true the matrix is updated before rendering the object.
  87. </div>
  88. <dl class="details">
  89. <dt class="tag-source">Source:</dt>
  90. <dd class="tag-source"><ul class="dummy"><li>
  91. <a href="Viewport.js.html">Viewport.js</a>, <a href="Viewport.js.html#line54">line 54</a>
  92. </li></ul></dd>
  93. </dl>
  94. <h4 class="name" id="moveOnScale"><span class="type-signature"></span>moveOnScale<span class="type-signature"></span></h4>
  95. <div class="description">
  96. Flag to indicate if the viewport should move when scalling. For some application its easier to focus the target if the viewport moves to the pointer location while scalling.
  97. </div>
  98. <dl class="details">
  99. <dt class="tag-source">Source:</dt>
  100. <dd class="tag-source"><ul class="dummy"><li>
  101. <a href="Viewport.js.html">Viewport.js</a>, <a href="Viewport.js.html#line61">line 61</a>
  102. </li></ul></dd>
  103. </dl>
  104. <h4 class="name" id="position"><span class="type-signature"></span>position<span class="type-signature"></span></h4>
  105. <div class="description">
  106. Position of the object.
  107. </div>
  108. <dl class="details">
  109. <dt class="tag-source">Source:</dt>
  110. <dd class="tag-source"><ul class="dummy"><li>
  111. <a href="Viewport.js.html">Viewport.js</a>, <a href="Viewport.js.html#line29">line 29</a>
  112. </li></ul></dd>
  113. </dl>
  114. <h4 class="name" id="rotation"><span class="type-signature"></span>rotation<span class="type-signature"></span></h4>
  115. <div class="description">
  116. Rotation of the object relative to its center.
  117. </div>
  118. <dl class="details">
  119. <dt class="tag-source">Source:</dt>
  120. <dd class="tag-source"><ul class="dummy"><li>
  121. <a href="Viewport.js.html">Viewport.js</a>, <a href="Viewport.js.html#line39">line 39</a>
  122. </li></ul></dd>
  123. </dl>
  124. <h4 class="name" id="rotationPoint"><span class="type-signature"></span>rotationPoint<span class="type-signature"></span></h4>
  125. <div class="description">
  126. Value of the initial point of rotation if the viewport is being rotated. Is set to null when the viewport is not being rotated.
  127. </div>
  128. <dl class="details">
  129. <dt class="tag-source">Source:</dt>
  130. <dd class="tag-source"><ul class="dummy"><li>
  131. <a href="Viewport.js.html">Viewport.js</a>, <a href="Viewport.js.html#line68">line 68</a>
  132. </li></ul></dd>
  133. </dl>
  134. <h4 class="name" id="scale"><span class="type-signature"></span>scale<span class="type-signature"></span></h4>
  135. <div class="description">
  136. Scale of the object.
  137. </div>
  138. <dl class="details">
  139. <dt class="tag-source">Source:</dt>
  140. <dd class="tag-source"><ul class="dummy"><li>
  141. <a href="Viewport.js.html">Viewport.js</a>, <a href="Viewport.js.html#line34">line 34</a>
  142. </li></ul></dd>
  143. </dl>
  144. <h4 class="name" id="uuid"><span class="type-signature"></span>uuid<span class="type-signature"></span></h4>
  145. <div class="description">
  146. UUID of the object.
  147. </div>
  148. <dl class="details">
  149. <dt class="tag-source">Source:</dt>
  150. <dd class="tag-source"><ul class="dummy"><li>
  151. <a href="Viewport.js.html">Viewport.js</a>, <a href="Viewport.js.html#line19">line 19</a>
  152. </li></ul></dd>
  153. </dl>
  154. <h3 class="subsection-title">Methods</h3>
  155. <h4 class="name" id="centerObject"><span class="type-signature"></span>centerObject<span class="signature">(object, canvas)</span><span class="type-signature"></span></h4>
  156. <div class="description">
  157. Center the viewport relative to a object. The position of the object is used a central point, this method does not consider "box" attributes or other strucures in the object.
  158. </div>
  159. <h5>Parameters:</h5>
  160. <table class="params">
  161. <thead>
  162. <tr>
  163. <th>Name</th>
  164. <th>Type</th>
  165. <th class="last">Description</th>
  166. </tr>
  167. </thead>
  168. <tbody>
  169. <tr>
  170. <td class="name"><code>object</code></td>
  171. <td class="type">
  172. <span class="param-type"><a href="Object2D.html">Object2D</a></span>
  173. </td>
  174. <td class="description last">Object to be centered on the viewport.</td>
  175. </tr>
  176. <tr>
  177. <td class="name"><code>canvas</code></td>
  178. <td class="type">
  179. <span class="param-type"><a href="DOM.html">DOM</a></span>
  180. </td>
  181. <td class="description last">Canvas element where the image is drawn.</td>
  182. </tr>
  183. </tbody>
  184. </table>
  185. <dl class="details">
  186. <dt class="tag-source">Source:</dt>
  187. <dd class="tag-source"><ul class="dummy"><li>
  188. <a href="Viewport.js.html">Viewport.js</a>, <a href="Viewport.js.html#line107">line 107</a>
  189. </li></ul></dd>
  190. </dl>
  191. <h4 class="name" id="updateMatrix"><span class="type-signature"></span>updateMatrix<span class="signature">()</span><span class="type-signature"></span></h4>
  192. <div class="description">
  193. Calculate and update the viewport transformation matrix. Also updates the inverse matrix of the viewport.
  194. </div>
  195. <dl class="details">
  196. <dt class="tag-source">Source:</dt>
  197. <dd class="tag-source"><ul class="dummy"><li>
  198. <a href="Viewport.js.html">Viewport.js</a>, <a href="Viewport.js.html#line76">line 76</a>
  199. </li></ul></dd>
  200. </dl>
  201. </article>
  202. </section>
  203. </div>
  204. <nav>
  205. <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BezierCurve.html">BezierCurve</a></li><li><a href="Box.html">Box</a></li><li><a href="Box2.html">Box2</a></li><li><a href="BoxMask.html">BoxMask</a></li><li><a href="Circle.html">Circle</a></li><li><a href="DOM.html">DOM</a></li><li><a href="EventManager.html">EventManager</a></li><li><a href="Graph.html">Graph</a></li><li><a href="Helpers.html">Helpers</a></li><li><a href="Image.html">Image</a></li><li><a href="Key.html">Key</a></li><li><a href="Line.html">Line</a></li><li><a href="Mask.html">Mask</a></li><li><a href="Matrix.html">Matrix</a></li><li><a href="Object2D.html">Object2D</a></li><li><a href="Pattern.html">Pattern</a></li><li><a href="Pointer.html">Pointer</a></li><li><a href="Renderer.html">Renderer</a></li><li><a href="Text.html">Text</a></li><li><a href="UUID.html">UUID</a></li><li><a href="Vector2.html">Vector2</a></li><li><a href="Viewport.html">Viewport</a></li><li><a href="ViewportControls.html">ViewportControls</a></li></ul>
  206. </nav>
  207. <br class="clear">
  208. <footer>
  209. Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Tue Jun 25 2019 14:27:21 GMT+0100 (Western European Summer Time)
  210. </footer>
  211. <script> prettyPrint(); </script>
  212. <script src="scripts/linenumber.js"> </script>
  213. </body>
  214. </html>