jsketcher/web/test/utils/mouse-event.js
2016-12-27 01:41:35 -08:00

23 lines
578 B
JavaScript

export function TestMouseEvent(x, y, type, attrs) {
this.type = type ? type : 'click';
this.canBubble = true;
this.cancelable = true;
this.detail = 1;
this.screenX = x;
this.screenY = y;
this.clientX = this.screenX;
this.clientY = this.screenY;
this.pageX = this.screenX;
this.pageY = this.screenY;
this.offsetX = this.screenX;
this.offsetY = this.screenY;
this.ctrlKey = false;
this.altKey = false;
this.shiftKey = false;
this.metaKey = false;
this.button = 0;
this.relatedTarget = null;
if (attrs) {
Object.assign(this, attrs);
}
}