View Javadoc
1   /*
2    * Copyright (c) 2002-2025 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.Scriptable;
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  @JsxClass
32  public class DOMPoint extends DOMPointReadOnly {
33  
34      /**
35       * JavaScript constructor.
36       * @param cx the current context
37       * @param scope the scope
38       * @param args the arguments to the WebSocket constructor
39       * @param ctorObj the function object
40       * @param inNewExpr Is new or not
41       * @return the java object to allow JavaScript to access
42       */
43      @JsxConstructor
44      public static DOMPoint jsConstructor(final Context cx, final Scriptable scope,
45              final Object[] args, final Function ctorObj, final boolean inNewExpr) {
46  
47          final DOMPoint point = new DOMPoint();
48          point.init(args, ctorObj);
49          return point;
50      }
51  
52      /**
53       * Creates an instance.
54       */
55      public DOMPoint() {
56          super();
57      }
58  
59      /**
60       * Creates an instance with the given coordinates.
61       *
62       * @param x the x coordinate
63       * @param y the y coordinate
64       * @param z the z coordinate
65       * @param w the w perspective value
66       */
67      public DOMPoint(final double x, final double y, final double z, final double w) {
68          super(x, y, z, w);
69      }
70  
71      /**
72       * {@inheritDoc}
73       */
74      @Override
75      @JsxGetter
76      public double getX() {
77          return super.getX();
78      }
79  
80      /**
81       * {@inheritDoc}
82       */
83      @Override
84      @JsxSetter
85      public void setX(final double x) {
86          super.setX(x);
87      }
88  
89      /**
90       * {@inheritDoc}
91       */
92      @Override
93      @JsxGetter
94      public double getY() {
95          return super.getY();
96      }
97  
98      /**
99       * {@inheritDoc}
100      */
101     @Override
102     @JsxSetter
103     public void setY(final double y) {
104         super.setY(y);
105     }
106 
107     /**
108      * {@inheritDoc}
109      */
110     @Override
111     @JsxGetter
112     public double getZ() {
113         return super.getZ();
114     }
115 
116     /**
117      * {@inheritDoc}
118      */
119     @Override
120     @JsxSetter
121     public void setZ(final double z) {
122         super.setZ(z);
123     }
124 
125     /**
126      * {@inheritDoc}
127      */
128     @Override
129     @JsxGetter
130     public double getW() {
131         return super.getW();
132     }
133 
134     /**
135      * {@inheritDoc}
136      */
137     @Override
138     @JsxSetter
139     public void setW(final double w) {
140         super.setW(w);
141     }
142 }