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:
<?php
namespace Scene7\Commands;
trait ViewRectangle
{
public function setViewRectangle($coordX, $coordY, $sizeX, $sizeY, $scale = null)
{
$coordX = (float) $coordX;
$coordY = (float) $coordY;
$sizeX = (float) $sizeX;
$sizeY = (float) $sizeY;
$rectangle = $coordX . ',' . $coordY . ',' . $sizeX . ',' . $sizeY;
if ($scale !== null) {
$rectangle .= ',' . ((float) $scale);
}
$this->addCommand(['rect' => $rectangle]);
return $this;
}
}