Skip to content

Commit 96f27de

Browse files
mojoaxelThomaash
authored andcommitted
feat: add tooltip delay option (#11)
* Add graph3d tooltip delay option * Add tooltipDelay to graph3d docs * chore(docs): add unit of tooltipDelay
1 parent 7bf1b3f commit 96f27de

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

docs/graph3d/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,15 @@ <h2 id="Configuration_Options">Configuration Options</h2>
539539
</td>
540540
</tr>
541541

542+
<tr>
543+
<td>tooltipDelay</td>
544+
<td>number</td>
545+
<td>300</td>
546+
<td>The delay time (in ms) for the tooltip to appear when the mouse cursor
547+
hovers over an x-y grid tile.
548+
</td>
549+
</tr>
550+
542551
<tr class='toggle collapsible' onclick="toggleTable('optionTable','tooltipStyle', this);">
543552
<td><span parent="tooltipStyle" class="right-caret"></span> tooltipStyle</td>
544553
<td>Object</td>

lib/graph3d/Graph3d.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Graph3d.DEFAULTS = {
6969

7070
style : Graph3d.STYLE.DOT,
7171
tooltip : false,
72+
tooltipDelay : 300, // milliseconds
7273

7374
tooltipStyle : {
7475
content : {
@@ -2005,7 +2006,7 @@ Graph3d.prototype._onClick = function (event) {
20052006
* @param {Event} event A mouse move event
20062007
*/
20072008
Graph3d.prototype._onTooltip = function (event) {
2008-
var delay = 300; // ms
2009+
var delay = this.tooltipDelay; // ms
20092010
var boundingRect = this.frame.getBoundingClientRect();
20102011
var mouseX = getMouseX(event) - boundingRect.left;
20112012
var mouseY = getMouseY(event) - boundingRect.top;

lib/graph3d/Settings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ var OPTIONKEYS = [
7474
'xCenter',
7575
'yCenter',
7676
'zoomable',
77+
'tooltipDelay',
7778
'ctrlToZoom'
7879
];
7980

lib/graph3d/options.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ let allOptions = {
9292
]
9393
},
9494
tooltip : { boolean: bool, 'function': 'function' },
95+
tooltipDelay : { number: number },
9596
tooltipStyle : {
9697
content: {
9798
color : { string },

0 commit comments

Comments
 (0)