convert 1d index to 2d array
parent
93d75b4292
commit
0ccd4a935a
10
helper.js
10
helper.js
|
|
@ -107,6 +107,16 @@ async function unSelect() {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert 1d index to 2d array
|
||||||
|
* @param {number} index sequential index
|
||||||
|
* @param {number} width width of 2d array
|
||||||
|
* @returns {number[]} [x,y]
|
||||||
|
*/
|
||||||
|
function indexToXY(index, width) {
|
||||||
|
return [index % width, Math.floor(index / width)]
|
||||||
|
}
|
||||||
|
|
||||||
// async function layerToSelectionHelper () {
|
// async function layerToSelectionHelper () {
|
||||||
// // console.log("executeAsModal layer.translate")
|
// // console.log("executeAsModal layer.translate")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue