blob: bc18819d7a51295e26bf6643cb45f0c760a49725 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
---
title: Geometry.jsm
slug: Mozilla/JavaScript_code_modules/Geometry.jsm
translation_of: Mozilla/JavaScript_code_modules/Geometry.jsm
---
<p>{{ gecko_minversion_header("2.0") }}</p>
<p>The <code>Geometry.jsm</code> JavaScript code module provides routines for performing common geometry operations on points and rectangles. It exports two classes: <code>Point</code> and <code>Rect</code>.</p>
<p>To use these routines, you first need to import the code module into your JavaScript scope:</p>
<pre class="eval"><span class="nowiki">Components.utils.import("resource://gre/modules/Geometry.jsm");</span>
</pre>
<p>Once you've imported the module, you can then use the <a href="/zh-CN/JavaScript_code_modules/Geometry.jsm/Point" title="zh-CN/JavaScript code modules/Geometry.jsm/Point"><code>Point</code></a> and <a href="/zh-CN/JavaScript_code_modules/Geometry.jsm/Rect" title="https://developer.mozilla.org/zh-CN/JavaScript_code_modules/Geometry.jsm/Rect"><code>Rect</code></a> classes.</p>
<div class="note">
<strong>Note:</strong> Although this module is usable from mobile, and is present in Firefox 4, it's currently not used in Firefox 4 and attempting to use it may produce unreliable results there.</div>
<h2 id="See_also">See also</h2>
<ul>
<li><a class="internal" href="/zh-CN/JavaScript_code_modules/Using" title="zh-CN/JavaScript code modules/Using JavaScript code modules">Using JavaScript code modules</a></li>
<li><a class="internal" href="/zh-CN/JavaScript_code_modules" title="zh-CN/JavaScript code modules">JavaScript code modules</a></li>
<li><a class="internal" href="/zh-CN/Components.utils.import" title="zh-CN/Components.utils.import"><code>Components.utils.import</code></a></li>
</ul>
|