Fossil SCM

Improvements to tooltip handling.

drh 2019-06-12 09:41 trunk merge
Commit 3a8abf492ab21ab4e838377b0228635a677855418076e5e30be9a199d4f28394
3 files changed +23 -34 +23 -34 +1 -1
+23 -34
--- src/graph.js
+++ src/graph.js
@@ -116,10 +116,11 @@
116116
** over a graph node. Or -1 when the mouse is not
117117
** over anything. */
118118
ixActive: -1, /* The item shown in the tooltip is tx.rowinfo[ixActive].
119119
** ixActive is -1 if the tooltip is not visible */
120120
nodeHover: null, /* Graph node under mouse when ixHover==-2 */
121
+ idNodeActive: 0, /* Element ID of the graph node with the tooltip. */
121122
posX: 0, posY: 0 /* The last mouse position. */
122123
};
123124
124125
/* Functions used to control the tooltip popup and its timer */
125126
function onKeyDown(event){ /* Hide the tooltip when ESC key pressed */
@@ -132,10 +133,11 @@
132133
function hideGraphTooltip(){ /* Hide the tooltip */
133134
document.removeEventListener('keydown',onKeyDown,/* useCapture == */true);
134135
stopCloseTimer();
135136
tooltipObj.style.display = "none";
136137
tooltipInfo.ixActive = -1;
138
+ tooltipInfo.idNodeActive = 0;
137139
}
138140
document.body.onunload = hideGraphTooltip
139141
function stopDwellTimer(){
140142
if(tooltipInfo.idTimer!=0){
141143
clearTimeout(tooltipInfo.idTimer);
@@ -169,36 +171,11 @@
169171
topObj.onclick = clickOnGraph
170172
topObj.ondblclick = dblclickOnGraph
171173
topObj.onmousemove = function(e) {
172174
var ix = findTxIndex(e);
173175
topObj.style.cursor = (ix<0) ? "" : "pointer"
174
- /* Keep the already visible tooltip at a constant position, as long as the
175
- ** mouse is over the same element. */
176
- if(tooltipObj.style.display != "none"){
177
- if(ix == tooltipInfo.ixHover) return;
178
- }
179
- /* The tooltip is either not visible, or the mouse is over a different
180
- ** element, so clear the dwell timer, and record the new element id and
181
- ** mouse position. */
182
- stopDwellTimer();
183
- if(ix >= 0){
184
- tooltipInfo.ixHover = ix;
185
- tooltipInfo.posX = e.clientX;
186
- tooltipInfo.posY = e.clientY;
187
- stopCloseTimer();
188
- if(tooltipInfo.dwellTimeout>0){
189
- tooltipInfo.idTimer = setTimeout(function() {
190
- tooltipInfo.idTimer = 0;
191
- stopCloseTimer();
192
- showGraphTooltip();
193
- },tooltipInfo.dwellTimeout);
194
- }
195
- }else{
196
- /* The mouse is not over an element with a tooltip */
197
- tooltipInfo.ixHover = -1;
198
- resumeCloseTimer();
199
- }
176
+ mouseOverGraph(e,ix,null);
200177
};
201178
topObj.onmouseleave = function(e) {
202179
/* Hide the tooltip if the mouse is outside the "timelineTableN" element,
203180
** and outside the tooltip. */
204181
if(e.relatedTarget && e.relatedTarget != tooltipObj){
@@ -208,18 +185,26 @@
208185
stopCloseTimer();
209186
}
210187
};
211188
function mouseOverNode(e){ /* Invoked by mousemove events over a graph node */
212189
e.stopPropagation()
213
- if(tooltipInfo.ixHover==-2) return
214
- tooltipInfo.ixHover = -2
215
- tooltipInfo.posX = e.clientX
216
- tooltipInfo.posY = e.clientY
217
- tooltipInfo.nodeHover = this
218
- stopCloseTimer();
219
- if(tooltipInfo.dwellTimeout>0){
220
- tooltipInfo.idTimer = setTimeout(function() {
190
+ mouseOverGraph(e,-2,this)
191
+ }
192
+ /* Combined mousemove handler for graph nodes and rails. */
193
+ function mouseOverGraph(e,ix,node){
194
+ stopDwellTimer(); // Mouse movement: reset the dwell timer.
195
+ var ownTooltip = // Check if the hovered element already has the tooltip.
196
+ (ix>=0 && ix==tooltipInfo.ixActive) ||
197
+ (ix==-2 && tooltipInfo.idNodeActive==node.id);
198
+ if(ownTooltip) stopCloseTimer(); // ownTooltip: clear the close timer.
199
+ else resumeCloseTimer(); // !ownTooltip: resume the close timer.
200
+ tooltipInfo.ixHover = ix;
201
+ tooltipInfo.nodeHover = node;
202
+ tooltipInfo.posX = e.clientX;
203
+ tooltipInfo.posY = e.clientY;
204
+ if(ix!=-1 && !ownTooltip && tooltipInfo.dwellTimeout>0){ // Go dwell timer.
205
+ tooltipInfo.idTimer = setTimeout(function(){
221206
tooltipInfo.idTimer = 0;
222207
stopCloseTimer();
223208
showGraphTooltip();
224209
},tooltipInfo.dwellTimeout);
225210
}
@@ -611,10 +596,12 @@
611596
dest += tx.fileDiff ? "&m&cf=" : "&m&c="
612597
dest += encodeURIComponent(tx.rowinfo[ix].h)
613598
return dest
614599
}
615600
function clickOnGraph(e){
601
+ stopCloseTimer();
602
+ stopDwellTimer();
616603
tooltipInfo.ixHover = findTxIndex(e);
617604
tooltipInfo.posX = e.clientX;
618605
tooltipInfo.posY = e.clientY;
619606
showGraphTooltip();
620607
}
@@ -630,10 +617,11 @@
630617
html = "artifact <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
631618
}else{
632619
html = "check-in <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
633620
}
634621
tooltipInfo.ixActive = -2;
622
+ tooltipInfo.idNodeActive = tooltipInfo.nodeHover.id;
635623
}else if( tooltipInfo.ixHover>=0 ){
636624
ix = tooltipInfo.ixHover
637625
var br = tx.rowinfo[ix].br
638626
var dest = branchHyperlink(ix)
639627
var hbr = br.replace(/&/g, "&amp;")
@@ -641,10 +629,11 @@
641629
.replace(/>/g, "&gt;")
642630
.replace(/"/g, "&quot;")
643631
.replace(/'/g, "&#039;");
644632
html = "branch <a id=\"tooltip-link\" href=\""+dest+"\">"+hbr+"</a>"
645633
tooltipInfo.ixActive = ix;
634
+ tooltipInfo.idNodeActive = 0;
646635
}
647636
if( html ){
648637
/* Setup while hidden, to ensure proper dimensions. */
649638
var s = getComputedStyle(document.body)
650639
if( tx.rowinfo[ix].bg.length ){
651640
--- src/graph.js
+++ src/graph.js
@@ -116,10 +116,11 @@
116 ** over a graph node. Or -1 when the mouse is not
117 ** over anything. */
118 ixActive: -1, /* The item shown in the tooltip is tx.rowinfo[ixActive].
119 ** ixActive is -1 if the tooltip is not visible */
120 nodeHover: null, /* Graph node under mouse when ixHover==-2 */
 
121 posX: 0, posY: 0 /* The last mouse position. */
122 };
123
124 /* Functions used to control the tooltip popup and its timer */
125 function onKeyDown(event){ /* Hide the tooltip when ESC key pressed */
@@ -132,10 +133,11 @@
132 function hideGraphTooltip(){ /* Hide the tooltip */
133 document.removeEventListener('keydown',onKeyDown,/* useCapture == */true);
134 stopCloseTimer();
135 tooltipObj.style.display = "none";
136 tooltipInfo.ixActive = -1;
 
137 }
138 document.body.onunload = hideGraphTooltip
139 function stopDwellTimer(){
140 if(tooltipInfo.idTimer!=0){
141 clearTimeout(tooltipInfo.idTimer);
@@ -169,36 +171,11 @@
169 topObj.onclick = clickOnGraph
170 topObj.ondblclick = dblclickOnGraph
171 topObj.onmousemove = function(e) {
172 var ix = findTxIndex(e);
173 topObj.style.cursor = (ix<0) ? "" : "pointer"
174 /* Keep the already visible tooltip at a constant position, as long as the
175 ** mouse is over the same element. */
176 if(tooltipObj.style.display != "none"){
177 if(ix == tooltipInfo.ixHover) return;
178 }
179 /* The tooltip is either not visible, or the mouse is over a different
180 ** element, so clear the dwell timer, and record the new element id and
181 ** mouse position. */
182 stopDwellTimer();
183 if(ix >= 0){
184 tooltipInfo.ixHover = ix;
185 tooltipInfo.posX = e.clientX;
186 tooltipInfo.posY = e.clientY;
187 stopCloseTimer();
188 if(tooltipInfo.dwellTimeout>0){
189 tooltipInfo.idTimer = setTimeout(function() {
190 tooltipInfo.idTimer = 0;
191 stopCloseTimer();
192 showGraphTooltip();
193 },tooltipInfo.dwellTimeout);
194 }
195 }else{
196 /* The mouse is not over an element with a tooltip */
197 tooltipInfo.ixHover = -1;
198 resumeCloseTimer();
199 }
200 };
201 topObj.onmouseleave = function(e) {
202 /* Hide the tooltip if the mouse is outside the "timelineTableN" element,
203 ** and outside the tooltip. */
204 if(e.relatedTarget && e.relatedTarget != tooltipObj){
@@ -208,18 +185,26 @@
208 stopCloseTimer();
209 }
210 };
211 function mouseOverNode(e){ /* Invoked by mousemove events over a graph node */
212 e.stopPropagation()
213 if(tooltipInfo.ixHover==-2) return
214 tooltipInfo.ixHover = -2
215 tooltipInfo.posX = e.clientX
216 tooltipInfo.posY = e.clientY
217 tooltipInfo.nodeHover = this
218 stopCloseTimer();
219 if(tooltipInfo.dwellTimeout>0){
220 tooltipInfo.idTimer = setTimeout(function() {
 
 
 
 
 
 
 
 
221 tooltipInfo.idTimer = 0;
222 stopCloseTimer();
223 showGraphTooltip();
224 },tooltipInfo.dwellTimeout);
225 }
@@ -611,10 +596,12 @@
611 dest += tx.fileDiff ? "&m&cf=" : "&m&c="
612 dest += encodeURIComponent(tx.rowinfo[ix].h)
613 return dest
614 }
615 function clickOnGraph(e){
 
 
616 tooltipInfo.ixHover = findTxIndex(e);
617 tooltipInfo.posX = e.clientX;
618 tooltipInfo.posY = e.clientY;
619 showGraphTooltip();
620 }
@@ -630,10 +617,11 @@
630 html = "artifact <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
631 }else{
632 html = "check-in <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
633 }
634 tooltipInfo.ixActive = -2;
 
635 }else if( tooltipInfo.ixHover>=0 ){
636 ix = tooltipInfo.ixHover
637 var br = tx.rowinfo[ix].br
638 var dest = branchHyperlink(ix)
639 var hbr = br.replace(/&/g, "&amp;")
@@ -641,10 +629,11 @@
641 .replace(/>/g, "&gt;")
642 .replace(/"/g, "&quot;")
643 .replace(/'/g, "&#039;");
644 html = "branch <a id=\"tooltip-link\" href=\""+dest+"\">"+hbr+"</a>"
645 tooltipInfo.ixActive = ix;
 
646 }
647 if( html ){
648 /* Setup while hidden, to ensure proper dimensions. */
649 var s = getComputedStyle(document.body)
650 if( tx.rowinfo[ix].bg.length ){
651
--- src/graph.js
+++ src/graph.js
@@ -116,10 +116,11 @@
116 ** over a graph node. Or -1 when the mouse is not
117 ** over anything. */
118 ixActive: -1, /* The item shown in the tooltip is tx.rowinfo[ixActive].
119 ** ixActive is -1 if the tooltip is not visible */
120 nodeHover: null, /* Graph node under mouse when ixHover==-2 */
121 idNodeActive: 0, /* Element ID of the graph node with the tooltip. */
122 posX: 0, posY: 0 /* The last mouse position. */
123 };
124
125 /* Functions used to control the tooltip popup and its timer */
126 function onKeyDown(event){ /* Hide the tooltip when ESC key pressed */
@@ -132,10 +133,11 @@
133 function hideGraphTooltip(){ /* Hide the tooltip */
134 document.removeEventListener('keydown',onKeyDown,/* useCapture == */true);
135 stopCloseTimer();
136 tooltipObj.style.display = "none";
137 tooltipInfo.ixActive = -1;
138 tooltipInfo.idNodeActive = 0;
139 }
140 document.body.onunload = hideGraphTooltip
141 function stopDwellTimer(){
142 if(tooltipInfo.idTimer!=0){
143 clearTimeout(tooltipInfo.idTimer);
@@ -169,36 +171,11 @@
171 topObj.onclick = clickOnGraph
172 topObj.ondblclick = dblclickOnGraph
173 topObj.onmousemove = function(e) {
174 var ix = findTxIndex(e);
175 topObj.style.cursor = (ix<0) ? "" : "pointer"
176 mouseOverGraph(e,ix,null);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177 };
178 topObj.onmouseleave = function(e) {
179 /* Hide the tooltip if the mouse is outside the "timelineTableN" element,
180 ** and outside the tooltip. */
181 if(e.relatedTarget && e.relatedTarget != tooltipObj){
@@ -208,18 +185,26 @@
185 stopCloseTimer();
186 }
187 };
188 function mouseOverNode(e){ /* Invoked by mousemove events over a graph node */
189 e.stopPropagation()
190 mouseOverGraph(e,-2,this)
191 }
192 /* Combined mousemove handler for graph nodes and rails. */
193 function mouseOverGraph(e,ix,node){
194 stopDwellTimer(); // Mouse movement: reset the dwell timer.
195 var ownTooltip = // Check if the hovered element already has the tooltip.
196 (ix>=0 && ix==tooltipInfo.ixActive) ||
197 (ix==-2 && tooltipInfo.idNodeActive==node.id);
198 if(ownTooltip) stopCloseTimer(); // ownTooltip: clear the close timer.
199 else resumeCloseTimer(); // !ownTooltip: resume the close timer.
200 tooltipInfo.ixHover = ix;
201 tooltipInfo.nodeHover = node;
202 tooltipInfo.posX = e.clientX;
203 tooltipInfo.posY = e.clientY;
204 if(ix!=-1 && !ownTooltip && tooltipInfo.dwellTimeout>0){ // Go dwell timer.
205 tooltipInfo.idTimer = setTimeout(function(){
206 tooltipInfo.idTimer = 0;
207 stopCloseTimer();
208 showGraphTooltip();
209 },tooltipInfo.dwellTimeout);
210 }
@@ -611,10 +596,12 @@
596 dest += tx.fileDiff ? "&m&cf=" : "&m&c="
597 dest += encodeURIComponent(tx.rowinfo[ix].h)
598 return dest
599 }
600 function clickOnGraph(e){
601 stopCloseTimer();
602 stopDwellTimer();
603 tooltipInfo.ixHover = findTxIndex(e);
604 tooltipInfo.posX = e.clientX;
605 tooltipInfo.posY = e.clientY;
606 showGraphTooltip();
607 }
@@ -630,10 +617,11 @@
617 html = "artifact <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
618 }else{
619 html = "check-in <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
620 }
621 tooltipInfo.ixActive = -2;
622 tooltipInfo.idNodeActive = tooltipInfo.nodeHover.id;
623 }else if( tooltipInfo.ixHover>=0 ){
624 ix = tooltipInfo.ixHover
625 var br = tx.rowinfo[ix].br
626 var dest = branchHyperlink(ix)
627 var hbr = br.replace(/&/g, "&amp;")
@@ -641,10 +629,11 @@
629 .replace(/>/g, "&gt;")
630 .replace(/"/g, "&quot;")
631 .replace(/'/g, "&#039;");
632 html = "branch <a id=\"tooltip-link\" href=\""+dest+"\">"+hbr+"</a>"
633 tooltipInfo.ixActive = ix;
634 tooltipInfo.idNodeActive = 0;
635 }
636 if( html ){
637 /* Setup while hidden, to ensure proper dimensions. */
638 var s = getComputedStyle(document.body)
639 if( tx.rowinfo[ix].bg.length ){
640
+23 -34
--- src/graph.js
+++ src/graph.js
@@ -116,10 +116,11 @@
116116
** over a graph node. Or -1 when the mouse is not
117117
** over anything. */
118118
ixActive: -1, /* The item shown in the tooltip is tx.rowinfo[ixActive].
119119
** ixActive is -1 if the tooltip is not visible */
120120
nodeHover: null, /* Graph node under mouse when ixHover==-2 */
121
+ idNodeActive: 0, /* Element ID of the graph node with the tooltip. */
121122
posX: 0, posY: 0 /* The last mouse position. */
122123
};
123124
124125
/* Functions used to control the tooltip popup and its timer */
125126
function onKeyDown(event){ /* Hide the tooltip when ESC key pressed */
@@ -132,10 +133,11 @@
132133
function hideGraphTooltip(){ /* Hide the tooltip */
133134
document.removeEventListener('keydown',onKeyDown,/* useCapture == */true);
134135
stopCloseTimer();
135136
tooltipObj.style.display = "none";
136137
tooltipInfo.ixActive = -1;
138
+ tooltipInfo.idNodeActive = 0;
137139
}
138140
document.body.onunload = hideGraphTooltip
139141
function stopDwellTimer(){
140142
if(tooltipInfo.idTimer!=0){
141143
clearTimeout(tooltipInfo.idTimer);
@@ -169,36 +171,11 @@
169171
topObj.onclick = clickOnGraph
170172
topObj.ondblclick = dblclickOnGraph
171173
topObj.onmousemove = function(e) {
172174
var ix = findTxIndex(e);
173175
topObj.style.cursor = (ix<0) ? "" : "pointer"
174
- /* Keep the already visible tooltip at a constant position, as long as the
175
- ** mouse is over the same element. */
176
- if(tooltipObj.style.display != "none"){
177
- if(ix == tooltipInfo.ixHover) return;
178
- }
179
- /* The tooltip is either not visible, or the mouse is over a different
180
- ** element, so clear the dwell timer, and record the new element id and
181
- ** mouse position. */
182
- stopDwellTimer();
183
- if(ix >= 0){
184
- tooltipInfo.ixHover = ix;
185
- tooltipInfo.posX = e.clientX;
186
- tooltipInfo.posY = e.clientY;
187
- stopCloseTimer();
188
- if(tooltipInfo.dwellTimeout>0){
189
- tooltipInfo.idTimer = setTimeout(function() {
190
- tooltipInfo.idTimer = 0;
191
- stopCloseTimer();
192
- showGraphTooltip();
193
- },tooltipInfo.dwellTimeout);
194
- }
195
- }else{
196
- /* The mouse is not over an element with a tooltip */
197
- tooltipInfo.ixHover = -1;
198
- resumeCloseTimer();
199
- }
176
+ mouseOverGraph(e,ix,null);
200177
};
201178
topObj.onmouseleave = function(e) {
202179
/* Hide the tooltip if the mouse is outside the "timelineTableN" element,
203180
** and outside the tooltip. */
204181
if(e.relatedTarget && e.relatedTarget != tooltipObj){
@@ -208,18 +185,26 @@
208185
stopCloseTimer();
209186
}
210187
};
211188
function mouseOverNode(e){ /* Invoked by mousemove events over a graph node */
212189
e.stopPropagation()
213
- if(tooltipInfo.ixHover==-2) return
214
- tooltipInfo.ixHover = -2
215
- tooltipInfo.posX = e.clientX
216
- tooltipInfo.posY = e.clientY
217
- tooltipInfo.nodeHover = this
218
- stopCloseTimer();
219
- if(tooltipInfo.dwellTimeout>0){
220
- tooltipInfo.idTimer = setTimeout(function() {
190
+ mouseOverGraph(e,-2,this)
191
+ }
192
+ /* Combined mousemove handler for graph nodes and rails. */
193
+ function mouseOverGraph(e,ix,node){
194
+ stopDwellTimer(); // Mouse movement: reset the dwell timer.
195
+ var ownTooltip = // Check if the hovered element already has the tooltip.
196
+ (ix>=0 && ix==tooltipInfo.ixActive) ||
197
+ (ix==-2 && tooltipInfo.idNodeActive==node.id);
198
+ if(ownTooltip) stopCloseTimer(); // ownTooltip: clear the close timer.
199
+ else resumeCloseTimer(); // !ownTooltip: resume the close timer.
200
+ tooltipInfo.ixHover = ix;
201
+ tooltipInfo.nodeHover = node;
202
+ tooltipInfo.posX = e.clientX;
203
+ tooltipInfo.posY = e.clientY;
204
+ if(ix!=-1 && !ownTooltip && tooltipInfo.dwellTimeout>0){ // Go dwell timer.
205
+ tooltipInfo.idTimer = setTimeout(function(){
221206
tooltipInfo.idTimer = 0;
222207
stopCloseTimer();
223208
showGraphTooltip();
224209
},tooltipInfo.dwellTimeout);
225210
}
@@ -611,10 +596,12 @@
611596
dest += tx.fileDiff ? "&m&cf=" : "&m&c="
612597
dest += encodeURIComponent(tx.rowinfo[ix].h)
613598
return dest
614599
}
615600
function clickOnGraph(e){
601
+ stopCloseTimer();
602
+ stopDwellTimer();
616603
tooltipInfo.ixHover = findTxIndex(e);
617604
tooltipInfo.posX = e.clientX;
618605
tooltipInfo.posY = e.clientY;
619606
showGraphTooltip();
620607
}
@@ -630,10 +617,11 @@
630617
html = "artifact <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
631618
}else{
632619
html = "check-in <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
633620
}
634621
tooltipInfo.ixActive = -2;
622
+ tooltipInfo.idNodeActive = tooltipInfo.nodeHover.id;
635623
}else if( tooltipInfo.ixHover>=0 ){
636624
ix = tooltipInfo.ixHover
637625
var br = tx.rowinfo[ix].br
638626
var dest = branchHyperlink(ix)
639627
var hbr = br.replace(/&/g, "&amp;")
@@ -641,10 +629,11 @@
641629
.replace(/>/g, "&gt;")
642630
.replace(/"/g, "&quot;")
643631
.replace(/'/g, "&#039;");
644632
html = "branch <a id=\"tooltip-link\" href=\""+dest+"\">"+hbr+"</a>"
645633
tooltipInfo.ixActive = ix;
634
+ tooltipInfo.idNodeActive = 0;
646635
}
647636
if( html ){
648637
/* Setup while hidden, to ensure proper dimensions. */
649638
var s = getComputedStyle(document.body)
650639
if( tx.rowinfo[ix].bg.length ){
651640
--- src/graph.js
+++ src/graph.js
@@ -116,10 +116,11 @@
116 ** over a graph node. Or -1 when the mouse is not
117 ** over anything. */
118 ixActive: -1, /* The item shown in the tooltip is tx.rowinfo[ixActive].
119 ** ixActive is -1 if the tooltip is not visible */
120 nodeHover: null, /* Graph node under mouse when ixHover==-2 */
 
121 posX: 0, posY: 0 /* The last mouse position. */
122 };
123
124 /* Functions used to control the tooltip popup and its timer */
125 function onKeyDown(event){ /* Hide the tooltip when ESC key pressed */
@@ -132,10 +133,11 @@
132 function hideGraphTooltip(){ /* Hide the tooltip */
133 document.removeEventListener('keydown',onKeyDown,/* useCapture == */true);
134 stopCloseTimer();
135 tooltipObj.style.display = "none";
136 tooltipInfo.ixActive = -1;
 
137 }
138 document.body.onunload = hideGraphTooltip
139 function stopDwellTimer(){
140 if(tooltipInfo.idTimer!=0){
141 clearTimeout(tooltipInfo.idTimer);
@@ -169,36 +171,11 @@
169 topObj.onclick = clickOnGraph
170 topObj.ondblclick = dblclickOnGraph
171 topObj.onmousemove = function(e) {
172 var ix = findTxIndex(e);
173 topObj.style.cursor = (ix<0) ? "" : "pointer"
174 /* Keep the already visible tooltip at a constant position, as long as the
175 ** mouse is over the same element. */
176 if(tooltipObj.style.display != "none"){
177 if(ix == tooltipInfo.ixHover) return;
178 }
179 /* The tooltip is either not visible, or the mouse is over a different
180 ** element, so clear the dwell timer, and record the new element id and
181 ** mouse position. */
182 stopDwellTimer();
183 if(ix >= 0){
184 tooltipInfo.ixHover = ix;
185 tooltipInfo.posX = e.clientX;
186 tooltipInfo.posY = e.clientY;
187 stopCloseTimer();
188 if(tooltipInfo.dwellTimeout>0){
189 tooltipInfo.idTimer = setTimeout(function() {
190 tooltipInfo.idTimer = 0;
191 stopCloseTimer();
192 showGraphTooltip();
193 },tooltipInfo.dwellTimeout);
194 }
195 }else{
196 /* The mouse is not over an element with a tooltip */
197 tooltipInfo.ixHover = -1;
198 resumeCloseTimer();
199 }
200 };
201 topObj.onmouseleave = function(e) {
202 /* Hide the tooltip if the mouse is outside the "timelineTableN" element,
203 ** and outside the tooltip. */
204 if(e.relatedTarget && e.relatedTarget != tooltipObj){
@@ -208,18 +185,26 @@
208 stopCloseTimer();
209 }
210 };
211 function mouseOverNode(e){ /* Invoked by mousemove events over a graph node */
212 e.stopPropagation()
213 if(tooltipInfo.ixHover==-2) return
214 tooltipInfo.ixHover = -2
215 tooltipInfo.posX = e.clientX
216 tooltipInfo.posY = e.clientY
217 tooltipInfo.nodeHover = this
218 stopCloseTimer();
219 if(tooltipInfo.dwellTimeout>0){
220 tooltipInfo.idTimer = setTimeout(function() {
 
 
 
 
 
 
 
 
221 tooltipInfo.idTimer = 0;
222 stopCloseTimer();
223 showGraphTooltip();
224 },tooltipInfo.dwellTimeout);
225 }
@@ -611,10 +596,12 @@
611 dest += tx.fileDiff ? "&m&cf=" : "&m&c="
612 dest += encodeURIComponent(tx.rowinfo[ix].h)
613 return dest
614 }
615 function clickOnGraph(e){
 
 
616 tooltipInfo.ixHover = findTxIndex(e);
617 tooltipInfo.posX = e.clientX;
618 tooltipInfo.posY = e.clientY;
619 showGraphTooltip();
620 }
@@ -630,10 +617,11 @@
630 html = "artifact <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
631 }else{
632 html = "check-in <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
633 }
634 tooltipInfo.ixActive = -2;
 
635 }else if( tooltipInfo.ixHover>=0 ){
636 ix = tooltipInfo.ixHover
637 var br = tx.rowinfo[ix].br
638 var dest = branchHyperlink(ix)
639 var hbr = br.replace(/&/g, "&amp;")
@@ -641,10 +629,11 @@
641 .replace(/>/g, "&gt;")
642 .replace(/"/g, "&quot;")
643 .replace(/'/g, "&#039;");
644 html = "branch <a id=\"tooltip-link\" href=\""+dest+"\">"+hbr+"</a>"
645 tooltipInfo.ixActive = ix;
 
646 }
647 if( html ){
648 /* Setup while hidden, to ensure proper dimensions. */
649 var s = getComputedStyle(document.body)
650 if( tx.rowinfo[ix].bg.length ){
651
--- src/graph.js
+++ src/graph.js
@@ -116,10 +116,11 @@
116 ** over a graph node. Or -1 when the mouse is not
117 ** over anything. */
118 ixActive: -1, /* The item shown in the tooltip is tx.rowinfo[ixActive].
119 ** ixActive is -1 if the tooltip is not visible */
120 nodeHover: null, /* Graph node under mouse when ixHover==-2 */
121 idNodeActive: 0, /* Element ID of the graph node with the tooltip. */
122 posX: 0, posY: 0 /* The last mouse position. */
123 };
124
125 /* Functions used to control the tooltip popup and its timer */
126 function onKeyDown(event){ /* Hide the tooltip when ESC key pressed */
@@ -132,10 +133,11 @@
133 function hideGraphTooltip(){ /* Hide the tooltip */
134 document.removeEventListener('keydown',onKeyDown,/* useCapture == */true);
135 stopCloseTimer();
136 tooltipObj.style.display = "none";
137 tooltipInfo.ixActive = -1;
138 tooltipInfo.idNodeActive = 0;
139 }
140 document.body.onunload = hideGraphTooltip
141 function stopDwellTimer(){
142 if(tooltipInfo.idTimer!=0){
143 clearTimeout(tooltipInfo.idTimer);
@@ -169,36 +171,11 @@
171 topObj.onclick = clickOnGraph
172 topObj.ondblclick = dblclickOnGraph
173 topObj.onmousemove = function(e) {
174 var ix = findTxIndex(e);
175 topObj.style.cursor = (ix<0) ? "" : "pointer"
176 mouseOverGraph(e,ix,null);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177 };
178 topObj.onmouseleave = function(e) {
179 /* Hide the tooltip if the mouse is outside the "timelineTableN" element,
180 ** and outside the tooltip. */
181 if(e.relatedTarget && e.relatedTarget != tooltipObj){
@@ -208,18 +185,26 @@
185 stopCloseTimer();
186 }
187 };
188 function mouseOverNode(e){ /* Invoked by mousemove events over a graph node */
189 e.stopPropagation()
190 mouseOverGraph(e,-2,this)
191 }
192 /* Combined mousemove handler for graph nodes and rails. */
193 function mouseOverGraph(e,ix,node){
194 stopDwellTimer(); // Mouse movement: reset the dwell timer.
195 var ownTooltip = // Check if the hovered element already has the tooltip.
196 (ix>=0 && ix==tooltipInfo.ixActive) ||
197 (ix==-2 && tooltipInfo.idNodeActive==node.id);
198 if(ownTooltip) stopCloseTimer(); // ownTooltip: clear the close timer.
199 else resumeCloseTimer(); // !ownTooltip: resume the close timer.
200 tooltipInfo.ixHover = ix;
201 tooltipInfo.nodeHover = node;
202 tooltipInfo.posX = e.clientX;
203 tooltipInfo.posY = e.clientY;
204 if(ix!=-1 && !ownTooltip && tooltipInfo.dwellTimeout>0){ // Go dwell timer.
205 tooltipInfo.idTimer = setTimeout(function(){
206 tooltipInfo.idTimer = 0;
207 stopCloseTimer();
208 showGraphTooltip();
209 },tooltipInfo.dwellTimeout);
210 }
@@ -611,10 +596,12 @@
596 dest += tx.fileDiff ? "&m&cf=" : "&m&c="
597 dest += encodeURIComponent(tx.rowinfo[ix].h)
598 return dest
599 }
600 function clickOnGraph(e){
601 stopCloseTimer();
602 stopDwellTimer();
603 tooltipInfo.ixHover = findTxIndex(e);
604 tooltipInfo.posX = e.clientX;
605 tooltipInfo.posY = e.clientY;
606 showGraphTooltip();
607 }
@@ -630,10 +617,11 @@
617 html = "artifact <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
618 }else{
619 html = "check-in <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
620 }
621 tooltipInfo.ixActive = -2;
622 tooltipInfo.idNodeActive = tooltipInfo.nodeHover.id;
623 }else if( tooltipInfo.ixHover>=0 ){
624 ix = tooltipInfo.ixHover
625 var br = tx.rowinfo[ix].br
626 var dest = branchHyperlink(ix)
627 var hbr = br.replace(/&/g, "&amp;")
@@ -641,10 +629,11 @@
629 .replace(/>/g, "&gt;")
630 .replace(/"/g, "&quot;")
631 .replace(/'/g, "&#039;");
632 html = "branch <a id=\"tooltip-link\" href=\""+dest+"\">"+hbr+"</a>"
633 tooltipInfo.ixActive = ix;
634 tooltipInfo.idNodeActive = 0;
635 }
636 if( html ){
637 /* Setup while hidden, to ensure proper dimensions. */
638 var s = getComputedStyle(document.body)
639 if( tx.rowinfo[ix].bg.length ){
640
+1 -1
--- src/timeline.c
+++ src/timeline.c
@@ -870,11 +870,11 @@
870870
@ "scrollToSelect": %d(scrollToSelect),
871871
@ "nrail": %d(pGraph->mxRail+1),
872872
@ "baseUrl": "%R",
873873
@ "dwellTimeout": %d(dwellTimeout),
874874
@ "closeTimeout": %d(closeTimeout),
875
- @ "hashDigit": %d(hash_digits(1)),
875
+ @ "hashDigits": %d(hash_digits(1)),
876876
@ "bottomRowId": "btm-%d(iTableId)",
877877
if( pGraph->nRow==0 ){
878878
@ "rowinfo": null
879879
}else{
880880
@ "rowinfo": [
881881
--- src/timeline.c
+++ src/timeline.c
@@ -870,11 +870,11 @@
870 @ "scrollToSelect": %d(scrollToSelect),
871 @ "nrail": %d(pGraph->mxRail+1),
872 @ "baseUrl": "%R",
873 @ "dwellTimeout": %d(dwellTimeout),
874 @ "closeTimeout": %d(closeTimeout),
875 @ "hashDigit": %d(hash_digits(1)),
876 @ "bottomRowId": "btm-%d(iTableId)",
877 if( pGraph->nRow==0 ){
878 @ "rowinfo": null
879 }else{
880 @ "rowinfo": [
881
--- src/timeline.c
+++ src/timeline.c
@@ -870,11 +870,11 @@
870 @ "scrollToSelect": %d(scrollToSelect),
871 @ "nrail": %d(pGraph->mxRail+1),
872 @ "baseUrl": "%R",
873 @ "dwellTimeout": %d(dwellTimeout),
874 @ "closeTimeout": %d(closeTimeout),
875 @ "hashDigits": %d(hash_digits(1)),
876 @ "bottomRowId": "btm-%d(iTableId)",
877 if( pGraph->nRow==0 ){
878 @ "rowinfo": null
879 }else{
880 @ "rowinfo": [
881

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button