Fnykis
4/27/2020 - 10:36 AM

Get center of layer bounds

function getCenter(bounds) {
  var x = bounds[0].value + ((bounds[2].value - bounds[0].value) / 2);
  var y = bounds[1].value + ((bounds[3].value - bounds[1].value) / 2);
  return [new UnitValue (x, "px"), new UnitValue (y, "px")];
}