Document Maps JavaScript API Reference Manual Basic Class Pixel

Pixel

AMap.Pixel

Pixel coordinates, determine a pixel point on the map. Construct a pixel coordinate object

new AMap.Pixel(x: number, y: number);

Parameter

Attribute

Type

Description

x

number

X-axis pixel coordinate

y

number

Y-axis pixel coordinate

Demo

var pixel = new AMap.Pixel(600, 300); //Container coordinates, origin at the top-left corner

Method

getX()

Get pixel X-coordinate

return value:(NumberThe x-axis pixel coordinate of the pixel

Demo:

pixel.getX();

getY()

Get the y-coordinate of the pixel

return value:(NumberThe y-axis pixel coordinate of the pixel

Demo:

pixel.getY();

toString()

Return the pixel coordinate object as a string

return value:(StringPixel coordinates in string format

Demo:

pixel.toString();

equals(point)

Are the current pixel coordinates equal to the passed pixel coordinates

Parameter:point(PixelThe pixel coordinates to be specified

return value:(booleanAre they equal

Demo:

pixel.equals(new AMap.Pixel(600, 300));