Title: [173640] trunk/Source/WebInspectorUI
Revision
173640
Author
[email protected]
Date
2014-09-15 17:41:36 -0700 (Mon, 15 Sep 2014)

Log 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 <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (173639 => 173640)


--- trunk/Source/WebInspectorUI/ChangeLog	2014-09-15 23:47:31 UTC (rev 173639)
+++ trunk/Source/WebInspectorUI/ChangeLog	2014-09-16 00:41:36 UTC (rev 173640)
@@ -1,3 +1,17 @@
+2014-09-15  Matt Baker  <[email protected]>
+
+        Web Inspector: mouse drifts away from resizer when resizing docked inspector
+        https://bugs.webkit.org/show_bug.cgi?id=22263
+
+        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):
+
 2014-09-11  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Fix assert in QuickConsole - main frame execution context path component

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (173639 => 173640)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2014-09-15 23:47:31 UTC (rev 173639)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2014-09-16 00:41:36 UTC (rev 173640)
@@ -1281,25 +1281,40 @@
         return;
 
     var windowProperty = this._dockSide === "bottom" ? "innerHeight" : "innerWidth";
-    var eventProperty = this._dockSide === "bottom" ? "screenY" : "screenX";
+    var eventScreenProperty = this._dockSide === "bottom" ? "screenY" : "screenX";
+    var eventClientProperty = this._dockSide === "bottom" ? "clientY" : "clientX";
 
     var resizerElement = event.target;
-    var lastScreenPosition = event[eventProperty];
+    var firstClientPosition = event[eventClientProperty];
+    var lastScreenPosition = event[eventScreenProperty];
 
     function dockedResizerDrag(event)
     {
         if (event.button !== 0)
             return;
 
-        var position = event[eventProperty];
-        var dimension = window[windowProperty] - (position - lastScreenPosition);
+        var position = event[eventScreenProperty];
+        var delta = position - lastScreenPosition;
+        var clientPosition = event[eventClientProperty];
 
+        lastScreenPosition = position;
+
+        // If delta is positive the docked Inspector size is decreasing, in which case the cursor client position
+        // with respect to the target cannot be less than the first mouse down position within the target.
+        if (delta > 0 && clientPosition < firstClientPosition)
+            return;
+
+        // If delta is negative the docked Inspector size is increasing, in which case the cursor client position
+        // with respect to the target cannot be greater than the first mouse down position within the target.
+        if (delta < 0 && clientPosition > firstClientPosition)
+            return;
+
+        var dimension = Math.max(0, window[windowProperty] - delta);
+
         if (this._dockSide === "bottom")
             InspectorFrontendHost.setAttachedWindowHeight(dimension);
         else
             InspectorFrontendHost.setAttachedWindowWidth(dimension);
-
-        lastScreenPosition = position;
     }
 
     function dockedResizerDragEnd(event)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to