mathieudutour Thanks for the response!! Thanks for digging into the messy Paddy code too!! You go above and beyond ?
? I didn't even know of that method.
layer.frame().setRectByIgnoringProportions(NSMakeRect(x, y, width, height))
works really well in that specific part of the code. Thanks!
However, in other parts where I use layerDidEndResize()
, this approach doesn't seem to update the group frame correctly.
However, I did manage to find a fix to get around the Craft's bug... looking into their code I found the alert prompt...
a = e.selection,
m = a.count();
if (m > 1) v = f.action.groupSelection(t);
else {
if (1 !== m) return void(0, y.showAlert)("Please select at least one layer to duplicate.");
v = a.firstObject()
}
In my code; it is always run when selection count is 0. So to work around there condition I did this...
function resizeLayer(layer) {
// A hack for resizing – just in case Craft's Duplicator is installed
// Select a 'Fake' layer, so that when we 'resize', the selection is not empty
var nullLayer = MSLayer.alloc().init()
document.currentPage().addLayer(nullLayer)
nullLayer.select_byExtendingSelection(true, true)
layer.layerDidEndResize()
document.currentPage().removeLayer(nullLayer)
}
It's not great. But it seems to work ?