nsIDOMSimpleGestureEvent 编辑

dom/interfaces/events/nsIDOMSimpleGestureEvent.idlScriptable This interface describes a mouse or trackpad gesture event. 1.0 66 Introduced Gecko 1.9.1 Inherits from: nsIDOMMouseEvent Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)

The nsIDOMSimpleGestureEvent interface is the datatype for all Mozilla-specific simple gesture events in the Document Object Model.

The following events are generated:

MozSwipeGesture - Generated when the user completes a swipe across across the input device.

MozMagnifyGestureStart - Generated when the user begins the magnify ("pinch") gesture. The "delta" value represents the initial movement.

MozMagnifyGestureUpdate - Generated periodically while the user is continuing the magnify ("pinch") gesture. The "delta" value represents the movement since the last MozMagnifyGestureStart or MozMagnifyGestureUpdate event.

MozMagnifyGesture - Generated when the user has completed the magnify ("pinch") gesture. If you only want to receive a single event when the magnify gesture is complete, you only need to hook this event and can safely ignore the MozMagnifyGestureStart and the MozMagnifyGestureUpdate events. The "delta" value is the cumulative amount represented by the user's gesture.

MozRotateGestureStart - Generated when the user begins the rotation gesture. The "delta" value represents the initial rotation.

MozRotateGestureUpdate - Generated periodically while the user is continuing the rotation gesture. The "delta" value represents the rotation since the last MozRotateGestureStart or MozRotateGestureUpdate event.

MozRotateGesture - Generated when the user has completed the rotation gesture. If you only want to receive a single event when the rotation gesture is complete, you only need to hook this event and can safely ignore the MozRotateGestureStart and the MozRotateGestureUpdate events. The "delta" value is the cumulative amount of rotation represented by the user's gesture.

MozTapGesture - Generated when the user executes a two finger tap gesture on the input device. Client coordinates contain the center point of the tap. (XXX Not implemented on Mac)

MozPressTapGesture - Generated when the user executes a press and tap two finger gesture (first finger down, second finger down, second finger up, first finger up) on the input device. Client coordinates contain the center pivot point of the action. (XXX Not implemented on Mac)

Default behavior:

Some operating systems support default behaviors for gesture events when they are not handled by the application. Consumers should use event.preventDefault() to prevent default behavior when consuming events.

Method overview

void initSimpleGestureEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in nsIDOMAbstractView viewArg, in long detailArg, in long screenXArg, in long screenYArg, in long clientXArg, in long clientYArg, in boolean ctrlKeyArg, in boolean altKeyArg, in boolean shiftKeyArg, in boolean metaKeyArg, in unsigned short buttonArg, in nsIDOMEventTarget relatedTargetArg, in unsigned long directionArg, in double deltaArg);

Attributes

AttributeTypeDescription
deltadouble

The delta value indicating how far the gesture moved. For update events, this indicates the movement since the previous update; for the MozRotateGesture and MozMagnifyGesture events, this indicates the total movement that occurred while the event was being processed.

The value is specified in degrees for rotation events (where positive values indicate clockwise rotation and negative values indicate counter-clockwise rotation). For magnify gestures, the units are implementation-specific; however, positive values indicate zooming in, and negative values indicate zooming out. Read only.

Note: On Mac OS X, the units used for magnification gestures by the underlying operating system API are not documented at this time; typical values appear to be in the range 0.0 to 100.0, but currently you can only rely on the value being either positive or negative. On Windows, the units indicate the difference between the previous and current width between the two touch points, in pixels.
directionunsigned longThe direction in which the gesture moved. See Direction constants and Rotation constants on this page. Read only.

Constants

Direction constants

ConstantValueDescription
DIRECTION_UP1Upward swipe.
DIRECTION_DOWN2Downward swipe.
DIRECTION_LEFT4Leftward swipe.
DIRECTION_RIGHT8Rightward swipe.

Rotation constants

ConstantValueDescription
ROTATION_COUNTERCLOCKWISE1Counter-clockwise rotation.
ROTATION_CLOCKWISE2Clockwise rotation.

Methods

initSimpleGestureEvent()

Initializes the gesture event.

void initSimpleGestureEvent(
  in DOMString typeArg,
  in boolean canBubbleArg,
  in boolean cancelableArg,
  in nsIDOMAbstractView viewArg,
  in long detailArg,
  in long screenXArg,
  in long screenYArg,
  in long clientXArg,
  in long clientYArg,
  in boolean ctrlKeyArg,
  in boolean altKeyArg,
  in boolean shiftKeyArg,
  in boolean metaKeyArg,
  in unsigned short buttonArg,
  in nsIDOMEventTarget relatedTargetArg,
  in unsigned long directionArg,
  in double deltaArg
);
Parameters
typeArg
 
canBubbleArg
 
cancelableArg
 
viewArg
 
detailArg
 
screenXArg
 
screenYArg
 
clientXArg
 
clientYArg
 
ctrlKeyArg
 
altKeyArg
 
shiftKeyArg
 
metaKeyArg
 
buttonArg
 
relatedTargetArg
 
directionArg
The value to assign to the direction attribute.
deltaArg
The value to assign to the delta attribute.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:45 次

字数:9255

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文