Static class to manage the pointer, using the Pointer API if available and falling back to internal emulation otherwise. It will return itself if it is tried to be instantiated.
- Source:
Methods
-
<static> normalizeEvent(e) → {Event}
-
Tries to return the given pointer event with some properties normalized (since different clients can use different values) and perhaps some new properties added (in the case they were missing), when possible. The new attached methods and properties may include polyfills, etc. It also calls the
CB_Events.normalizefunction internally. Some properties added or affected could be "POINTER_TYPE_TOUCH", "POINTER_TYPE_MOUSE", "POINTER_TYPE_PEN", "pointerId", "pointerType", "pressure", "tangentialPressure", "tiltX", "tiltY", "width", "height", "currentTarget", "isPrimary", "twist", etc.Parameters:
Name Type Description eEvent Pointer event object. If not provided, it will use the value of "event", "window.event", "Event" or an empty object ("{}").
- Source:
- To Do:
-
- Think about using Object.defineProperty with "writable: true" as option to prevent some web clients problems that have read only properties.
- Maybe e.width and e.height should be both 1 as default (?).
Returns:
Returns the pointer event object normalized.
- Type
- Event
-
<static> onCancel(callbackFunction [, keepOldFunction] [, useCapture] [, target])
-
Sets a function to execute when the "onPointerCancel" event is fired or removes it. More information: Pointer events.
Parameters:
Name Type Argument Default Description callbackFunctionfunction | null The function (event listener) that we want to execute when the event is fired. The first and unique parameter received for this function will be the event object (already normalized by the
CB_Pointer.normalizeEventfunction). If a null value is used, the event will be removed.keepOldFunctionboolean <optional>
true Defines whether we want to keep any possible previous event listener for the same target and event name or not.
useCaptureboolean <optional>
false Defines whether the event we want to add will use capture or not. This parameter will be effective only if the current client supports the addEventListener method and will be used as its third parameter.
targetObject <optional>
document The target where we want to attach the event listener.
- Source:
-
<static> onDown(callbackFunction [, keepOldFunction] [, useCapture] [, target])
-
Sets a function to execute when the "onPointerDown" event is fired or removes it. More information: Pointer events.
Parameters:
Name Type Argument Default Description callbackFunctionfunction | null The function (event listener) that we want to execute when the event is fired. The first and unique parameter received for this function will be the event object (already normalized by the
CB_Pointer.normalizeEventfunction). If a null value is used, the event will be removed.keepOldFunctionboolean <optional>
true Defines whether we want to keep any possible previous event listener for the same target and event name or not.
useCaptureboolean <optional>
false Defines whether the event we want to add will use capture or not. This parameter will be effective only if the current client supports the addEventListener method and will be used as its third parameter.
targetObject <optional>
document The target where we want to attach the event listener.
- Source:
-
<static> onEnter(callbackFunction [, keepOldFunction] [, useCapture] [, target])
-
Sets a function to execute when the "onPointerEnter" event is fired or removes it. More information: Pointer events.
Parameters:
Name Type Argument Default Description callbackFunctionfunction | null The function (event listener) that we want to execute when the event is fired. The first and unique parameter received for this function will be the event object (already normalized by the
CB_Pointer.normalizeEventfunction). If a null value is used, the event will be removed.keepOldFunctionboolean <optional>
true Defines whether we want to keep any possible previous event listener for the same target and event name or not.
useCaptureboolean <optional>
false Defines whether the event we want to add will use capture or not. This parameter will be effective only if the current client supports the addEventListener method and will be used as its third parameter.
targetObject <optional>
document The target where we want to attach the event listener.
- Source:
-
<static> onGotPointCapture(callbackFunction [, keepOldFunction] [, useCapture] [, target])
-
Sets a function to execute when the "onGotPointerCapture" event is fired or removes it. More information: Pointer events.
Parameters:
Name Type Argument Default Description callbackFunctionfunction | null The function (event listener) that we want to execute when the event is fired. The first and unique parameter received for this function will be the event object (already normalized by the
CB_Pointer.normalizeEventfunction). If a null value is used, the event will be removed.keepOldFunctionboolean <optional>
true Defines whether we want to keep any possible previous event listener for the same target and event name or not.
useCaptureboolean <optional>
false Defines whether the event we want to add will use capture or not. This parameter will be effective only if the current client supports the addEventListener method and will be used as its third parameter.
targetObject <optional>
document The target where we want to attach the event listener.
- Source:
-
<static> onLeave(callbackFunction [, keepOldFunction] [, useCapture] [, target])
-
Sets a function to execute when the "onPointerLeave" event is fired or removes it. More information: Pointer events.
Parameters:
Name Type Argument Default Description callbackFunctionfunction | null The function (event listener) that we want to execute when the event is fired. The first and unique parameter received for this function will be the event object (already normalized by the
CB_Pointer.normalizeEventfunction). If a null value is used, the event will be removed.keepOldFunctionboolean <optional>
true Defines whether we want to keep any possible previous event listener for the same target and event name or not.
useCaptureboolean <optional>
false Defines whether the event we want to add will use capture or not. This parameter will be effective only if the current client supports the addEventListener method and will be used as its third parameter.
targetObject <optional>
document The target where we want to attach the event listener.
- Source:
-
<static> onLostPointCapture(callbackFunction [, keepOldFunction] [, useCapture] [, target])
-
Sets a function to execute when the "onLostPointerCapture" event is fired or removes it. More information: Pointer events.
Parameters:
Name Type Argument Default Description callbackFunctionfunction | null The function (event listener) that we want to execute when the event is fired. The first and unique parameter received for this function will be the event object (already normalized by the
CB_Pointer.normalizeEventfunction). If a null value is used, the event will be removed.keepOldFunctionboolean <optional>
true Defines whether we want to keep any possible previous event listener for the same target and event name or not.
useCaptureboolean <optional>
false Defines whether the event we want to add will use capture or not. This parameter will be effective only if the current client supports the addEventListener method and will be used as its third parameter.
targetObject <optional>
document The target where we want to attach the event listener.
- Source:
-
<static> onMove(callbackFunction [, keepOldFunction] [, useCapture] [, target])
-
Sets a function to execute when the "onPointerMove" event is fired or removes it. More information: Pointer events.
Parameters:
Name Type Argument Default Description callbackFunctionfunction | null The function (event listener) that we want to execute when the event is fired. The first and unique parameter received for this function will be the event object (already normalized by the
CB_Pointer.normalizeEventfunction). If a null value is used, the event will be removed.keepOldFunctionboolean <optional>
true Defines whether we want to keep any possible previous event listener for the same target and event name or not.
useCaptureboolean <optional>
false Defines whether the event we want to add will use capture or not. This parameter will be effective only if the current client supports the addEventListener method and will be used as its third parameter.
targetObject <optional>
document The target where we want to attach the event listener.
- Source:
-
<static> onOut(callbackFunction [, keepOldFunction] [, useCapture] [, target])
-
Sets a function to execute when the "onPointerOut" event is fired or removes it. More information: Pointer events.
Parameters:
Name Type Argument Default Description callbackFunctionfunction | null The function (event listener) that we want to execute when the event is fired. The first and unique parameter received for this function will be the event object (already normalized by the
CB_Pointer.normalizeEventfunction). If a null value is used, the event will be removed.keepOldFunctionboolean <optional>
true Defines whether we want to keep any possible previous event listener for the same target and event name or not.
useCaptureboolean <optional>
false Defines whether the event we want to add will use capture or not. This parameter will be effective only if the current client supports the addEventListener method and will be used as its third parameter.
targetObject <optional>
document The target where we want to attach the event listener.
- Source:
-
<static> onOver(callbackFunction [, keepOldFunction] [, useCapture] [, target])
-
Sets a function to execute when the "onPointerOver" event is fired or removes it. More information: Pointer events.
Parameters:
Name Type Argument Default Description callbackFunctionfunction | null The function (event listener) that we want to execute when the event is fired. The first and unique parameter received for this function will be the event object (already normalized by the
CB_Pointer.normalizeEventfunction). If a null value is used, the event will be removed.keepOldFunctionboolean <optional>
true Defines whether we want to keep any possible previous event listener for the same target and event name or not.
useCaptureboolean <optional>
false Defines whether the event we want to add will use capture or not. This parameter will be effective only if the current client supports the addEventListener method and will be used as its third parameter.
targetObject <optional>
document The target where we want to attach the event listener.
- Source:
-
<static> onUp(callbackFunction [, keepOldFunction] [, useCapture] [, target])
-
Sets a function to execute when the "onPointerUp" event is fired or removes it. More information: Pointer events.
Parameters:
Name Type Argument Default Description callbackFunctionfunction | null The function (event listener) that we want to execute when the event is fired. The first and unique parameter received for this function will be the event object (already normalized by the
CB_Pointer.normalizeEventfunction). If a null value is used, the event will be removed.keepOldFunctionboolean <optional>
true Defines whether we want to keep any possible previous event listener for the same target and event name or not.
useCaptureboolean <optional>
false Defines whether the event we want to add will use capture or not. This parameter will be effective only if the current client supports the addEventListener method and will be used as its third parameter.
targetObject <optional>
document The target where we want to attach the event listener.
- Source:
-
<static> setPointerEventsProperty(element, value [, important])
-
Sets the desired value for the CSS' style pointer-events property of a given element.
Parameters:
Name Type Argument Default Description elementElement Element whose CSS' style "pointer-events" property we want to edit.
valuestring CSS code for the CSS' style "pointer-events" property.
importantboolean <optional>
false If set to true, it will add the " !important" text to the "pointer-events" property.
- Source: