Skip to content

Commit

Permalink
fix popper delays
Browse files Browse the repository at this point in the history
  • Loading branch information
MrFrankel committed Jun 3, 2018
1 parent f7f5a23 commit bda1c7f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 231 deletions.
4 changes: 2 additions & 2 deletions example/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<div class="example">
<div #popper1
[popper]="popper1Content"
[popperTarget]="popper1"
[popperHideOnScroll]="true"
[popperTrigger]="'click'"
[popperShowOnStart]="true"
[popperPlacement]="example1select" class="rel" id="example10reference1">
<p class="bold">Hey!</p>
<p class="thin">Choose where to put your popper!</p>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-popper",
"version": "2.8.2",
"version": "3.0.1",
"description": "ngx-popper is an angular wrapper for popper.js",
"directories": {
"test": "test"
Expand Down
16 changes: 8 additions & 8 deletions src/popper-directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,16 @@ export class PopperController implements OnInit, OnChanges {
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'touchstart', this.toggle.bind(this)));
break;
case Triggers.HOVER:
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'mouseenter', this.scheduledShow.bind(this)));
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'touchend', this.scheduledHide.bind(this, this.hideTimeout)));
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'touchcancel', this.scheduledHide.bind(this, this.hideTimeout)));
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'mouseleave', this.scheduledHide.bind(this, this.hideTimeout)));
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'mouseenter', this.scheduledShow.bind(this, this.showDelay)));
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'touchend', this.scheduledHide.bind(this, null, this.hideTimeout)));
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'touchcancel', this.scheduledHide.bind(this, null, this.hideTimeout)));
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'mouseleave', this.scheduledHide.bind(this, null, this.hideTimeout)));
break;
}
if(this.showTrigger !== Triggers.HOVER && this.hideOnMouseLeave){
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'touchend', this.scheduledHide.bind(this, this.hideTimeout)));
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'touchcancel', this.scheduledHide.bind(this, this.hideTimeout)));
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'mouseleave', this.scheduledHide.bind(this, this.hideTimeout)));
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'touchend', this.scheduledHide.bind(this, null, this.hideTimeout)));
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'touchcancel', this.scheduledHide.bind(this, null, this.hideTimeout)));
this.eventListeners.push(this.renderer.listen(this.elementRef.nativeElement, 'mouseleave', this.scheduledHide.bind(this, null, this.hideTimeout)));
}
}

Expand Down Expand Up @@ -289,7 +289,7 @@ export class PopperController implements OnInit, OnChanges {
}, delay)
}

scheduledHide($event: any = null, delay: number = 0) {
scheduledHide($event: any = null, delay: number = this.hideTimeout) {
if(this.disabled){
return;
}
Expand Down
Loading

0 comments on commit bda1c7f

Please sign in to comment.