Skip to content

Commit e333435

Browse files
committed
feat: add immediate show/hide button example and update tooltip delay logic
1 parent 556f9f3 commit e333435

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

apps/demo/public/code/tooltip-delay.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
<button
2+
ngxoTooltip="My awesome tooltip"
3+
[ngxoTooltipShowDelay]="0"
4+
[ngxoTooltipHideDelay]="0"
5+
>
6+
Show and hide immediately
7+
</button>
8+
19
<button
210
ngxoTooltip="My awesome tooltip"
311
[ngxoTooltipShowDelay]="1000"

apps/demo/src/app/tooltip-page/tooltip-page.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ <h2>Delay</h2>
7373
</p>
7474

7575
<app-demo-code [codeUrls]="['/code/tooltip-delay.html']">
76+
<button
77+
ngxoTooltip="My awesome tooltip"
78+
[ngxoTooltipShowDelay]="0"
79+
[ngxoTooltipHideDelay]="0"
80+
>
81+
Show and hide immediately
82+
</button>
83+
7684
<button
7785
ngxoTooltip="My awesome tooltip"
7886
[ngxoTooltipShowDelay]="1000"

libs/ngx-overlay/src/lib/tooltip/tooltip.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ export class NgxoTooltipComponent implements OnDestroy {
159159
const style: { [key: string]: string } = {
160160
'anchor-name': `--${this.interestId()}`,
161161
};
162-
if (this.showDelay()) {
162+
if (this.showDelay() !== null) {
163163
style['interest-show-delay'] = `${this.showDelay()}ms`;
164164
style['--interest-show-delay'] = `${this.showDelay()}ms`;
165165
}
166-
if (this.hideDelay()) {
166+
if (this.hideDelay() !== null) {
167167
style['interest-hide-delay'] = `${this.hideDelay()}ms`;
168168
style['--interest-hide-delay'] = `${this.hideDelay()}ms`;
169169
}

0 commit comments

Comments
 (0)