selenium-webdriver
Version:
The official WebDriver JavaScript bindings from the Selenium project
23 lines (22 loc) • 21.6 kB
HTML
<meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>goog.math.Box</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Class goog.math.Box</h1><a class="source" href="source/lib/goog/math/box.js.src.html#l39">code »</a></header><section><p>Class for representing a box. A box is specified as a top, right, bottom,
and left. A box is useful for representing margins and padding.
This class assumes 'screen coordinates': larger Y coordinates are further
from the top of the screen.<h2>Constructor</h2><div class="ctor wrap-details public"><div><div class="ctor"><span class="member">goog.math.Box <span class="args">( top, right, bottom, left )</span></span></div><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>top: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Top.<dt>right: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Right.<dt>bottom: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Bottom.<dt>left: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Left.</dl></table></div></div></div></section><div id="visibility-controls"><b>Show:</b><label for="show-public"><span><input type="checkbox" id="show-public" checked/></span>Public</label><label for="show-protected"><span><input type="checkbox" id="show-protected"/></span>Protected</label><label for="show-private"><span><input type="checkbox" id="show-private"/></span>Private</label></div><section id="instance-methods"><h2>Instance Methods</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l305">code »</a><span class="member"><a name="ceil">ceil</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="class_goog_math_Box.html">goog.math.Box</a></code></span></div><p>Rounds the fields to the next larger integer values.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>This box with ceil'd fields.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l106">code »</a><span class="member"><a name="clone">clone</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="class_goog_math_Box.html">goog.math.Box</a></code></span></div><p>Creates a copy of the box with the same dimensions.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>A clone of this Box.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l130">code »</a><span class="member"><a name="contains">contains</a> <span class="args">( other )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns whether the box contains a coordinate or another box.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>other: <code class="type">(<a href="class_goog_math_Coordinate.html">goog.math.Coordinate</a>|<a href="class_goog_math_Box.html">goog.math.Box</a>)</code><dd>A Coordinate or a Box.</dl><tr><th>Returns<tr><td><dl>Whether the box contains the coordinate or other box.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l144">code »</a><span class="member"><a name="expand">expand</a> <span class="args">( top, opt_right, opt_bottom, opt_left )</span> ⇒ <code class="type">!<a href="class_goog_math_Box.html">goog.math.Box</a></code></span></div><p>Expands box with the given margins.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>top: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>|<a href="class_goog_math_Box.html">goog.math.Box</a>)</code><dd>Top margin or box with all margins.<dt>opt_right: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>Right margin.<dt>opt_bottom: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>Bottom margin.<dt>opt_left: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>Left margin.</dl><tr><th>Returns<tr><td><dl>A reference to this Box.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l169">code »</a><span class="member"><a name="expandToInclude">expandToInclude</a> <span class="args">( box )</span></span></div><p>Expand this box to include another box.
NOTE(user): This is used in code that needs to be very fast, please don't
add functionality to this function at the expense of speed (variable
arguments, accepting multiple argument types, etc).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>box: <code class="type"><a href="class_goog_math_Box.html">goog.math.Box</a></code><dd>The box to include in this one.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l319">code »</a><span class="member"><a name="floor">floor</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="class_goog_math_Box.html">goog.math.Box</a></code></span></div><p>Rounds the fields to the next smaller integer values.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>This box with floored fields.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l97">code »</a><span class="member"><a name="getHeight">getHeight</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>height The height of this Box.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l89">code »</a><span class="member"><a name="getWidth">getWidth</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>width The width of this Box.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l333">code »</a><span class="member"><a name="round">round</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="class_goog_math_Box.html">goog.math.Box</a></code></span></div><p>Rounds the fields to nearest integer values.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>This box with rounded fields.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l381">code »</a><span class="member"><a name="scale">scale</a> <span class="args">( sx, opt_sy )</span> ⇒ <code class="type">!<a href="class_goog_math_Box.html">goog.math.Box</a></code></span></div><p>Scales this coordinate by the given scale factors. The x and y dimension
values are scaled by <code >sx</code> and <code >opt_sy</code> respectively.
If <code >opt_sy</code> is not given, then <code >sx</code> is used for both x and y.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>sx: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The scale factor to use for the x dimension.<dt>opt_sy: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>The scale factor to use for the y dimension.</dl><tr><th>Returns<tr><td><dl>This box after scaling.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l117">code »</a><span class="member"><a name="toString">toString</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Returns a nice string representing the box.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>In the form (50t, 73r, 24b, 13l).</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l354">code »</a><span class="member"><a name="translate">translate</a> <span class="args">( tx, opt_ty )</span> ⇒ <code class="type">!<a href="class_goog_math_Box.html">goog.math.Box</a></code></span></div><p>Translates this box by the given offsets. If a <code >goog.math.Coordinate</code>
is given, then the left and right values are translated by the coordinate's
x value and the top and bottom values are translated by the coordinate's y
value. Otherwise, <code >tx</code> and <code >opt_ty</code> are used to translate the x
and y dimension values.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>tx: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>|<a href="class_goog_math_Coordinate.html">goog.math.Coordinate</a>)</code><dd>The value to translate the x
dimension values by or the the coordinate to translate this box by.<dt>opt_ty: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>The value to translate y dimension values by.</dl><tr><th>Returns<tr><td><dl>This box after translating.</dl></table></div></details></div></div></section><section id="instance-properties"><h2>Instance Properties</h2><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l56">code »</a><span class="member"><a name="bottom">bottom</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Bottom</summary></details></div></div><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l62">code »</a><span class="member"><a name="left">left</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Left</summary></details></div></div><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l50">code »</a><span class="member"><a name="right">right</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Right</summary></details></div></div><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l44">code »</a><span class="member"><a name="top">top</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Top</summary></details></div></div></section><section id="static-functions"><h2>Static Functions</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l72">code »</a><span class="member"><a name="goog.math.Box.boundingBox">goog.math.Box.boundingBox</a> <span class="args">( var_args )</span> ⇒ <code class="type">!<a href="class_goog_math_Box.html">goog.math.Box</a></code></span></div><p>Creates a Box by bounding a collection of goog.math.Coordinate objects</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>var_args: <code class="type">...<a href="class_goog_math_Coordinate.html">goog.math.Coordinate</a></code><dd>Coordinates to be included inside
the box.</dl><tr><th>Returns<tr><td><dl>A Box containing all the specified Coordinates.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l202">code »</a><span class="member"><a name="goog.math.Box.contains">goog.math.Box.contains</a> <span class="args">( box, other )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns whether a box contains a coordinate or another box.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>box: <code class="type"><a href="class_goog_math_Box.html">goog.math.Box</a></code><dd>A Box.<dt>other: <code class="type">(<a href="class_goog_math_Coordinate.html">goog.math.Coordinate</a>|<a href="class_goog_math_Box.html">goog.math.Box</a>)</code><dd>A Coordinate or a Box.</dl><tr><th>Returns<tr><td><dl>Whether the box contains the coordinate or other box.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l266">code »</a><span class="member"><a name="goog.math.Box.distance">goog.math.Box.distance</a> <span class="args">( box, coord )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the distance between a coordinate and the nearest corner/side of a
box. Returns zero if the coordinate is inside the box.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>box: <code class="type"><a href="class_goog_math_Box.html">goog.math.Box</a></code><dd>A Box.<dt>coord: <code class="type"><a href="class_goog_math_Coordinate.html">goog.math.Coordinate</a></code><dd>A Coordinate.</dl><tr><th>Returns<tr><td><dl>The distance between <code >coord</code> and the nearest
corner/side of <code >box</code>, or zero if <code >coord</code> is inside
<code >box</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l183">code »</a><span class="member"><a name="goog.math.Box.equals">goog.math.Box.equals</a> <span class="args">( a, b )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Compares boxes for equality.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>a: <code class="type"><a href="class_goog_math_Box.html">goog.math.Box</a></code><dd>A Box.<dt>b: <code class="type"><a href="class_goog_math_Box.html">goog.math.Box</a></code><dd>A Box.</dl><tr><th>Returns<tr><td><dl>True iff the boxes are equal, or if both are null.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l280">code »</a><span class="member"><a name="goog.math.Box.intersects">goog.math.Box.intersects</a> <span class="args">( a, b )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns whether two boxes intersect.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>a: <code class="type"><a href="class_goog_math_Box.html">goog.math.Box</a></code><dd>A Box.<dt>b: <code class="type"><a href="class_goog_math_Box.html">goog.math.Box</a></code><dd>A second Box.</dl><tr><th>Returns<tr><td><dl>Whether the boxes intersect.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l294">code »</a><span class="member"><a name="goog.math.Box.intersectsWithPadding">goog.math.Box.intersectsWithPadding</a> <span class="args">( a, b, padding )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns whether two boxes would intersect with additional padding.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>a: <code class="type"><a href="class_goog_math_Box.html">goog.math.Box</a></code><dd>A Box.<dt>b: <code class="type"><a href="class_goog_math_Box.html">goog.math.Box</a></code><dd>A second Box.<dt>padding: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The additional padding.</dl><tr><th>Returns<tr><td><dl>Whether the boxes intersect.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l227">code »</a><span class="member"><a name="goog.math.Box.relativePositionX">goog.math.Box.relativePositionX</a> <span class="args">( box, coord )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the relative x position of a coordinate compared to a box. Returns
zero if the coordinate is inside the box.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>box: <code class="type"><a href="class_goog_math_Box.html">goog.math.Box</a></code><dd>A Box.<dt>coord: <code class="type"><a href="class_goog_math_Coordinate.html">goog.math.Coordinate</a></code><dd>A Coordinate.</dl><tr><th>Returns<tr><td><dl>The x position of <code >coord</code> relative to the nearest
side of <code >box</code>, or zero if <code >coord</code> is inside <code >box</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/box.js.src.html#l246">code »</a><span class="member"><a name="goog.math.Box.relativePositionY">goog.math.Box.relativePositionY</a> <span class="args">( box, coord )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the relative y position of a coordinate compared to a box. Returns
zero if the coordinate is inside the box.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>box: <code class="type"><a href="class_goog_math_Box.html">goog.math.Box</a></code><dd>A Box.<dt>coord: <code class="type"><a href="class_goog_math_Coordinate.html">goog.math.Coordinate</a></code><dd>A Coordinate.</dl><tr><th>Returns<tr><td><dl>The y position of <code >coord</code> relative to the nearest
side of <code >box</code>, or zero if <code >coord</code> is inside <code >box</code>.</dl></table></div></details></div></div></section></main><nav id="topnav"><div><div id="menubutton"><label for="sidenav-toggle">Menu</label></div><form id="searchbox"><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></nav><nav id="sidenav"><input type="checkbox" id="sidenav-types-ctrl" /><input type="checkbox" id="sidenav-files-ctrl" /><input type="checkbox" id="sidenav-modules-ctrl" /><a id="sidenav-overview"><div><h4>Overview</h4></div></a><div id="sidenav-types"><label for="sidenav-types-ctrl"><h4>Types</h4></label><i>Loading</i></div><div id="sidenav-modules"><label for="sidenav-modules-ctrl"><h4>Modules</h4></label><i>Loading</i></div><div id="sidenav-files"><label for="sidenav-files-ctrl"><h4>Files</h4></label><i>Loading</i></div><a href="license.html"><div><h4>License</h4></div></a></nav><div id="push-footer"></div></div><footer><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></footer><script src="types.js"></script><script src="dossier.js"></script>