1 /*
2 * Copyright (c) 2002-2026 Gargoyle Software Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 * https://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 package org.htmlunit.javascript.host.dom;
16
17 import org.htmlunit.corejs.javascript.Context;
18 import org.htmlunit.corejs.javascript.Function;
19 import org.htmlunit.corejs.javascript.VarScope;
20 import org.htmlunit.javascript.configuration.JsxClass;
21 import org.htmlunit.javascript.configuration.JsxConstructor;
22 import org.htmlunit.javascript.configuration.JsxGetter;
23 import org.htmlunit.javascript.configuration.JsxSetter;
24
25 /**
26 * A JavaScript object for {@code DOMPoint}.
27 *
28 * @author Ahmed Ashour
29 * @author Ronald Brill
30 *
31 * @see <a href="https://developer.mozilla.org/en-US/docs/Web/API/DOMPoint">MDN Documentation</a>
32 */
33 @JsxClass
34 public class DOMPoint extends DOMPointReadOnly {
35
36 /**
37 * JavaScript constructor.
38 * @param cx the current context
39 * @param scope the scope
40 * @param args the arguments to the DOMPoint constructor
41 * @param ctorObj the function object
42 * @param inNewExpr {@code true} if invoked with the {@code new} operator
43 * @return the Java object that JavaScript can access
44 */
45 @JsxConstructor
46 public static DOMPoint jsConstructor(final Context cx, final VarScope scope,
47 final Object[] args, final Function ctorObj, final boolean inNewExpr) {
48
49 final DOMPoint point = new DOMPoint();
50 point.init(args, scope, ctorObj);
51 return point;
52 }
53
54 /**
55 * Creates an instance.
56 */
57 public DOMPoint() {
58 super();
59 }
60
61 /**
62 * Creates an instance with the given coordinates.
63 *
64 * @param x the x coordinate
65 * @param y the y coordinate
66 * @param z the z coordinate
67 * @param w the w perspective value
68 */
69 public DOMPoint(final double x, final double y, final double z, final double w) {
70 super(x, y, z, w);
71 }
72
73 /**
74 * {@inheritDoc}
75 */
76 @Override
77 @JsxGetter
78 public double getX() {
79 return super.getX();
80 }
81
82 /**
83 * {@inheritDoc}
84 */
85 @Override
86 @JsxSetter
87 public void setX(final double x) {
88 super.setX(x);
89 }
90
91 /**
92 * {@inheritDoc}
93 */
94 @Override
95 @JsxGetter
96 public double getY() {
97 return super.getY();
98 }
99
100 /**
101 * {@inheritDoc}
102 */
103 @Override
104 @JsxSetter
105 public void setY(final double y) {
106 super.setY(y);
107 }
108
109 /**
110 * {@inheritDoc}
111 */
112 @Override
113 @JsxGetter
114 public double getZ() {
115 return super.getZ();
116 }
117
118 /**
119 * {@inheritDoc}
120 */
121 @Override
122 @JsxSetter
123 public void setZ(final double z) {
124 super.setZ(z);
125 }
126
127 /**
128 * {@inheritDoc}
129 */
130 @Override
131 @JsxGetter
132 public double getW() {
133 return super.getW();
134 }
135
136 /**
137 * {@inheritDoc}
138 */
139 @Override
140 @JsxSetter
141 public void setW(final double w) {
142 super.setW(w);
143 }
144 }