Guest User

Untitled

a guest
Dec 11th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. relational = (size) => {
  2. return this.props.videoWidth / K4W * size;
  3. }
  4.  
  5. isCustomLefty = () => {
  6. const {
  7. banner,
  8. } = this.props;
  9. if (banner.type === 'custom') {
  10. return undefined;
  11. }
  12. return ((banner.left + (banner.width / 2)) < (K4W / 2));
  13. }
  14.  
  15. calculateSizes = () => {
  16. return {
  17. width: this.relational(this.props.banner.expandedWidth || this.props.banner.width) + 'px',
  18. height: this.relational(this.props.banner.expandedHeight || this.props.banner.height) + 'px',
  19. };
  20. }
  21.  
  22. calculatePosition = () => {
  23. const {
  24. banner,
  25. } = this.props;
  26. let position = {};
  27.  
  28. if (banner.type === 'custom') {
  29. if (this.isCustomLefty()) {
  30. position.left = this.relational(banner.width) + 'px';
  31. } else {
  32. position.right = this.relational(K4W - banner.left - banner.width) + 'px';
  33. }
  34. position.top = this.relational(K4H - banner.top - banner.height);
  35. } else {
  36. position = {
  37. [banner.side]: 0,
  38. [banner.direction || 'bottom']: 0,
  39. };
  40. }
  41.  
  42. return position;
  43. }
Add Comment
Please, Sign In to add comment