Skip to content

Commit 52ed538

Browse files
committed
feat(tooltip) no longer depend upon 'tooltips.less' as it might not be present in some theme
1 parent d4c8b31 commit 52ed538

File tree

8 files changed

+28
-76
lines changed

8 files changed

+28
-76
lines changed

dist/main/atom/tooltipManager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function attach(editorView, editor) {
3636
var pixelPt = pixelPositionFromMouseEvent(editorView, e);
3737
var screenPt = editor.screenPositionForPixelPosition(pixelPt);
3838
var bufferPt = editor.bufferPositionForScreenPosition(screenPt);
39-
if (lastExprTypeBufferPt && lastExprTypeBufferPt.isEqual(bufferPt))
39+
if (lastExprTypeBufferPt && lastExprTypeBufferPt.isEqual(bufferPt) && exprTypeTooltip)
4040
return;
4141
lastExprTypeBufferPt = bufferPt;
4242
clearExprTypeTimeout();

dist/main/atom/views/tooltipView.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@ var TooltipView = (function (_super) {
1515
this.updatePosition();
1616
}
1717
TooltipView.content = function () {
18-
return this.div({ class: 'atom-typescript-tooltip' });
18+
var _this = this;
19+
return this.div({ class: 'atom-typescript-tooltip tooltip' }, function () {
20+
_this.div({ class: 'tooltip-inner', outlet: 'inner' });
21+
});
1922
};
2023
TooltipView.prototype.updateText = function (text) {
21-
this.$.html(text);
24+
this.inner.html(text);
2225
this.updatePosition();
26+
this.$.fadeTo(300, 1);
2327
};
2428
TooltipView.prototype.updatePosition = function () {
2529
var offset = 10;

lib/main/atom/tooltipManager.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ export function attach(editorView: JQuery, editor: AtomCore.IEditor) {
4343
var subscriber = new Subscriber();
4444
var exprTypeTimeout = null;
4545
var exprTypeTooltip: TooltipView = null;
46-
46+
4747
// to debounce mousemove event's firing for some reason on some machines
4848
var lastExprTypeBufferPt: any;
4949

5050
subscriber.subscribe(scroll, 'mousemove', (e) => {
5151
var pixelPt = pixelPositionFromMouseEvent(editorView, e)
5252
var screenPt = editor.screenPositionForPixelPosition(pixelPt)
5353
var bufferPt = editor.bufferPositionForScreenPosition(screenPt)
54-
if (lastExprTypeBufferPt && lastExprTypeBufferPt.isEqual(bufferPt))
54+
if (lastExprTypeBufferPt && lastExprTypeBufferPt.isEqual(bufferPt) && exprTypeTooltip)
5555
return;
5656

5757
lastExprTypeBufferPt = bufferPt;

lib/main/atom/views/tooltipView.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,23 @@ interface Rect {
1010

1111
export class TooltipView extends view.View<any> {
1212

13-
constructor(public rect:Rect) {
13+
constructor(public rect: Rect) {
1414
super();
1515
$(document.body).append(this.$);
1616
this.updatePosition()
1717
}
1818

19+
private inner: JQuery;
1920
static content() {
20-
return this.div({ class: 'atom-typescript-tooltip' });
21+
return this.div({ class: 'atom-typescript-tooltip tooltip' }, () => {
22+
this.div({ class: 'tooltip-inner', outlet: 'inner' })
23+
});
2124
}
2225

2326
updateText(text: string) {
24-
this.$.html(text);
27+
this.inner.html(text);
2528
this.updatePosition();
29+
this.$.fadeTo(300, 1);
2630
}
2731

2832
updatePosition() {

styles/atom-typescript-tooltip.less

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Most of the styles for this get inherited from the .tooltip class that we apply to the same element in the DOM
2+
.atom-typescript-tooltip {
3+
font-family: Consolas, monospace;
4+
white-space: pre !important;
5+
6+
border-radius: 5px;
7+
8+
// This class exists by default and this is what we are using
9+
.tooltip-inner{
10+
text-align: left;
11+
}
12+
}

styles/atom-typescript.less

-24
This file was deleted.

views/tooltip.coffee

-36
This file was deleted.

views/views.d.ts

-8
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,3 @@ declare class AtomView {
88
// Methods from base View
99
remove();
1010
}
11-
12-
declare module 'views/tooltip' {
13-
class TooltipView extends AtomView {
14-
constructor(rect: any);
15-
updateText(text: string);
16-
}
17-
export = TooltipView;
18-
}

0 commit comments

Comments
 (0)