Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide tooltip by display attribute instead of opacity #8220

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/client/browser-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function init ($) {
$.fn.tooltip.defaults = {
fade: true
, gravity: 'n'
, opacity: 0.75
, opacity: 0.9
};

$('#drawerToggle').click(function(event) {
Expand Down
2 changes: 1 addition & 1 deletion lib/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ client.load = function load (serverSettings, callback) {

client.tooltip = d3.select('body').append('div')
.attr('class', 'tooltip')
.style('opacity', 0);
.style('display', 'none');

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

Expand Down
16 changes: 8 additions & 8 deletions lib/client/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function init (client, d3) {
}

function hideTooltip () {
client.tooltip.style('opacity', 0);
client.tooltip.style('display', 'none');
}

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

var rawbgInfo = getRawbgInfo();

client.tooltip.style('opacity', .9);
client.tooltip.style('display', 'block');
client.tooltip.html('<strong>' + translate('BG') + ':</strong> ' + client.sbx.scaleEntry(d) +
(d.type === 'mbg' ? '<br/><strong>' + translate('Device') + ': </strong>' + d.device : '') +
(d.type === 'forecast' && d.forecastType ? '<br/><strong>' + translate('Forecast Type') + ': </strong>' + d.forecastType : '') +
Expand Down Expand Up @@ -338,7 +338,7 @@ function init (client, d3) {
prepareTreatCircles(treatCircles.enter().append('circle'))
.attr('class', 'treatment-dot')
.on('mouseover', function(d) {
client.tooltip.style('opacity', .9);
client.tooltip.style('display', 'block');
client.tooltip.html(d.isAnnouncement ? announcementTooltip(d) : treatmentTooltip(d))
.style('left', tooltipLeft())
.style('top', (d3.event.pageY + 15) + 'px');
Expand Down Expand Up @@ -435,7 +435,7 @@ function init (client, d3) {
.attr('class', 'g-duration')
.attr('transform', rectTranslate)
.on('mouseover', function(d) {
client.tooltip.style('opacity', .9);
client.tooltip.style('display', 'block');
client.tooltip.html(d.isAnnouncement ? announcementTooltip(d) : treatmentTooltip(d))
.style('left', tooltipLeft())
.style('top', (d3.event.pageY + 15) + 'px');
Expand Down Expand Up @@ -640,7 +640,7 @@ function init (client, d3) {
glucose = Math.round(glucose * decimals) / decimals;
}

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

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

Expand Down Expand Up @@ -1266,7 +1266,7 @@ function init (client, d3) {
})
.text(generateText)
.on('mouseover', function(d) {
client.tooltip.style('opacity', .9);
client.tooltip.style('display', 'block');
client.tooltip.html(profileTooltip(d))
.style('left', (d3.event.pageX) + 'px')
.style('top', (d3.event.pageY + 15) + 'px');
Expand Down
4 changes: 2 additions & 2 deletions lib/plugins/pluginbase.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function init (majorPills, minorPills, statusPills, bgStatus, tooltip) {
}).join('<br/>\n');

pill.mouseover(function pillMouseover (event) {
tooltip.style('opacity', .9);
tooltip.style('display', 'block');

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

pill.mouseout(function pillMouseout ( ) {
tooltip.style('opacity', 0);
tooltip.style('display', 'none');
});
} else {
pill.off('mouseover');
Expand Down
4 changes: 2 additions & 2 deletions lib/report_plugins/daytoday.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ daytoday.report = function report_daytoday (datastorage, sorteddaystoshow, optio
})
.on('mouseover', function(d) {
if (options.openAps && d.openaps) {
client.tooltip.style('opacity', .9);
client.tooltip.style('display', 'block');
var text = '<b>BG:</b> ' + d.openaps.suggested.bg +
', ' + d.openaps.suggested.reason +
(d.openaps.suggested.mealAssist ? ' <b>Meal Assist:</b> ' + d.openaps.suggested.mealAssist : '');
Expand Down Expand Up @@ -1109,6 +1109,6 @@ daytoday.report = function report_daytoday (datastorage, sorteddaystoshow, optio
}

function hideTooltip () {
client.tooltip.style('opacity', 0);
client.tooltip.style('display', 'none');
}
};
2 changes: 1 addition & 1 deletion lib/report_plugins/weektoweek.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ function init (ctx) {
}

function hideTooltip () {
client.tooltip.style('opacity', 0);
client.tooltip.style('display', 'none');
}
};
return weektoweek;
Expand Down
Loading