/**
 * Created by baoyinghai on 6/2/17.
 */
import { BIT } from '../constant';

export const calculateStyle = ({width, height, x, y}) => {
  return {
    height: BIT * height - 4 ,
    width: BIT * width - 4 ,
    left: BIT * x ,
    top: BIT * y ,
  };
};

export const createShadow = style => {
  const shadow = document.createElement('div');
  shadow.style.left = style.left + 'px';
  shadow.style.top = style.top + 'px';
  shadow.style.height = style.height + 'px';
  shadow.style.width = style.width + 'px';
  shadow.style.position = 'absolute';
  shadow.style.backgroundColor = '#C6C6C6';
  shadow.style.transition = 'all .2s ease';
  shadow.style.opacity = 0.5;
  shadow.style.zIndex = 1;
  return shadow;
};