| Index: Source/core/inspector/InspectorOverlayPage.html
|
| diff --git a/Source/core/inspector/InspectorOverlayPage.html b/Source/core/inspector/InspectorOverlayPage.html
|
| index 1ffa734b05b15182925ff12e3e58e639d2167124..1d6f0efb00d3b5b3c042836bb2559efc3f445f09 100644
|
| --- a/Source/core/inspector/InspectorOverlayPage.html
|
| +++ b/Source/core/inspector/InspectorOverlayPage.html
|
| @@ -846,7 +846,7 @@ function createAnchor(anchorInfo)
|
|
|
| function calculateDelta(deltaVector, moveDelta)
|
| {
|
| - return (deltaVector.x * moveDelta.x + deltaVector.y * moveDelta.y) / Math.sqrt(deltaVector.x * deltaVector.x + deltaVector.y * deltaVector.y);
|
| + return scalarProduct(deltaVector, moveDelta) / Math.sqrt(scalarProduct(deltaVector, deltaVector));
|
| }
|
|
|
| function onAnchorMouseDown(anchorInfo, event)
|
| @@ -874,6 +874,17 @@ function onDragMove(mouseDownPoint, deltaVector, event)
|
| InspectorOverlayHost.changeProperty(calculateDelta(deltaVector, new Point(event.screenX - mouseDownPoint.x, event.screenY - mouseDownPoint.y)));
|
| }
|
|
|
| +function onDragEnd(event)
|
| +{
|
| + document.removeEventListener("mousemove", boundDragMove);
|
| + delete window.boundDragMove;
|
| + delete window.draggedPropertyName;
|
| + document.removeEventListener("mouseup", onDragEnd);
|
| + event.preventDefault();
|
| + InspectorOverlayHost.endPropertyChange();
|
| + resetLabelCanvas();
|
| +}
|
| +
|
| function showLabel(anchorInfo, showLongDescription)
|
| {
|
| var context = labelsCanvas.getContext("2d");
|
| @@ -908,19 +919,11 @@ function showLabels(type, fullLabelName)
|
| selectedAnchorInfo = anchorInfo;
|
| }
|
|
|
| - if (selectedAnchorInfo)
|
| - showLabel(selectedAnchorInfo, true);
|
| -}
|
| + if (!selectedAnchorInfo)
|
| + return;
|
|
|
| -function onDragEnd(event)
|
| -{
|
| - document.removeEventListener("mousemove", boundDragMove);
|
| - delete window.boundDragMove;
|
| - delete window.draggedPropertyName;
|
| - document.removeEventListener("mouseup", onDragEnd);
|
| - event.preventDefault();
|
| - InspectorOverlayHost.endPropertyChange();
|
| - resetLabelCanvas();
|
| + showLabel(selectedAnchorInfo, true);
|
| + document.body.style.cursor = chooseAnchorPointer(selectedAnchorInfo.deltaVector);
|
| }
|
|
|
| function onAnchorMouseMove(anchorInfo)
|
| @@ -1072,6 +1075,30 @@ function resetLabelCanvas()
|
| {
|
| delete window.labelCanvasState;
|
| resetCanvas(labelsCanvas);
|
| + if (!window.draggedPropertyName && document.body.style.cursor)
|
| + document.body.style.cursor = "";
|
| +}
|
| +
|
| +function scalarProduct(v1, v2)
|
| +{
|
| + return v1.x * v2.x + v1.y * v2.y;
|
| +}
|
| +
|
| +var pointers = [ {name: "ns-resize", vector: new Point(0, -1)}, {name: "ew-resize", vector: new Point(-1, 0)},
|
| + {name: "ns-resize", vector: new Point(0, 1)}, {name: "ew-resize", vector: new Point(1, 0)}];
|
| +
|
| +function chooseAnchorPointer(direction)
|
| +{
|
| + var maxValue = scalarProduct(direction, pointers[0].vector);
|
| + var maxIndex = 0;
|
| + for (var i = 1; i < pointers.length; ++i) {
|
| + var currentValue = scalarProduct(direction, pointers[i].vector);
|
| + if (currentValue > maxValue) {
|
| + maxValue = currentValue;
|
| + maxIndex = i;
|
| + }
|
| + }
|
| + return pointers[maxIndex].name;
|
| }
|
|
|
| window.addEventListener("DOMContentLoaded", onLoaded);
|
|
|