imports/vx/client/code/ux.js
/**
     * Given a click event (triggered by clicking or touching a menu control), transform
     * the event into a "context" event compatible with react-contexify.
     *
     * @param {event} oldEvent Original event.
     */
Given a click event (triggered by clicking or touching a menu control), transform
the event into a "context" event compatible with react-contexify.

@param {event} oldEvent Original event.
Given a click event ( triggered by clicking or touching a menu control ) transform the event into a " context " event compatible with react - contexify . @param { event } oldEvent Original event .
makeContextEvent(oldEvent ) {
        const offset = $(oldEvent.target).offset()
        let X
        let Y
        if (oldEvent.type === "touchstart") {
            X = oldEvent.changedTouches[0].clientX
            Y = oldEvent.changedTouches[0].clientY
        }
        else {
            X = oldEvent.clientX
            Y = oldEvent.clientY
        }
        const newEvent = $.extend($.Event("contextmenu"), {
            which: 1,
            clientX: X,
            clientY: Y,
            pageX: offset.left,
            pageY: oldEvent.pageY,
            screenX: X,
            screenY: Y
        })
        return newEvent
    }
makeContextEvent ( oldEvent ) { const offset = $ ( oldEvent . target ) . offset ( ) let X let Y if ( oldEvent . type === "touchstart" ) { X = oldEvent . changedTouches [ 0 ] . clientX Y = oldEvent . changedTouches [ 0 ] . clientY } else { X = oldEvent . clientX Y = oldEvent . clientY } const newEvent = $ . extend ( $ . Event ( "contextmenu" ) , { which : 1 , clientX : X , clientY : Y , pageX : offset . left , pageY : oldEvent . pageY , screenX : X , screenY : Y } ) return newEvent }
Given a click event (triggered by clicking or touching a menu control), transform
 the event into a "context" event compatible with react-contexify.
Given a click event ( triggered by clicking or touching a menu control ) transform the event into a " context " event compatible with react - contexify .
// Create synthetic event transforming left-click to right-click: