Skip to content

Commit 17ced81

Browse files
committed
🛠 refactor childUIPointerDown bind. metafizzy#440, metafizzy#422
1 parent 4e93831 commit 17ced81

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

‎js/page-dots.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ PageDots.prototype._create = function() {
4848
this.holder.className = 'flickity-page-dots';
4949
// create dots, array of elements
5050
this.dots = [];
51-
// tap
51+
// events
5252
this.on( 'tap', this.onTap );
53-
53+
this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) );
5454
};
5555

5656
PageDots.prototype.activate = function() {
@@ -151,10 +151,6 @@ proto._createPageDots = function() {
151151
this.on( 'cellChange', this.updatePageDots );
152152
this.on( 'resize', this.updatePageDots );
153153
this.on( 'deactivate', this.deactivatePageDots );
154-
155-
this.pageDots.on( 'pointerDown', function( event ) {
156-
this.childUIPointerDown( event );
157-
}.bind( this ));
158154
};
159155

160156
proto.activatePageDots = function() {

‎js/prev-next-button.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,10 @@ PrevNextButton.prototype._create = function() {
6464
// create arrow
6565
var svg = this.createSVG();
6666
element.appendChild( svg );
67-
// update on select
68-
this.parent.on( 'select', function() {
69-
this.update();
70-
}.bind( this ));
71-
// tap
67+
// events
7268
this.on( 'tap', this.onTap );
73-
// pointerDown
74-
this.on( 'pointerDown', function onPointerDown( event ) {
75-
this.parent.childUIPointerDown( event );
76-
}.bind( this ));
69+
this.parent.on( 'select', this.update.bind( this ) );
70+
this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) );
7771
};
7872

7973
PrevNextButton.prototype.activate = function() {

0 commit comments

Comments
 (0)