Skip to content

Commit

Permalink
add willOpenDrawer / wllCloseDrawer delegate functions
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosgrossi committed Jun 15, 2017
1 parent 5fecfa1 commit 34f2725
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Pod/Classes/LiquidFloatingActionButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import QuartzCore
@objc public protocol LiquidFloatingActionButtonDelegate {
// selected method
@objc optional func liquidFloatingActionButton(_ liquidFloatingActionButton: LiquidFloatingActionButton, didSelectItemAtIndex index: Int)
@objc optional func liquidFloatingActionButtonWillOpenDrawer(_ liquidFloatingActionButton: LiquidFloatingActionButton)
@objc optional func liquidFloatingActionButtonWillCloseDrawer(_ liquidFloatingActionButton: LiquidFloatingActionButton)
}

public enum LiquidFloatingActionButtonAnimateStyle : Int {
Expand Down Expand Up @@ -109,7 +111,8 @@ open class LiquidFloatingActionButton : UIView {

// open all cells
open func open() {

delegate?.liquidFloatingActionButtonWillOpenDrawer?(self)

// rotate plus icon
CATransaction.setAnimationDuration(0.8)
self.plusLayer.transform = CATransform3DMakeRotation((CGFloat(M_PI) * rotationDegrees) / 180, 0, 0, 1)
Expand All @@ -126,7 +129,8 @@ open class LiquidFloatingActionButton : UIView {

// close all cells
open func close() {

delegate?.liquidFloatingActionButtonWillCloseDrawer?(self)

// rotate plus icon
CATransaction.setAnimationDuration(0.8)
self.plusLayer.transform = CATransform3DMakeRotation(0, 0, 0, 1)
Expand Down

0 comments on commit 34f2725

Please sign in to comment.