开发 Maps JavaScript API Reference Manual Basic Class Pixel

Pixel 最后更新时间: 2026年07月02日

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:(Number) The x-axis pixel coordinate of the pixel

Demo:

pixel.getX();

getY()

Get the y-coordinate of the pixel

return value:(Number) The y-axis pixel coordinate of the pixel

Demo:

pixel.getY();

toString()

Return the pixel coordinate object as a string

return value:(String) Pixel coordinates in string format

Demo:

pixel.toString();

equals(point)

Are the current pixel coordinates equal to the passed pixel coordinates

Parameter:point(Pixel) The pixel coordinates to be specified

return value:(boolean) Are they equal

Demo:

pixel.equals(new AMap.Pixel(600, 300));
返回顶部 示例中心 常见问题 智能客服 公众号
二维码