Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
7b65791f
Commit
7b65791f
authored
Apr 19, 2016
by
Colin Morelli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pulseCenter property to MaterialButton
parent
6251dcdc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
Sources/iOS/MaterialButton.swift
+7
-4
No files found.
Sources/iOS/MaterialButton.swift
View file @
7b65791f
...
@@ -55,12 +55,15 @@ public class MaterialButton : UIButton {
...
@@ -55,12 +55,15 @@ public class MaterialButton : UIButton {
/// Sets whether the scaling animation should be used.
/// Sets whether the scaling animation should be used.
@IBInspectable
public
lazy
var
pulseScale
:
Bool
=
true
@IBInspectable
public
lazy
var
pulseScale
:
Bool
=
true
/// The op
ca
ity value for the pulse animation.
/// The op
ac
ity value for the pulse animation.
@IBInspectable
public
var
pulseOpacity
:
CGFloat
=
0.25
@IBInspectable
public
var
pulseOpacity
:
CGFloat
=
0.25
/// The color of the pulse effect.
/// The color of the pulse effect.
@IBInspectable
public
var
pulseColor
:
UIColor
?
@IBInspectable
public
var
pulseColor
:
UIColor
?
/// Sets a pulse animation to always radiate from the center
@IBInspectable
public
var
pulseCenter
:
Bool
=
false
/**
/**
This property is the same as clipsToBounds. It crops any of the view's
This property is the same as clipsToBounds. It crops any of the view's
contents from bleeding past the view's frame. If an image is set using
contents from bleeding past the view's frame. If an image is set using
...
@@ -436,13 +439,14 @@ public class MaterialButton : UIButton {
...
@@ -436,13 +439,14 @@ public class MaterialButton : UIButton {
public
override
func
touchesBegan
(
touches
:
Set
<
UITouch
>
,
withEvent
event
:
UIEvent
?)
{
public
override
func
touchesBegan
(
touches
:
Set
<
UITouch
>
,
withEvent
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
withEvent
:
event
)
super
.
touchesBegan
(
touches
,
withEvent
:
event
)
let
duration
:
NSTimeInterval
=
MaterialAnimation
.
pulseDuration
(
width
)
let
duration
:
NSTimeInterval
=
MaterialAnimation
.
pulseDuration
(
width
)
let
point
:
CGPoint
=
pulseCenter
?
CGPointMake
(
CGFloat
(
width
/
2
),
CGFloat
(
height
/
2
))
:
layer
.
convertPoint
(
touches
.
first
!.
locationInView
(
self
),
fromLayer
:
layer
)
if
pulseFocus
{
if
pulseFocus
{
pulseLayer
=
CAShapeLayer
()
pulseLayer
=
CAShapeLayer
()
}
}
if
let
v
:
UIColor
=
pulseColor
{
if
let
v
:
UIColor
=
pulseColor
{
MaterialAnimation
.
pulseAnimation
(
layer
,
visualLayer
:
visualLayer
,
color
:
v
.
colorWithAlphaComponent
(
pulseOpacity
),
point
:
layer
.
convertPoint
(
touches
.
first
!.
locationInView
(
self
),
fromLayer
:
layer
)
,
width
:
width
,
height
:
height
,
duration
:
duration
,
pulseLayer
:
pulseLayer
)
MaterialAnimation
.
pulseAnimation
(
layer
,
visualLayer
:
visualLayer
,
color
:
v
.
colorWithAlphaComponent
(
pulseOpacity
),
point
:
point
,
width
:
width
,
height
:
height
,
duration
:
duration
,
pulseLayer
:
pulseLayer
)
}
}
if
pulseScale
{
if
pulseScale
{
...
@@ -519,4 +523,4 @@ public class MaterialButton : UIButton {
...
@@ -519,4 +523,4 @@ public class MaterialButton : UIButton {
}
}
}
}
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment