Chromium Code Reviews| Index: Source/core/inspector/InspectorOverlayPage.html |
| diff --git a/Source/core/inspector/InspectorOverlayPage.html b/Source/core/inspector/InspectorOverlayPage.html |
| index f075a7f2e7f45f68f3b405c76fbf80811fc0109d..5a31060fc849830c127f63e74c44e385753b3ac3 100644 |
| --- a/Source/core/inspector/InspectorOverlayPage.html |
| +++ b/Source/core/inspector/InspectorOverlayPage.html |
| @@ -657,9 +657,45 @@ function createAnchor(anchorInfo) |
| anchorElement.className = "editor-anchor"; |
| anchorElement.style.left = anchorInfo.x - handleWidth + "px"; |
| anchorElement.style.top = anchorInfo.y - handleWidth + "px"; |
| + anchorElement.addEventListener("mousedown", onAnchorMouseDown.bind(null,anchorInfo)); |
|
dgozman
2015/06/25 10:10:39
nit: space before comma
sergeyv
2015/06/25 12:19:16
Done.
|
| return anchorElement; |
| } |
| +function calculateDelta(deltaVector, moveDelta) |
| +{ |
| + return (deltaVector.x * moveDelta.x + deltaVector.y * moveDelta.y) / Math.sqrt(deltaVector.x * deltaVector.x + moveDelta.x * moveDelta.y); |
|
dgozman
2015/06/25 10:10:39
/ (deltaVector.x * deltaVector.x + deltaVector.y *
sergeyv
2015/06/25 12:19:16
Done.
|
| +} |
| + |
| +function onAnchorMouseDown(anchorInfo, event) |
|
dgozman
2015/06/25 10:10:39
Copy buttons handling from UIUtils.
sergeyv
2015/06/25 12:19:16
Done.
|
| +{ |
| + event.preventDefault(); |
| + window.boundDragMove = onDragMove.bind(null, new Point(event.screenX, event.screenY), anchorInfo.deltaVector); |
| + document.addEventListener("mousemove", boundDragMove); |
| + document.addEventListener("mouseup", onDragEnd); |
| + InspectorOverlayHost.startPropertyChange(anchorInfo.propertyName); |
| +} |
| + |
| +function onDragMove(mouseDownPoint, deltaVector, event) |
| +{ |
| + event.preventDefault(); |
| + InspectorOverlayHost.changeProperty(calculateDelta(deltaVector, new Point(event.screenX - mouseDownPoint.x, event.screenY - mouseDownPoint.y))); |
| +} |
| + |
| +function onDragEnd(event) |
| +{ |
| + document.removeEventListener("mousemove", boundDragMove); |
| + delete window.boundDragMove; |
| + document.removeEventListener("mouseup", onDragEnd); |
| + event.preventDefault(); |
| + InspectorOverlayHost.endPropertyChange(); |
| +} |
| + |
| +function Point(x, y) |
| +{ |
| + this.x = x; |
| + this.y = y; |
| +} |
| + |
| window.addEventListener("DOMContentLoaded", onLoaded); |
| document.addEventListener("keydown", onDocumentKeyDown); |