Skip to main content

Editor.Point

Class

Represents a 2D point with x and y coordinates.

Index

Properties

Example

// Editor.Point is a simple 2D integer coordinate (x, y). Plugins use it
// as a lightweight tuple for mouse positions, grid coordinates, and UI
// placement offsets — anywhere a pair of ints is clearer than vec2.
//
// Typical example: translating a Widget drop location into a grid cell.
const dropPosition = new Editor.Point();
dropPosition.x = 137;
dropPosition.y = 92;

const cellSize = 32;
const gridCell = new Editor.Point();
gridCell.x = Math.floor(dropPosition.x / cellSize);
gridCell.y = Math.floor(dropPosition.y / cellSize);

console.log(`Drop at (${dropPosition.x}, ${dropPosition.y}) -> cell (${gridCell.x}, ${gridCell.y})`);

Constructors

Constructor

new Point(): Point

Constructs a new Point instance with default x and y values of zero.

Returns

Point

Properties

x

x: number

Horizontal coordinate of the point.


y

y: number

Vertical coordinate of the point.