calculateMouseX(event);
event. Mouse event.
The calculateMouseX method calculates abscissa of the current mouse cursor position.
This method returns a Number type value.
To execute the example, the HTML page must contain links to the PP.js scenario file and the PP.css styles file. Create a text area, process event of clicking on this area and show current coordinates of the mouse cursor in the area:
// Create a text area
var textArea = new PP.Ui.TextArea({
ParentNode: document.body,
Width: 250,
Height: 100,
});
// Process the Click event
textArea.Click.add(function (sender, args) {
// Determine the current mouse coordinates
var coordX = PP.calculateMouseX(args.Event);
var coordY = PP.calculateMouseY(args.Event);
textArea.setContent("Current mouse coordinates: (" + coordX + ", " + coordY + ")");
});
After executing the example a text area is created and placed in the page. On clicking this area the area shows current cursor coordinated:

See also: