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

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

    Details

    • Type: Bug
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: 8.5.0
    • Fix Version/s: None
    • Component/s: ZK Client Engine
    • Labels:
      None

      Description

      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);

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            bobpeng bobpeng
            Reporter:
            AndreiTM AndreiTM
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: