mirror of
https://github.com/google/blockly.git
synced 2026-01-06 08:30:13 +01:00
Add a clone method to Coordinate
This commit is contained in:
@@ -100,6 +100,14 @@ Blockly.utils.Coordinate.sum = function(a, b) {
|
||||
return new Blockly.utils.Coordinate(a.x + b.x, a.y + b.y);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new copy of this coordinate.
|
||||
* @return {!Blockly.utils.Coordinate} A copy of this coordinate.
|
||||
*/
|
||||
Blockly.utils.Coordinate.prototype.clone = function() {
|
||||
return new Blockly.utils.Coordinate(this.x, this.y);
|
||||
};
|
||||
|
||||
/**
|
||||
* Scales this coordinate by the given scale factor.
|
||||
* @param {number} s The scale factor to use for both x and y dimensions.
|
||||
|
||||
Reference in New Issue
Block a user