Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayley Tom committed May 10, 2018
2 parents d003bdb + fb72824 commit c434c03
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 6 deletions.
1 change: 0 additions & 1 deletion dist/ngPokie.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

.ng-pokie-digit-column {
position: absolute;
transition: all 3s ease-out;
margin: 0;
padding: 0;
list-style-type: none; }
Expand Down
2 changes: 1 addition & 1 deletion dist/ngPokie.js

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-pokie",
"version": "1.0.2",
"version": "1.0.3",
"description": "Slot machine style number spinner component for AngularJS. Pass it a number and watch it go.",
"main": "dist/ngPokie.js",
"scripts": {
Expand Down
25 changes: 24 additions & 1 deletion src/ng-pokie.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export const NgPokieComponent = {
template,
bindings: {
value: '<',
minColumns: '<'
minColumns: '<',
spinTime: '<'
},
controller: class NgPokieComponent {
constructor($scope, $interval) {
Expand Down Expand Up @@ -75,6 +76,24 @@ export const NgPokieComponent = {
}, this.spinDelay);
}

initSpinTime() {
if (this.spinTime && !this.minColumns) {
this.spinDelay = 0;
this.spinAnimationTime = this.spinTime;
} else if (this.spinTime) {
this.spinDelay = this.spinTime / 2 / this.minColumns;
this.spinAnimationTime = this.spinTime / 2;
} else {
this.spinAnimationTime = this.spinTime;
}
}

setColumnStyles() {
this.columnStyles = {
'transition': `all ${this.spinAnimationTime}ms ease-out`
};
}

$onInit() {
this.$scope.$watch(() => this.value, (newVal, oldVal) => {
if (newVal !== oldVal) {
Expand All @@ -83,6 +102,10 @@ export const NgPokieComponent = {
});

this.initDigits();
this.initSpinTime();
this.setColumnStyles();

console.log('zzz', this.columnStyles, this.spinTime, this.spinAnimationTime);
}
}
};
2 changes: 1 addition & 1 deletion src/ng-pokie.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="ng-pokie-container">
<div class="ng-pokie-digit-column-container" ng-repeat="column in $ctrl.digitColumns track by $index">
<ul class="ng-pokie-digit-column" ng-class="{'is-spun': column.isSpun}">
<ul class="ng-pokie-digit-column" ng-class="{'is-spun': column.isSpun}" ng-style="$ctrl.columnStyles">
<li ng-repeat="digit in column.digits track by $index" ng-bind="digit" class="ng-pokie-digit"></li>
</ul>
</div>
Expand Down
1 change: 0 additions & 1 deletion src/ng-pokie.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

.ng-pokie-digit-column {
position: absolute;
transition: all 3s ease-out;
margin: 0;
padding: 0;
list-style-type: none;
Expand Down

0 comments on commit c434c03

Please sign in to comment.