⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 249111 in webkit


Ignore:
Timestamp:
Aug 26, 2019, 12:18:15 PM (7 years ago)
Author:
Jonathan Bedard
Message:

results.webkit.org: Allow clicking on the tooltip arrow
https://bugs.webkit.org/show_bug.cgi?id=201103

Rubber-stamped by Aakash Jain.

By design, the arrow sits above the canvas and intercepts mouse events from it.
This will often make an element that has a tooltip unclickable.

  • resultsdbpy/resultsdbpy/view/static/js/timeline.js:

(xAxisFromScale):
(TimelineFromEndpoint.prototype.render.onDotEnterFactory):
(TimelineFromEndpoint.prototype.render):

  • resultsdbpy/resultsdbpy/view/static/js/tooltip.js:

(_ToolTip):
(_ToolTip.prototype.toString): Trigger onClick callback when the arrow is clicked.
(_ToolTip.prototype.set): Set the onClick callback.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r249104 r249111  
     12019-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
    1202019-08-26  Aakash Jain  <aakash_jain@apple.com>
    221
  • trunk/Tools/resultsdbpy/resultsdbpy/view/static/js/timeline.js

    r249024 r249111  
    206206    }
    207207
     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
    208221    return Timeline.CanvasXAxisComponent(scaleForRepository(scale), {
    209222        isTop: isTop,
    210223        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,
    223225        onScaleEnter: (node, event, canvas) => {
    224226            const scrollDelta = document.documentElement.scrollTop || document.body.scrollTop;
     
    231233                node.tipPoints.map((point) => {
    232234                    return {x: canvas.x + point.x, y: canvas.y + scrollDelta + point.y};
    233                 })
     235                }),
     236                (event) => {return onScaleClick(node);},
    234237            );
    235238        },
     
    621624                    data.tipPoints.map((point) => {
    622625                        return {x: canvas.x + point.x, y: canvas.y + scrollDelta + point.y};
    623                     })
     626                    }),
     627                    (event) => {onDotClickFactory(configuration)(data);},
    624628                );
    625629            }
  • trunk/Tools/resultsdbpy/resultsdbpy/view/static/js/tooltip.js

    r248910 r249111  
    3636        this.ref = null;
    3737        this.arrow = null;
     38        this.onArrowClick = null;
    3839    }
    3940    toString() {
     
    100101                if (!state.direction || !state.location) {
    101102                    element.style.display = 'none';
     103                    element.onclick = null;
     104                    element.style.cursor = null;
    102105                    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;
    103114                }
    104115
     
    117128            </div>`;
    118129    }
    119     set(content, points) {
     130    set(content, points, onArrowClick = null) {
    120131        if (!this.ref) {
    121132            console.error('Cannot set ToolTip content, no tooltip on the page');
     
    126137            return;
    127138        }
    128        
     139        this.onArrowClick = onArrowClick;
    129140        this.ref.setState({content: content, points: points});
    130141    }
Note: See TracChangeset for help on using the changeset viewer.