I am in the process of transitioning my user interface from Flash/Flex, where it stores values in decimal format. I need to access and reuse these values.
Here is a demo showcasing my problem. Here is a snippet:
import { Component, Input } from '@angular/core';
@Component({
selector: 'hello',
template: `<div (mousemove)="showXY($event)"></div>`,
styles: [`div { border: 1px solid black; height: 500px; width: 500px }`]
})
export class HelloComponent {
@Input() name: string;
x: number;
y: number;
showXY(e: MouseEvent) {
this.x = e.offsetX;
this.y = e.offsetY;
console.log('x: ', this.x, 'y: ', this.y);
}
}
How can I display the decimal precision of the x and y values when moving the mouse over the div?