function pointer(event, node) {
event = sourceEvent(event);
const id = event.identifier || "pointer";
const type = event.type;
if (node === undefined) node = event.currentTarget;
if (node) {
var svg = node.ownerSVGElement || node;
if (svg.createSVGPoint) {
var point = svg.createSVGPoint();
point.x = event.clientX, point.y = event.clientY;
point = point.matrixTransform(node.getScreenCTM().inverse());
return {
x: point.x,
y: point.y,
id,
type
};
}
if (node.getBoundingClientRect) {
var rect = node.getBoundingClientRect();
return {
x: event.clientX - rect.left - node.clientLeft,
y: event.clientY - rect.top - node.clientTop,
id,
type
};
}
}
return {x: event.pageX, y: event.pageY, id, type};
}