Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html

Issue 1378523003: Devtools[LayoutEditor]: Precise drag with Shift (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@medias-every
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/LayoutEditor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html
diff --git a/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html b/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html
index 6ac39bf85c27babe8829dd7c555cd458897b0345..9b83ed24e64ed19821e03f3000316979bedc3e5e 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html
+++ b/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html
@@ -963,6 +963,7 @@ LayoutEditor.prototype = {
document.addEventListener("mousemove", this._boundDragMove);
document.addEventListener("mouseup", this._boundDragEnd);
InspectorOverlayHost.startPropertyChange(anchorInfo.propertyName);
+ this._preciseDrag = !!event.shiftKey;
this._draggedPropertyName = anchorInfo.propertyName;
this._showLabels(anchorInfo.type, anchorInfo.propertyName);
},
@@ -974,7 +975,18 @@ LayoutEditor.prototype = {
return;
}
event.preventDefault();
- InspectorOverlayHost.changeProperty(this._calculateDelta(deltaVector, new Point(event.screenX - mouseDownPoint.x, event.screenY - mouseDownPoint.y)));
+ if (this._preciseDrag !== event.shiftKey) {
+ InspectorOverlayHost.endPropertyChange();
+ document.removeEventListener("mousemove", this._boundDragMove);
+ mouseDownPoint = new Point(event.screenX, event.screenY);
+ this._boundDragMove = this._onDragMove.bind(this, mouseDownPoint, deltaVector);
+ document.addEventListener("mousemove", this._boundDragMove);
+ this._preciseDrag = event.shiftKey;
+ InspectorOverlayHost.startPropertyChange(this._draggedPropertyName);
+ }
+
+ var preciseFactor = this._preciseDrag ? 5 : 1;
+ InspectorOverlayHost.changeProperty(this._calculateDelta(deltaVector, new Point(event.screenX - mouseDownPoint.x, event.screenY - mouseDownPoint.y)) / preciseFactor);
},
_onDragEnd: function(event)
@@ -984,6 +996,7 @@ LayoutEditor.prototype = {
delete this._boundDragMove;
delete this._boundDragEnd;
delete this._draggedPropertyName;
+ delete this._preciseDrag;
event.preventDefault();
InspectorOverlayHost.endPropertyChange();
this._resetLabelCanvas();
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/LayoutEditor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698