Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3807

_docMouseDown event offset calculation does not work correctly when clicking coordinate 0

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.6.0
    • 8.5.0
    • ZK Client Engine
    • None

      One of our automatic tests fails because of the truthy check in _docMouseDown. In our test we click at position 0, which will evaluate to false in these conditions. We recommend patching this code to avoid any corner case issues. Below is our fix:

      function _docMouseDown(evt, wgt, noFocusChange) {
      zk.clickPointer[0] = evt.pageX;
      zk.clickPointer[1] = evt.pageY;

      if (!wgt) wgt = evt.target;

      var target = evt.domTarget,
      dEvent = evt.domEvent,
      body = document.body,
      old = zk.currentFocus,
      // B80-ZK-3346: offset is not used on Firefox before version 3.8
      targetPos = jq(target).position(),
      oriEvent = target.originalEvent,
      dEventOfsX = dEvent.offsetX,
      dEventOfsY = dEvent.offsetY,
      evtX = /** ATOSS MODIFICATION BEGIN*/ typeof dEventOfsX !== 'undefined' /* ATOSS MODIFICATION END**/?
      (zk.mobile ? dEventOfsX - targetPos.left : dEventOfsX) :
      (oriEvent ? oriEvent.layerX - targetPos.left : undefined),
      evtY = /** ATOSS MODIFICATION BEGIN*/ typeof dEventOfsY !== 'undefined' /* ATOSS MODIFICATION END**/?
      (zk.mobile ? dEventOfsY - targetPos.top : dEventOfsY) :
      (oriEvent ? oriEvent.layerY - targetPos.top : undefined);

            Unassigned Unassigned
            AndreiTM AndreiTM
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: