files/en-us/web/api/element/pointercancel_event/index.md
{{APIRef("Pointer Events")}}
The pointercancel event is fired when the browser determines that there are unlikely to be any more pointer events, or if after the {{domxref("Element/pointerdown_event", "pointerdown")}} event is fired, the pointer is then used to manipulate the viewport by panning, zooming, or scrolling.
Some examples of situations that will trigger a pointercancel event:
[!NOTE] After the
pointercancelevent is fired, the browser will also send {{domxref("Element/pointerout_event", "pointerout")}} followed by {{domxref("Element/pointerleave_event", "pointerleave")}}.
Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.
addEventListener("pointercancel", (event) => { })
onpointercancel = (event) => { }
A {{domxref("PointerEvent")}}. Inherits from {{domxref("Event")}}.
{{InheritanceDiagram("PointerEvent")}}
This interface inherits properties from {{domxref("MouseEvent")}} and {{domxref("Event")}}.
PointerEvent.0 to 1, where 0 and 1 represent the minimum and maximum pressure the hardware is capable of detecting, respectively.-1 to 1, where 0 is the neutral position of the control.-90 to 90) between the Y–Z plane and the plane containing both the pointer (e.g., pen stylus) axis and the Y axis.-90 to 90) between the X–Z plane and the plane containing both the pointer (e.g., pen stylus) axis and the X axis.0 to 359.Using addEventListener():
const para = document.querySelector("p");
para.addEventListener("pointercancel", (event) => {
console.log("Pointer event cancelled");
});
Using the onpointercancel event handler property:
const para = document.querySelector("p");
para.onpointercancel = (event) => {
console.log("Pointer event cancelled");
};
{{Specifications}}
{{Compat}}