aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/svggeometryelement/index.html
blob: 9d9ca5ace11473d41ef952cf25388ccb73a212b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
title: SVGGeometryElement
slug: Web/API/SVGGeometryElement
tags:
  - API
  - DOM
  - NeedsExample
  - NeedsTranslation
  - Reference
  - SVG
  - SVG DOM
  - TopicStub
translation_of: Web/API/SVGGeometryElement
---
<div>{{APIRef("SVG")}}</div>

<p>The <code>SVGGeometryElement</code> interface represents SVG elements whose rendering is defined by geometry with an equivalent path, and which can be filled and stroked. This includes paths and the basic shapes.</p>

<p>{{InheritanceDiagram(600, 140)}}</p>

<div class="note">
<p><strong>Note:</strong> The <code>pathLength</code> property and the <code>getTotalLength()</code> and <code>getPointAtLength()</code> methods were originally part of the {{domxref("SVGPathElement")}} interface. In SVG 2 they were moved to this interface.</p>
</div>

<h2 id="Properties">Properties</h2>

<p><em>This interface also inherits properties from its parent, {{domxref("SVGGraphicsElement")}}.</em></p>

<dl>
 <dt>{{domxref("SVGGeometryElement.pathLength")}} {{readOnlyInline}}</dt>
 <dd>This property reflects the {{SVGAttr("pathLength")}} attribute.</dd>
</dl>

<h2 id="Methods">Methods</h2>

<p><em>This interface also inherits methods from its parent, {{domxref("SVGGraphicsElement")}}.</em></p>

<dl>
 <dt>{{domxref("SVGGeometryElement.isPointInFill()")}}</dt>
 <dd>Determines whether a given point is within the fill shape of an element. Normal hit testing rules apply; the value of the {{cssxref("pointer-events")}} property on the element determines whether a point is considered to be within the fill.</dd>
 <dt>{{domxref("SVGGeometryElement.isPointInStroke()")}}</dt>
 <dd>Determines whether a given point is within the stroke shape of an element. Normal hit testing rules apply; the value of the {{cssxref("pointer-events")}} property on the element determines whether a point is considered to be within the stroke.</dd>
 <dt>{{domxref("SVGGeometryElement.getTotalLength()")}}</dt>
 <dd>Returns the user agent's computed value for the total length of the path in user units.</dd>
 <dt>{{domxref("SVGGeometryElement.getPointAtLength()")}}</dt>
 <dd>Returns the point at a given distance along the path.</dd>
</dl>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName("SVG2", "types.html#InterfaceSVGGeometryElement", "SVGGeometryElement")}}</td>
   <td>{{Spec2("SVG2")}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>



<p>{{Compat("api.SVGGeometryElement")}}</p>