-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.js
More file actions
33 lines (31 loc) · 882 Bytes
/
code.js
File metadata and controls
33 lines (31 loc) · 882 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
26
27
28
29
30
31
32
33
const selection = figma.currentPage.selection;
selection.forEach(item => {
if (item.parent.type === "FRAME") {
// console.log('frame')
let frame = figma.createFrame();
let x = item.x;
let y = item.y;
frame.name = item.name;
frame.fills = [];
frame.resize(item.width, item.height)
item.parent.appendChild(frame);
frame.x = x;
frame.y = y;
frame.appendChild(item);
item.x = 0;
item.y = 0;
}
if (item.parent.type === "PAGE") {
// console.log('page')
let frame = figma.createFrame();
frame.name = item.name;
frame.fills = [];
frame.resize(item.width, item.height)
frame.x = item.x;
frame.y = item.y;
frame.appendChild(item);
item.x = 0;
item.y = 0;
}
})
figma.closePlugin("👌Done");