Commit 542797fb by Daniel Dahan

development: renamed Pulse to MotionPulse and added MotionSpring

parent 23bd140d
......@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
961730361E0E156400A9A297 /* MotionSpring.swift in Sources */ = {isa = PBXBuildFile; fileRef = 961730351E0E156400A9A297 /* MotionSpring.swift */; };
9617B07D1DFCA8CF00410F8F /* Application.swift in Headers */ = {isa = PBXBuildFile; fileRef = 961E6BDE1DDA2A95004E6C93 /* Application.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9617B07E1DFCA8CF00410F8F /* Card.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB75D1CB40DC500C806FE /* Card.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9617B07F1DFCA8CF00410F8F /* ImageCard.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7621CB40DC500C806FE /* ImageCard.swift */; settings = {ATTRIBUTES = (Public, ); }; };
......@@ -228,6 +229,7 @@
/* Begin PBXFileReference section */
961276621DCD8B1800A7D920 /* CharacterAttribute.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CharacterAttribute.swift; sourceTree = "<group>"; };
961730351E0E156400A9A297 /* MotionSpring.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MotionSpring.swift; sourceTree = "<group>"; };
961DED451DCC40C500F425B6 /* Editor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Editor.swift; sourceTree = "<group>"; };
961DED4A1DCC546100F425B6 /* EditorController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditorController.swift; sourceTree = "<group>"; };
961E6BDE1DDA2A95004E6C93 /* Application.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Application.swift; sourceTree = "<group>"; };
......@@ -793,6 +795,7 @@
96BCB77E1CB40DC500C806FE /* MotionKeyframe.swift */,
96E3C39D1D3A1D0C0086A024 /* MotionBasic.swift */,
96BCB7821CB40DC500C806FE /* MotionPulse.swift */,
961730351E0E156400A9A297 /* MotionSpring.swift */,
);
name = Motion;
sourceTree = "<group>";
......@@ -1161,6 +1164,7 @@
965E81031DD4D5C800D61E4B /* CollectionView.swift in Sources */,
965E81041DD4D5C800D61E4B /* CollectionViewCell.swift in Sources */,
965E81071DD4D5C800D61E4B /* CollectionViewLayout.swift in Sources */,
961730361E0E156400A9A297 /* MotionSpring.swift in Sources */,
965E81081DD4D5C800D61E4B /* CollectionReusableView.swift in Sources */,
965E81091DD4D5C800D61E4B /* DataSourceItem.swift in Sources */,
965E810A1DD4D5C800D61E4B /* Font.swift in Sources */,
......
......@@ -40,7 +40,7 @@ open class Button: UIButton, Pulseable {
open let visualLayer = CAShapeLayer()
/// A Pulse reference.
fileprivate var pulse: Pulse!
fileprivate var pulse: MotionPulse!
/// PulseAnimation value.
open var pulseAnimation: PulseAnimation {
......@@ -261,7 +261,7 @@ extension Button {
/// Prepares the pulse motion.
fileprivate func preparePulse() {
pulse = Pulse(pulseView: self, pulseLayer: visualLayer)
pulse = MotionPulse(pulseView: self, pulseLayer: visualLayer)
}
/**
......
......@@ -41,7 +41,7 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable {
open let visualLayer = CAShapeLayer()
/// A Pulse reference.
fileprivate var pulse: Pulse!
fileprivate var pulse: MotionPulse!
/// PulseAnimation value.
open var pulseAnimation: PulseAnimation {
......@@ -295,7 +295,7 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable {
extension CollectionReusableView {
/// Prepares the pulse motion.
fileprivate func preparePulse() {
pulse = Pulse(pulseView: self, pulseLayer: visualLayer)
pulse = MotionPulse(pulseView: self, pulseLayer: visualLayer)
pulseAnimation = .none
}
......
......@@ -41,7 +41,7 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable {
open let visualLayer = CAShapeLayer()
/// A Pulse reference.
fileprivate var pulse: Pulse!
fileprivate var pulse: MotionPulse!
/// PulseAnimation value.
open var pulseAnimation: PulseAnimation {
......@@ -256,7 +256,7 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable {
extension CollectionViewCell {
/// Prepares the pulse motion.
fileprivate func preparePulse() {
pulse = Pulse(pulseView: self, pulseLayer: visualLayer)
pulse = MotionPulse(pulseView: self, pulseLayer: visualLayer)
}
/// Prepares the visualLayer property.
......
......@@ -30,8 +30,16 @@
import UIKit
@objc(FABMenuDirection)
public enum FABMenuDirection: Int {
case up
case down
case left
case right
}
@objc(FABMenuDelegate)
public protocol FABMenuDelegate: MenuDelegate {
public protocol FABMenuDelegate {
/**
Gets called when the user taps while the menu is opened.
- Parameter menu: A FABMenu.
......@@ -46,6 +54,16 @@ public protocol FABMenuDelegate: MenuDelegate {
@objc(FABMenu)
open class FABMenu: Menu {
/// An optional delegation handler.
open weak var delegate: FABMenuDelegate?
/// The direction in which the animation opens the menu.
open var direction = SpringDirection.up {
didSet {
layoutSubviews()
}
}
/// A reference to the MenuItems
open var buttons: [MenuItem] {
get {
......@@ -55,8 +73,30 @@ open class FABMenu: Menu {
views = value
}
}
open override func prepare() {
super.prepare()
}
extension FABMenu {
/**
Handles the hit test for the Menu and views outside of the Menu bounds.
- Parameter _ point: A CGPoint.
- Parameter with event: An optional UIEvent.
- Returns: An optional UIView.
*/
open override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
guard isOpened, isEnabled else {
return super.hitTest(point, with: event)
}
for v in subviews {
let p = v.convert(point, from: self)
if v.bounds.contains(p) {
delegate?.fabMenu?(fabMenu: self, tappedAt: point, isOutside: false)
return v.hitTest(p, with: event)
}
}
delegate?.fabMenu?(fabMenu: self, tappedAt: point, isOutside: true)
return self.hitTest(point, with: event)
}
}
......@@ -53,7 +53,7 @@ public protocol Pulseable {
var pulseOpacity: CGFloat { get set }
}
public struct Pulse {
public struct MotionPulse {
/// A UIView that is Pulseable.
fileprivate weak var pulseView: UIView?
......@@ -64,7 +64,7 @@ public struct Pulse {
fileprivate var layers = [CAShapeLayer]()
/// A reference to the PulseAnimation.
public var animation = PulseAnimation.pointWithBacking
public var animation = MotionPulseAnimation.pointWithBacking
/// A UIColor.
public var color = Color.grey.base
......@@ -81,7 +81,9 @@ public struct Pulse {
self.pulseView = pulseView
self.pulseLayer = pulseLayer
}
}
extension MotionPulse {
/**
Triggers the expanding animation.
- Parameter point: A point to pulse from.
......@@ -157,7 +159,9 @@ public struct Pulse {
bLayer.setValue(true, forKey: "animated")
}
}
}
extension MotionPulse {
/// Triggers the contracting animation.
public mutating func contractAnimation() {
guard let bLayer = layers.popLast() else {
......
......@@ -32,7 +32,7 @@ import UIKit
open class PulseView: View, Pulseable {
/// A Pulse reference.
fileprivate var pulse: Pulse!
fileprivate var pulse: MotionPulse!
/// PulseAnimation value.
open var pulseAnimation: PulseAnimation {
......@@ -129,6 +129,6 @@ open class PulseView: View, Pulseable {
extension PulseView {
/// Prepares the pulse motion.
fileprivate func preparePulse() {
pulse = Pulse(pulseView: self, pulseLayer: visualLayer)
pulse = MotionPulse(pulseView: self, pulseLayer: visualLayer)
}
}
......@@ -40,7 +40,7 @@ open class TableViewCell: UITableViewCell, Pulseable {
open let visualLayer = CAShapeLayer()
/// A Pulse reference.
fileprivate var pulse: Pulse!
fileprivate var pulse: MotionPulse!
/// PulseAnimation value.
open var pulseAnimation: PulseAnimation {
......@@ -177,7 +177,7 @@ open class TableViewCell: UITableViewCell, Pulseable {
extension TableViewCell {
/// Prepares the pulse motion.
fileprivate func preparePulse() {
pulse = Pulse(pulseView: self, pulseLayer: visualLayer)
pulse = MotionPulse(pulseView: self, pulseLayer: visualLayer)
}
/// Prepares the visualLayer property.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment