| 1 |
<?php |
| 2 |
namespace Depicter\Document\Models\Common\Styles; |
| 3 |
|
| 4 |
use Depicter\Document\CSS\Breakpoints; |
| 5 |
|
| 6 |
class Transform extends States |
| 7 |
{ |
| 8 |
/** |
| 9 |
* style name |
| 10 |
*/ |
| 11 |
const NAME = 'transform'; |
| 12 |
|
| 13 |
public function set( $css ) { |
| 14 |
$devices = Breakpoints::names(); |
| 15 |
foreach ( $devices as $device ) { |
| 16 |
$transform_styles = ''; |
| 17 |
|
| 18 |
if ( !empty( $this->{$device} ) ) { |
| 19 |
if ( !empty( $this->{$device}->rotate ) ) { |
| 20 |
$transform_styles .= "rotate(" . $this->{$device}->rotate . "deg) "; |
| 21 |
} |
| 22 |
if ( !empty( $this->{$device}->scaleX ) ) { |
| 23 |
$transform_styles .= "scaleX(" . $this->{$device}->scaleX . ") "; |
| 24 |
} |
| 25 |
if ( !empty( $this->{$device}->scaleY ) ) { |
| 26 |
$transform_styles .= "scaleY(" . $this->{$device}->scaleY . ") "; |
| 27 |
} |
| 28 |
if ( !empty( $this->{$device}->scale ) ) { |
| 29 |
$transform_styles .= "scale(" . $this->{$device}->scale . ") "; |
| 30 |
} |
| 31 |
|
| 32 |
if( $transform_styles = trim( $transform_styles ) ){ |
| 33 |
$css[ $device ][ self::NAME ] = $transform_styles; |
| 34 |
} |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
return $css; |
| 39 |
} |
| 40 |
} |
| 41 |
|