Skip to content

Commit

Permalink
fix shadow advanced video block
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan-shafi committed Feb 11, 2024
1 parent 7b0fefb commit beedd1b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ That's it. You're done!
* IMPROVE: Separated normal and hover colors in icon block.
* IMPROVE: Advanced heading initially without bold.
* IMPROVE: Shorts support in the advanced video block.
* FIX: Shadow in the advanced video block.
* FIX: Autoplay in the advanced video block youtube.
* PRO: FIX: German umlauts (ä,ö,ü) not showing correctly on frontend.

= 3.1.2 =
Expand Down
27 changes: 15 additions & 12 deletions src/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,18 +344,21 @@ function ub_include_block_attribute_css() {
}

if ( array_key_exists( 'shadow', $attributes ) && $attributes['shadow'][0]['radius'] > 0 ) {
$blockStylesheets .= $prefix = '#ub-advanced-video-' . $attributes['blockID'] . ' .ub-advanced-video-embed{' . PHP_EOL .
'box-shadow: ' . ( $attributes['shadow'][0]['radius'] * cos( deg2rad( 450 - $attributes['shadow'][0]['angle'] ) % 360 ) ) . 'px ' .
( - $attributes['shadow'][0]['radius'] * sin( deg2rad( 450 - $attributes['shadow'][0]['angle'] ) % 360 ) ) . 'px ' .
$attributes['shadow'][0]['blur'] . 'px ' . $attributes['shadow'][0]['spread'] . 'px ' .
'rgba(' . ( hexdec( substr( $attributes['shadow'][0]['color'], 1,
2 ) ) ) .
', ' . hexdec( substr( $attributes['shadow'][0]['color'], 3,
2 ) ) .
', ' . hexdec( substr( $attributes['shadow'][0]['color'], 5,
2 ) ) .
', ' . ( ( 100 - $attributes['shadow'][0]['transparency'] ) / 100 ) . ')' . ';' . PHP_EOL .
'}';
$blockStylesheets .= $prefix = '#ub-advanced-video-' . $attributes['blockID'] . ' .ub-advanced-video-embed{' . PHP_EOL .
'box-shadow: ' . (
$attributes['shadow'][0]['radius'] * cos(deg2rad((450 - $attributes['shadow'][0]['angle']) % 360))
) . 'px ' .
(
-($attributes['shadow'][0]['radius'] * sin(deg2rad((450 - $attributes['shadow'][0]['angle']) % 360)))
) . 'px ' .
$attributes['shadow'][0]['blur'] . 'px ' . $attributes['shadow'][0]['spread'] . 'px ' .
'rgba(' .
hexdec(substr($attributes['shadow'][0]['color'], 1, 2)) . ', ' .
hexdec(substr($attributes['shadow'][0]['color'], 3, 2)) . ', ' .
hexdec(substr($attributes['shadow'][0]['color'], 5, 2)) . ', ' .
((100 - $attributes['shadow'][0]['transparency']) / 100) .
')' . ';' . PHP_EOL .
'}';
}
$blockStylesheets .= $prefix . '{' . $styles . '}';

Expand Down

0 comments on commit beedd1b

Please sign in to comment.