| 1 |
<?php |
| 2 |
namespace Depicter\Document\Models\Common\Position; |
| 3 |
|
| 4 |
class States |
| 5 |
{ |
| 6 |
/** |
| 7 |
* @var Base |
| 8 |
*/ |
| 9 |
public $default; |
| 10 |
|
| 11 |
/** |
| 12 |
* @var Base |
| 13 |
*/ |
| 14 |
public $tablet; |
| 15 |
|
| 16 |
/** |
| 17 |
* @var Base |
| 18 |
*/ |
| 19 |
public $mobile; |
| 20 |
|
| 21 |
public function getOffset( $device ) { |
| 22 |
$x = $y = $origin = ''; |
| 23 |
if ( isset( $this->{$device}->x->value ) ) { |
| 24 |
$x = "x:" . $this->{$device}->x->value . $this->{$device}->x->unit . ";"; |
| 25 |
} |
| 26 |
if ( isset( $this->{$device}->y->value ) ) { |
| 27 |
$y = "y:" . $this->{$device}->y->value . $this->{$device}->y->unit . ";"; |
| 28 |
} |
| 29 |
|
| 30 |
if ( isset( $this->{$device}->origin ) ) { |
| 31 |
$origin = "origin:" . $this->{$device}->origin; |
| 32 |
} |
| 33 |
|
| 34 |
return $x . $y . $origin; |
| 35 |
} |
| 36 |
} |
| 37 |
|