Skip to content

Commit 05b8f08

Browse files
authored
Merge pull request #8220 from Joerg-Schoemer/feature/hide-by-display
hide tooltip by display attribute instead of opacity
2 parents 03c01d0 + b24c313 commit 05b8f08

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

lib/client/browser-utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function init ($) {
1515
$.fn.tooltip.defaults = {
1616
fade: true
1717
, gravity: 'n'
18-
, opacity: 0.75
18+
, opacity: 0.9
1919
};
2020

2121
$('#drawerToggle').click(function(event) {

lib/client/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ client.load = function load (serverSettings, callback) {
192192

193193
client.tooltip = d3.select('body').append('div')
194194
.attr('class', 'tooltip')
195-
.style('opacity', 0);
195+
.style('display', 'none');
196196

197197
client.settings = browserSettings(client, serverSettings, $);
198198

lib/client/renderer.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function init (client, d3) {
5454
}
5555

5656
function hideTooltip () {
57-
client.tooltip.style('opacity', 0);
57+
client.tooltip.style('display', 'none');
5858
}
5959

6060
// get the desired opacity for context chart based on the brush extent
@@ -147,7 +147,7 @@ function init (client, d3) {
147147

148148
var rawbgInfo = getRawbgInfo();
149149

150-
client.tooltip.style('opacity', .9);
150+
client.tooltip.style('display', 'block');
151151
client.tooltip.html('<strong>' + translate('BG') + ':</strong> ' + client.sbx.scaleEntry(d) +
152152
(d.type === 'mbg' ? '<br/><strong>' + translate('Device') + ': </strong>' + d.device : '') +
153153
(d.type === 'forecast' && d.forecastType ? '<br/><strong>' + translate('Forecast Type') + ': </strong>' + d.forecastType : '') +
@@ -338,7 +338,7 @@ function init (client, d3) {
338338
prepareTreatCircles(treatCircles.enter().append('circle'))
339339
.attr('class', 'treatment-dot')
340340
.on('mouseover', function(d) {
341-
client.tooltip.style('opacity', .9);
341+
client.tooltip.style('display', 'block');
342342
client.tooltip.html(d.isAnnouncement ? announcementTooltip(d) : treatmentTooltip(d))
343343
.style('left', tooltipLeft())
344344
.style('top', (d3.event.pageY + 15) + 'px');
@@ -435,7 +435,7 @@ function init (client, d3) {
435435
.attr('class', 'g-duration')
436436
.attr('transform', rectTranslate)
437437
.on('mouseover', function(d) {
438-
client.tooltip.style('opacity', .9);
438+
client.tooltip.style('display', 'block');
439439
client.tooltip.html(d.isAnnouncement ? announcementTooltip(d) : treatmentTooltip(d))
440440
.style('left', tooltipLeft())
441441
.style('top', (d3.event.pageY + 15) + 'px');
@@ -640,7 +640,7 @@ function init (client, d3) {
640640
glucose = Math.round(glucose * decimals) / decimals;
641641
}
642642

643-
client.tooltip.style('opacity', .9);
643+
client.tooltip.style('display', 'block');
644644
client.tooltip.html('<strong>' + translate('Time') + ':</strong> ' + client.formatTime(getOrAddDate(treatment)) + '<br/>' + '<strong>' + translate('Treatment type') + ':</strong> ' + translate(client.careportal.resolveEventName(treatment.eventType)) + '<br/>' +
645645
(treatment.carbs ? '<strong>' + translate('Carbs') + ':</strong> ' + treatment.carbs + '<br/>' : '') +
646646
(treatment.protein ? '<strong>' + translate('Protein') + ':</strong> ' + treatment.protein + '<br/>' : '') +
@@ -667,7 +667,7 @@ function init (client, d3) {
667667
//console.log(treatment);
668668
var windowWidth = $(client.tooltip.node()).parent().parent().width();
669669
var left = d3.event.x + TOOLTIP_WIDTH < windowWidth ? d3.event.x : windowWidth - TOOLTIP_WIDTH - 10;
670-
client.tooltip.style('opacity', .9)
670+
client.tooltip.style('display', 'block')
671671
.style('left', left + 'px')
672672
.style('top', (d3.event.pageY ? d3.event.pageY + 15 : 40) + 'px');
673673

@@ -760,7 +760,7 @@ function init (client, d3) {
760760
})
761761
.on('drag', function() {
762762
//console.log(d3.event);
763-
client.tooltip.style('opacity', .9);
763+
client.tooltip.style('display', 'block');
764764
var x = Math.min(Math.max(0, d3.event.x), chart().charts.attr('width'));
765765
var y = Math.min(Math.max(0, d3.event.y), chart().focusHeight);
766766

@@ -1266,7 +1266,7 @@ function init (client, d3) {
12661266
})
12671267
.text(generateText)
12681268
.on('mouseover', function(d) {
1269-
client.tooltip.style('opacity', .9);
1269+
client.tooltip.style('display', 'block');
12701270
client.tooltip.html(profileTooltip(d))
12711271
.style('left', (d3.event.pageX) + 'px')
12721272
.style('top', (d3.event.pageY + 15) + 'px');

lib/plugins/pluginbase.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function init (majorPills, minorPills, statusPills, bgStatus, tooltip) {
8484
}).join('<br/>\n');
8585

8686
pill.mouseover(function pillMouseover (event) {
87-
tooltip.style('opacity', .9);
87+
tooltip.style('display', 'block');
8888

8989
var windowWidth = $(tooltip.node()).parent().parent().width();
9090
var left = event.pageX + TOOLTIP_WIDTH < windowWidth ? event.pageX : windowWidth - TOOLTIP_WIDTH - 10;
@@ -94,7 +94,7 @@ function init (majorPills, minorPills, statusPills, bgStatus, tooltip) {
9494
});
9595

9696
pill.mouseout(function pillMouseout ( ) {
97-
tooltip.style('opacity', 0);
97+
tooltip.style('display', 'none');
9898
});
9999
} else {
100100
pill.off('mouseover');

lib/report_plugins/daytoday.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ daytoday.report = function report_daytoday (datastorage, sorteddaystoshow, optio
302302
})
303303
.on('mouseover', function(d) {
304304
if (options.openAps && d.openaps) {
305-
client.tooltip.style('opacity', .9);
305+
client.tooltip.style('display', 'block');
306306
var text = '<b>BG:</b> ' + d.openaps.suggested.bg +
307307
', ' + d.openaps.suggested.reason +
308308
(d.openaps.suggested.mealAssist ? ' <b>Meal Assist:</b> ' + d.openaps.suggested.mealAssist : '');
@@ -1109,6 +1109,6 @@ daytoday.report = function report_daytoday (datastorage, sorteddaystoshow, optio
11091109
}
11101110

11111111
function hideTooltip () {
1112-
client.tooltip.style('opacity', 0);
1112+
client.tooltip.style('display', 'none');
11131113
}
11141114
};

lib/report_plugins/weektoweek.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ function init (ctx) {
317317
}
318318

319319
function hideTooltip () {
320-
client.tooltip.style('opacity', 0);
320+
client.tooltip.style('display', 'none');
321321
}
322322
};
323323
return weektoweek;

0 commit comments

Comments
 (0)