Visual Console Refactor: added a native event to the element click event

Former-commit-id: ef54c01a286c7d84965b22cd6da59c61c6acf501
This commit is contained in:
Alejandro Gallardo Escobar 2019-04-10 11:54:24 +02:00
parent 00dbb83cfe
commit 48db962c8a
1 changed files with 3 additions and 1 deletions

View File

@ -50,6 +50,7 @@ export interface ItemProps extends Position, Size {
export interface ItemClickEvent<Props extends ItemProps> { export interface ItemClickEvent<Props extends ItemProps> {
// data: Props; // data: Props;
data: UnknownObject; data: UnknownObject;
nativeEvent: Event;
} }
// FIXME: Fix type compatibility. // FIXME: Fix type compatibility.
@ -181,7 +182,8 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
box.style.zIndex = this.props.isOnTop ? "2" : "1"; box.style.zIndex = this.props.isOnTop ? "2" : "1";
box.style.left = `${this.props.x}px`; box.style.left = `${this.props.x}px`;
box.style.top = `${this.props.y}px`; box.style.top = `${this.props.y}px`;
box.onclick = () => this.clickEventManager.emit({ data: this.props }); box.onclick = e =>
this.clickEventManager.emit({ data: this.props, nativeEvent: e });
return box; return box;
} }