Skip to content

Commit 4808f1d

Browse files
committed
adjust demo styling
1 parent 5888495 commit 4808f1d

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<div class="demo-tooltip">
22
<h1>Tooltip Demo</h1>
33

4-
<div class="centered" style="height: 200px; width: 400px; overflow: auto; padding: 200px" cdk-scrollable>
5-
<button #tooltip="mdTooltip" style="margin-bottom: 300px;"
4+
<div class="centered" cdk-scrollable>
5+
<button #tooltip="mdTooltip"
66
md-raised-button
77
color="primary"
88
[mdTooltip]="message"
@@ -11,7 +11,8 @@ <h1>Tooltip Demo</h1>
1111
[mdTooltipHideDelay]="hideDelay">
1212
Mouse over to see the tooltip
1313
</button>
14-
Scroll down while tooltip is open to see it hide automatically
14+
<div>Scroll down while tooltip is open to see it hide automatically</div>
15+
<div style="height: 400px;"></div>
1516
</div>
1617

1718
<p>

src/demo-app/tooltip/tooltip-demo.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
.demo-tooltip {
22
.centered {
33
text-align: center;
4+
height: 200px;
5+
overflow: auto;
6+
7+
button {
8+
margin: 16px;
9+
}
410
}
511
md-radio-button {
612
display: block;

src/lib/tooltip/tooltip.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export type TooltipPosition = 'left' | 'right' | 'above' | 'below' | 'before' |
3939
export const TOUCHEND_HIDE_DELAY = 1500;
4040

4141
/** Time in ms to throttle repositioning after scroll events. */
42-
export const SCROLL_THROTTLE_MS = 20;
42+
export const SCROLL_THROTTLE_MS = 10;
4343

4444
/**
4545
* Directive that attaches a material design tooltip to the host element. Animates the showing and
@@ -186,7 +186,8 @@ export class MdTooltip implements OnInit, OnDestroy {
186186
let strategy = this._overlay.position().connectedTo(this._elementRef, origin, position);
187187
strategy.withScrollableContainers(this._scrollDispatcher.getScrollContainers(this._elementRef));
188188
strategy.onPositionChange.subscribe(change => {
189-
if (change.scrollableViewProperties.isOverlayClipped && this._tooltipInstance.isVisible()) {
189+
if (change.scrollableViewProperties.isOverlayClipped &&
190+
this._tooltipInstance && this._tooltipInstance.isVisible()) {
190191
this.hide(0);
191192
}
192193
});

0 commit comments

Comments
 (0)