-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutil.js
More file actions
25 lines (25 loc) · 775 Bytes
/
util.js
File metadata and controls
25 lines (25 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function GetRectSize(minX, minY, maxX, maxY) {
return [Math.abs(minX - maxX) + 1, Math.abs(minY - maxY) + 1];
}
function IterateThroughRect(func, minX, minY, maxX, maxY) {
let [sx, sy] = GetRectSize(minX, minY, maxX, maxY);
let actualMinX = Math.min(minX, maxX);
let actualMinY = Math.min(minY, maxY);
for (let y = 0; y < sy; y++) {
for (let x = 0; x < sx; x++) {
func(x, y, x + actualMinX, y + actualMinY);
}
}
}
function ToggleTabindexRecursive(parent, value) {
if (value) {
parent.removeAttribute("tabindex");
}
else {
parent.setAttribute("tabindex", "-1");
}
for (let child of parent.children) {
ToggleTabindexRecursive(child, value);
}
}
//# sourceMappingURL=util.js.map