-
-
Notifications
You must be signed in to change notification settings - Fork 162
/
Copy pathmain.js
38 lines (34 loc) · 855 Bytes
/
main.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
function removeDecimalNumbers({
items
}) {
if (items.length > 0) {
items.forEach(item => {
// Get item's coords and bounds
const {
width,
height
} = item.localBounds;
const {
x,
y
} = item.translation;
// Round the Item's width and height
item.resize(
Math.floor(width),
Math.floor(height)
);
// Round the Item's X/Y positions
const newX = x - Math.floor(x);
const newY = y - Math.floor(y);
item.moveInParentCoordinates(
-newX,
-newY
);
});
}
}
module.exports = {
commands: {
removeDecimalNumbers: removeDecimalNumbers
}
};