• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (c) 2022 Huawei Device Co., Ltd.
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7* http://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*/
15import { InputEvent } from "./@ohos.multimodalInput.inputEvent"
16import { KeyCode } from "./@ohos.multimodalInput.keyCode"
17
18/**
19 * Action
20 *
21 * @since 9
22 * @syscap SystemCapability.MultimodalInput.Input.Core
23 */
24export declare enum Action {
25  /**
26   * Cancel
27   */
28  CANCEL = 0,
29
30  /**
31   * Moving of the mouse pointer
32   */
33  MOVE = 1,
34
35  /**
36   * Pressing down of the mouse
37   */
38  BUTTON_DOWN = 2,
39
40  /**
41   * Lifting of the mouse button
42   */
43  BUTTON_UP = 3,
44
45  /**
46   * Beginning of the axis event associated with the mouse
47   */
48  AXIS_BEGIN = 4,
49
50  /**
51   * Updating of the axis event associated with the mouse
52   */
53  AXIS_UPDATE = 5,
54
55  /**
56   * Ending of the axis event associated with the mouse
57   */
58  AXIS_END = 6,
59}
60
61/**
62 * Mouse button
63 *
64 * @since 9
65 * @syscap SystemCapability.MultimodalInput.Input.Core
66 */
67export declare enum Button {
68  /**
69   * Left button on the mouse
70   */
71  LEFT = 0,
72
73  /**
74   * Middle button on the mouse
75   */
76  MIDDLE = 1,
77
78  /**
79   * Right button on the mouse
80   */
81  RIGHT = 2,
82
83  /**
84   * Side button on the mouse
85   */
86  SIDE = 3,
87
88  /**
89   * Extended button on the mouse
90   */
91  EXTRA = 4,
92
93  /**
94   * Forward button on the mouse
95   */
96  FORWARD = 5,
97
98  /**
99   * Back button on the mouse
100   */
101  BACK = 6,
102
103  /**
104   * Task key on the mouse
105   */
106  TASK = 7
107}
108
109/**
110 * Axis
111 *
112 * @since 9
113 * @syscap SystemCapability.MultimodalInput.Input.Core
114 */
115export declare enum Axis {
116  /**
117   * Vertical scroll axis
118   */
119  SCROLL_VERTICAL = 0,
120
121  /**
122   * Horizontal scroll axis
123   */
124  SCROLL_HORIZONTAL = 1,
125
126  /**
127   * Pinch axis
128   */
129  PINCH = 2,
130}
131
132/**
133 * AxisValue
134 *
135 * @since 9
136 * @syscap SystemCapability.MultimodalInput.Input.Core
137 */
138export declare interface AxisValue {
139  /**
140   * Axis type
141   */
142  axis: Axis;
143
144  /**
145   * Axis value
146   */
147  value: number
148}
149
150/**
151 * MouseEvent
152 *
153 * @since 9
154 * @syscap SystemCapability.MultimodalInput.Input.Core
155 */
156export declare interface MouseEvent extends InputEvent {
157  /**
158   * Mouse event action
159   */
160  action: Action;
161
162  /**
163   * X coordinate of the mouse pointer on the screen
164   */
165  screenX: number;
166
167  /**
168   * Y coordinate of the mouse pointer on the screen
169   */
170  screenY: number;
171
172  /**
173   * X coordinate of the mouse pointer in the window
174   */
175  windowX: number;
176
177  /**
178   * Y coordinate of the mouse pointer in the window
179   */
180  windowY: number;
181
182  /**
183   * X axis offset relative to the previous reported mouse pointer position. When the mouse pointer is at the edge of the screen, the value may be less than the difference of the X coordinate reported twice.
184   */
185  rawDeltaX: number;
186
187  /**
188   * Y axis offset relative to the previous reported mouse pointer position
189   */
190  rawDeltaY: number;
191
192  /**
193   * Button that is currently pressed or released
194   */
195  button: Button;
196
197  /**
198   * Button that is being pressed
199   */
200  pressedButtons: Button[];
201
202  /**
203   * All axis data contained in the event
204   */
205  axes: AxisValue[];
206
207  /**
208   * List of pressed keys
209   */
210  pressedKeys: KeyCode[];
211
212  /**
213   * Whether ctrlKey is being pressed
214   */
215  ctrlKey: boolean;
216
217  /**
218   * Whether altKey is being pressed
219   */
220  altKey: boolean;
221
222  /**
223   * Whether shiftKey is being pressed
224   */
225  shiftKey: boolean;
226
227  /**
228   * Whether logoKey is being pressed
229   */
230  logoKey: boolean;
231
232  /**
233   * Whether fnKey is being pressed
234   */
235  fnKey:boolean
236
237  /**
238   * Whether capsLock is active
239   */
240  capsLock:boolean
241
242  /**
243   * Whether numLock is active
244   */
245  numLock:boolean
246
247  /**
248   * Whether scrollLock is active
249   */
250  scrollLock:boolean
251}