         self.backgroundColor = LayoutDefaults.defaultDayViewColor
         self.addGestureRecognizer(UILongPressGestureRecognizer(target: self, action: #selector(longPressAction)))
         self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(tapAction)))
+        self.prevHeight = self.frame.height
     }
 
     override func layoutSubviews() {

        }
        self.eventLayers.removeAll()

        var factorChange = CGFloat(1)
        let newHeight = self.frame.height
        if prevHeight == nil {
            prevHeight = newHeight
        }
        else {
            factorChange = newHeight / prevHeight!
        }

        // Generate event rectangle shape layers and text layers
        for (id, frame) in self.eventFrames {

    private var seperatorLayers: [CAShapeLayer] = []
    // Event rectangle shape layers
    private var eventLayers: [CALayer] = []
    // Previous height
    private var prevHeight: CGFloat!

    // Delegate variable
    weak var delegate: DayViewCellDelegate?
