Summary
Constructor
new Offset(x, y, z)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
x |
Number | 0 | 在X轴方向上的偏移量,在作为像素偏移量时,X轴朝向屏幕右边 |
y |
Number | 0 | 在Y轴方向上的偏移量,在作为像素偏移量时,Y轴朝向屏幕下方 |
z |
Number | 0 | 在Z轴方向上的偏移量 |
Throws:
当传入的参数非数值型变量时,抛出异常。
Example
let offset = new hmap.basetype.Offset(1,2,3);
Methods
-
clone() → {module:basetype~Offset}
-
克隆一个新的偏移量对象
Example
let newOffset = offset.clone();
-
getValue(axis) → {Number|undefined}
-
返回某个坐标轴方向上的偏移值.
Parameters:
Name Type Description axis
String 坐标轴标识。取值可为"X"、"Y"、"Z"、"x"、"y"、"z"中的一个。
Returns:
Number | undefined -在某个坐标轴方向上的偏移值。当传入的参数不在限定值之内,则返回undefined。
Example
let value = offset.getValue("x");
-
setValue(axis, val)
-
设置某个坐标轴方向上的偏移值。
如果传入的坐标轴不在限定值之内,则此方法不生效。Parameters:
Name Type Description axis
String 坐标轴标识。取值可为"X"、"Y"、"Z"、"x"、"y"、"z"中的一个。
val
Number 设置某个坐标轴方向上的偏移值。
Throws:
当传入的参数val非数值型变量时,抛出异常。
Example
offset.setValue("y", 10);
-
toString() → {String}
-
获取字符串格式的偏移量
Returns:
String -偏移量
Example
let str = offset.toString();