I’m nearly done with my plugin, but need to access the x,y coordinates of RECTANGLE nodes that contain images. For some reason, I can access the coordinates of RECTANGLES within groups, but not frames. Unsure why this would be the case. Is this a known bug? Is there a workaround?
for (let i = 0; i < nodes.length; i++)
{
for (const paint of nodes[i].fills) {
if (paint.type === 'IMAGE' && nodes[i].name.includes('Screen')) {
++counter;
if(msg.checked === true) {
const screenshotStar = figma.createStar();
figma.currentPage.appendChild(screenshotStar);
screenshotStar.x = nodes[i].x - 50;
screenshotStar.y = nodes[i].y - 70;
screenshotStar.name = "Screenshot Here";
screenshotStar.fills = [{ type: 'SOLID', color: {r: 1, g: 0, b: 0} }];
screenshotStar.strokes = [{ type: 'SOLID', color: {r: 1, g: 1, b: 1} }];
screenshotStar.strokeWeight = 10;
screenshotStar.resizeWithoutConstraints(150,150);
}
figma.ui.postMessage(counter);
}
}