code: function createBarEvent(ctx, type = 'mouse') {
    const parent = getRealParent(ctx);
    const moveEventName = type == 'mouse' ? 'mousemove' : 'touchmove';
    const endEventName = type == 'mouse' ? 'mouseup' : 'touchend';
  
    function mousedown(e) {
      e.stopImmediatePropagation();
      e.preventDefault();
  
      const event = type == 'mouse' ? e : e.touches[0];
  
      document.onselectstart = () => false;
      ctx.axisStartPos =
        event[ctx.bar.client] -
        ctx.$refs['thumb'].getBoundingClientRect()[ctx.bar.posName];
  
      // Tell parent that the mouse has been down.
      ctx.setBarDrag(true);
      eventCenter(document, moveEventName, mousemove);
      eventCenter(document, endEventName, mouseup);
    }
  
    function mousemove(e) {
      if (!ctx.axisStartPos) {
        return;
      }
  
      const thubmParent = ctx.$refs.thumb.parentNode;
  
      const event = type == 'mouse' ? e : e.touches[0];
  
      let delta =
        event[ctx.bar.client] -
        thubmParent.getBoundingClientRect()[ctx.bar.posName];
      delta = delta / ctx.barRatio;
  
      const percent = (delta - ctx.axisStartPos) / thubmParent[ctx.bar.offset];
      parent.scrollTo(
        {
          [ctx.bar.axis.toLowerCase()]:
            parent.scrollPanelElm[ctx.bar.scrollSize] * percent
        },
        false
      );
    }
  
    function mouseup() {
      ctx.setBarDrag(false);
      parent.hideBar();
  
      document.onselectstart = null;
      ctx.axisStartPos = 0;
  
      eventCenter(document, moveEventName, mousemove, false, 'off');
      eventCenter(document, endEventName, mouseup, false, 'off');
    }
  
    return mousedown;
  }
docs: /* istanbul ignore next