Skip to content

Commit e0e8498

Browse files
committed
new tryout
1 parent 044cc7f commit e0e8498

File tree

4 files changed

+17
-42
lines changed

4 files changed

+17
-42
lines changed

dist/angular-tooltips.css

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-tooltips.css.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-tooltips.js

+7-20
Original file line numberDiff line numberDiff line change
@@ -198,33 +198,21 @@
198198
return toReturn.join(' ');
199199
}
200200
, calculateTop = function calculateTop(theTipElement, theTipContElement) {
201-
var tipStyle
202-
, paddingBottom
203-
, bottom
201+
var top = -Math.floor(theTipElement[0].offsetHeight + marginTooltipArrow)
204202
, left = Math.floor(theTipContElement[0].offsetWidth / 2 - theTipElement[0].offsetWidth / 2);
205203

206-
try {
207-
tipStyle = window.getComputedStyle(theTipElement[0], null);
208-
209-
paddingBottom = parseInt(tipStyle.getPropertyValue('padding-bottom'), 10);
210-
} catch (e) {
211-
212-
paddingBottom = parseInt(theTipElement[0].currentStyle.paddingBottom, 10);
213-
}
214-
bottom = Math.floor(theTipContElement[0].offsetHeight + marginTooltipArrow + paddingBottom);
215-
216204
theTipElement.css({
217-
'bottom': bottom + defaultTipTolleranceMargin + 'px',
205+
'top': top - defaultTipTolleranceMargin + 'px',
218206
'left': left + 'px'
219207
});
220208
}
221209
, calculateLeft = function calculateLeft(theTipElement, theTipContElement) {
222210
var bottom = Math.floor(-theTipElement[0].offsetHeight / 2 + theTipContElement[0].offsetHeight / 2)
223-
, right = Math.floor(theTipContElement[0].offsetWidth + marginTooltipArrow);
211+
, left = -Math.floor(theTipElement[0].offsetWidth + marginTooltipArrow);
224212

225213
theTipElement.css({
226-
'bottom': bottom + 'px',
227-
'right': right + defaultTipTolleranceMargin + 'px'
214+
'top': bottom + 'px',
215+
'left': left - defaultTipTolleranceMargin + 'px'
228216
});
229217
}
230218
, calculateBottom = function calculateBottom(theTipElement, theTipContElement) {
@@ -628,9 +616,8 @@
628616
$timeout(function doLater() {
629617

630618
onTooltipShow();
631-
element.find('tip')
632-
.removeClass('_hidden')
633-
.addClass('_ready');
619+
element.find('tip').removeClass('_hidden');
620+
element.addClass('_ready');
634621
});
635622

636623
scope.$on('$destroy', function unregisterListeners() {

lib/angular-tooltips.js

+5-17
Original file line numberDiff line numberDiff line change
@@ -180,33 +180,21 @@
180180
return toReturn.join(' ');
181181
}
182182
, calculateTop = function calculateTop(theTipElement, theTipContElement) {
183-
var tipStyle
184-
, paddingBottom
185-
, bottom
183+
var top = -Math.floor(theTipElement[0].offsetHeight + marginTooltipArrow)
186184
, left = Math.floor(theTipContElement[0].offsetWidth / 2 - theTipElement[0].offsetWidth / 2);
187185

188-
try {
189-
tipStyle = window.getComputedStyle(theTipElement[0], null);
190-
191-
paddingBottom = parseInt(tipStyle.getPropertyValue('padding-bottom'), 10);
192-
} catch (e) {
193-
194-
paddingBottom = parseInt(theTipElement[0].currentStyle.paddingBottom, 10);
195-
}
196-
bottom = Math.floor(theTipContElement[0].offsetHeight + marginTooltipArrow + paddingBottom);
197-
198186
theTipElement.css({
199-
'bottom': bottom + defaultTipTolleranceMargin + 'px',
187+
'top': top - defaultTipTolleranceMargin + 'px',
200188
'left': left + 'px'
201189
});
202190
}
203191
, calculateLeft = function calculateLeft(theTipElement, theTipContElement) {
204192
var bottom = Math.floor(-theTipElement[0].offsetHeight / 2 + theTipContElement[0].offsetHeight / 2)
205-
, right = Math.floor(theTipContElement[0].offsetWidth + marginTooltipArrow);
193+
, left = -Math.floor(theTipElement[0].offsetWidth + marginTooltipArrow);
206194

207195
theTipElement.css({
208-
'bottom': bottom + 'px',
209-
'right': right + defaultTipTolleranceMargin + 'px'
196+
'top': bottom + 'px',
197+
'left': left - defaultTipTolleranceMargin + 'px'
210198
});
211199
}
212200
, calculateBottom = function calculateBottom(theTipElement, theTipContElement) {

0 commit comments

Comments
 (0)