Changeset 249111 in webkit
- Timestamp:
- Aug 26, 2019, 12:18:15 PM (7 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
resultsdbpy/resultsdbpy/view/static/js/timeline.js (modified) (3 diffs)
-
resultsdbpy/resultsdbpy/view/static/js/tooltip.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r249104 r249111 1 2019-08-26 Jonathan Bedard <jbedard@apple.com> 2 3 results.webkit.org: Allow clicking on the tooltip arrow 4 https://bugs.webkit.org/show_bug.cgi?id=201103 5 6 Rubber-stamped by Aakash Jain. 7 8 By design, the arrow sits above the canvas and intercepts mouse events from it. 9 This will often make an element that has a tooltip unclickable. 10 11 * resultsdbpy/resultsdbpy/view/static/js/timeline.js: 12 (xAxisFromScale): 13 (TimelineFromEndpoint.prototype.render.onDotEnterFactory): 14 (TimelineFromEndpoint.prototype.render): 15 * resultsdbpy/resultsdbpy/view/static/js/tooltip.js: 16 (_ToolTip): 17 (_ToolTip.prototype.toString): Trigger onClick callback when the arrow is clicked. 18 (_ToolTip.prototype.set): Set the onClick callback. 19 1 20 2019-08-26 Aakash Jain <aakash_jain@apple.com> 2 21 -
trunk/Tools/resultsdbpy/resultsdbpy/view/static/js/timeline.js
r249024 r249111 206 206 } 207 207 208 function onScaleClick(node) { 209 if (!node.label.id) 210 return; 211 let params = { 212 branch: node.label.branch ? [node.label.branch] : queryToParams(document.URL.split('?')[1]).branch, 213 uuid: [node.label.uuid], 214 } 215 if (!params.branch) 216 delete params.branch; 217 const query = paramsToQuery(params); 218 window.open(`/commit?${query}`, '_blank'); 219 } 220 208 221 return Timeline.CanvasXAxisComponent(scaleForRepository(scale), { 209 222 isTop: isTop, 210 223 height: 130, 211 onScaleClick: (node) => { 212 if (!node.label.id) 213 return; 214 let params = { 215 branch: node.label.branch ? [node.label.branch] : queryToParams(document.URL.split('?')[1]).branch, 216 uuid: [node.label.uuid], 217 } 218 if (!params.branch) 219 delete params.branch; 220 const query = paramsToQuery(params); 221 window.open(`/commit?${query}`, '_blank'); 222 }, 224 onScaleClick: onScaleClick, 223 225 onScaleEnter: (node, event, canvas) => { 224 226 const scrollDelta = document.documentElement.scrollTop || document.body.scrollTop; … … 231 233 node.tipPoints.map((point) => { 232 234 return {x: canvas.x + point.x, y: canvas.y + scrollDelta + point.y}; 233 }) 235 }), 236 (event) => {return onScaleClick(node);}, 234 237 ); 235 238 }, … … 621 624 data.tipPoints.map((point) => { 622 625 return {x: canvas.x + point.x, y: canvas.y + scrollDelta + point.y}; 623 }) 626 }), 627 (event) => {onDotClickFactory(configuration)(data);}, 624 628 ); 625 629 } -
trunk/Tools/resultsdbpy/resultsdbpy/view/static/js/tooltip.js
r248910 r249111 36 36 this.ref = null; 37 37 this.arrow = null; 38 this.onArrowClick = null; 38 39 } 39 40 toString() { … … 100 101 if (!state.direction || !state.location) { 101 102 element.style.display = 'none'; 103 element.onclick = null; 104 element.style.cursor = null; 102 105 return; 106 } 107 108 if (self.onArrowClick) { 109 element.onclick = self.onArrowClick; 110 element.style.cursor = 'pointer'; 111 } else { 112 element.onclick = null; 113 element.style.cursor = null; 103 114 } 104 115 … … 117 128 </div>`; 118 129 } 119 set(content, points ) {130 set(content, points, onArrowClick = null) { 120 131 if (!this.ref) { 121 132 console.error('Cannot set ToolTip content, no tooltip on the page'); … … 126 137 return; 127 138 } 128 139 this.onArrowClick = onArrowClick; 129 140 this.ref.setState({content: content, points: points}); 130 141 }
Note:
See TracChangeset
for help on using the changeset viewer.