@tuoyuan/map-adapter-lib
Version:
地图适配器库
38 lines (37 loc) • 662 B
JavaScript
class i {
constructor(t, r) {
this._x = t, this._y = r;
}
/** 获取像素横坐标 */
get x() {
return this._x;
}
/** 获取像素纵坐标 */
get y() {
return this._y;
}
/** 以字符串形式返回像素坐标对象 */
toString() {
return `${this._x},${this._y}`;
}
/** 以数组形式返回像素坐标对象 */
toArray() {
return [this._x, this._y];
}
toObject() {
return {
x: this._x,
y: this._y
};
}
/**
* 判断当前像素坐标与传入像素坐标是否相等
* @param point
*/
equals(t) {
return this.x === t.x && this.y === t.y;
}
}
export {
i as Pixel
};