I have not succeeded, I think it is difficult to find that event in real time, I think this can slow down sketch, I thought of doing the following:
You can locate the mouse position here:
And then look for the location and size of the layer here:
layer.frame = (layer.frame.x, layer.frame.y, layer.frame.width, layer.frame.height);
But this is only with the selected layers 🙁
It would be necessary to do the mathematical calculation with the size of the layer and its position, everything with respect to the one of the mouse, I in the end left it because it did not seem a good way for my plugin.
I was also trying this path that seemed interesting:
Hope this can help you