Last active
August 12, 2020 06:21
-
-
Save ZeevKatz/b966221c233ca2e5fbfd17f1e081b18b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Directive({ | |
selector: "[mouse]", | |
exportAs: "mouse" | |
}) | |
export class MouseComponent { | |
private _state = { x: 0, y: 0 }; | |
get state() { | |
return this._state; | |
} | |
@HostListener("mousemove", ['$event']) | |
handleMouseMove(event: MouseEvent) { | |
this._state = { | |
x: event.clientX, | |
y: event.clientY | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment