原理
判断元素移动位置
const width = 125;
const height = 125;
let moveIndex = Math.round(x / width) + Math.round(y / height);
注意:如果移动计算出来的 moveIndex 小于 0 就等于 0,大于当前最大值就等于当前最大值。
const width = 125;
const height = 125;
let moveIndex = Math.round(x / width) + Math.round(y / height);
注意:如果移动计算出来的 moveIndex 小于 0 就等于 0,大于当前最大值就等于当前最大值。