mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-19 04:55:57 +08:00
Small fixes
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import Configuration from "./Configuration"
|
||||
import TypeInitialization from "./entity/TypeInitialization"
|
||||
|
||||
export default class Utility {
|
||||
@@ -77,4 +78,19 @@ export default class Utility {
|
||||
return constructor
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Number[]} location
|
||||
* @param {Number} gridSize
|
||||
*/
|
||||
static snapToGrid(location, gridSize = Configuration.gridSize) {
|
||||
if (gridSize === 1) {
|
||||
return location
|
||||
}
|
||||
return [
|
||||
gridSize * Math.round(location[0] / gridSize),
|
||||
gridSize * Math.round(location[1] / gridSize)
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user