Changeset 173640 in webkit


Ignore:
Timestamp:
Sep 15, 2014 5:41:36 PM (10 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: mouse drifts away from resizer when resizing docked inspector
https://bugs.webkit.org/show_bug.cgi?id=22263

Patch by Matt Baker <Matt Baker> on 2014-09-15
Reviewed by Joseph Pecoraro.

Modified the docked resizer dragging logic to record the initial mouse down position relative to the
resizer client rectangle. Added check while dragging the resizer to ensure that the cursor is positioned
correctly with respect to the resize direction before updating the attached window dimension.

  • UserInterface/Base/Main.js:

(WebInspector._dockedResizerMouseDown.dockedResizerDrag):

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r173547 r173640  
     12014-09-15  Matt Baker  <mattbaker@apple.com>
     2
     3        Web Inspector: mouse drifts away from resizer when resizing docked inspector
     4        https://bugs.webkit.org/show_bug.cgi?id=22263
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        Modified the docked resizer dragging logic to record the initial mouse down position relative to the
     9        resizer client rectangle. Added check while dragging the resizer to ensure that the cursor is positioned
     10        correctly with respect to the resize direction before updating the attached window dimension.
     11
     12        * UserInterface/Base/Main.js:
     13        (WebInspector._dockedResizerMouseDown.dockedResizerDrag):
     14
    1152014-09-11  Joseph Pecoraro  <pecoraro@apple.com>
    216
  • trunk/Source/WebInspectorUI/UserInterface/Base/Main.js

    r173494 r173640  
    12821282
    12831283    var windowProperty = this._dockSide === "bottom" ? "innerHeight" : "innerWidth";
    1284     var eventProperty = this._dockSide === "bottom" ? "screenY" : "screenX";
     1284    var eventScreenProperty = this._dockSide === "bottom" ? "screenY" : "screenX";
     1285    var eventClientProperty = this._dockSide === "bottom" ? "clientY" : "clientX";
    12851286
    12861287    var resizerElement = event.target;
    1287     var lastScreenPosition = event[eventProperty];
     1288    var firstClientPosition = event[eventClientProperty];
     1289    var lastScreenPosition = event[eventScreenProperty];
    12881290
    12891291    function dockedResizerDrag(event)
     
    12921294            return;
    12931295
    1294         var position = event[eventProperty];
    1295         var dimension = window[windowProperty] - (position - lastScreenPosition);
     1296        var position = event[eventScreenProperty];
     1297        var delta = position - lastScreenPosition;
     1298        var clientPosition = event[eventClientProperty];
     1299
     1300        lastScreenPosition = position;
     1301
     1302        // If delta is positive the docked Inspector size is decreasing, in which case the cursor client position
     1303        // with respect to the target cannot be less than the first mouse down position within the target.
     1304        if (delta > 0 && clientPosition < firstClientPosition)
     1305            return;
     1306
     1307        // If delta is negative the docked Inspector size is increasing, in which case the cursor client position
     1308        // with respect to the target cannot be greater than the first mouse down position within the target.
     1309        if (delta < 0 && clientPosition > firstClientPosition)
     1310            return;
     1311
     1312        var dimension = Math.max(0, window[windowProperty] - delta);
    12961313
    12971314        if (this._dockSide === "bottom")
     
    12991316        else
    13001317            InspectorFrontendHost.setAttachedWindowWidth(dimension);
    1301 
    1302         lastScreenPosition = position;
    13031318    }
    13041319
Note: See TracChangeset for help on using the changeset viewer.