Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!-- | 1 <!-- |
| 2 Copyright (C) 2012 Google Inc. All rights reserved. | 2 Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 | 3 |
| 4 Redistribution and use in source and binary forms, with or without | 4 Redistribution and use in source and binary forms, with or without |
| 5 modification, are permitted provided that the following conditions | 5 modification, are permitted provided that the following conditions |
| 6 are met: | 6 are met: |
| 7 | 7 |
| 8 1. Redistributions of source code must retain the above copyright | 8 1. Redistributions of source code must retain the above copyright |
| 9 notice, this list of conditions and the following disclaimer. | 9 notice, this list of conditions and the following disclaimer. |
| 10 2. Redistributions in binary form must reproduce the above copyright | 10 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 650 context.beginPath(); | 650 context.beginPath(); |
| 651 context.arc(anchorInfo.x, anchorInfo.y, handleWidth, 0, 2 * Math.PI); | 651 context.arc(anchorInfo.x, anchorInfo.y, handleWidth, 0, 2 * Math.PI); |
| 652 context.fill(); | 652 context.fill(); |
| 653 context.stroke(); | 653 context.stroke(); |
| 654 context.restore(); | 654 context.restore(); |
| 655 | 655 |
| 656 var anchorElement = document.createElement("div"); | 656 var anchorElement = document.createElement("div"); |
| 657 anchorElement.className = "editor-anchor"; | 657 anchorElement.className = "editor-anchor"; |
| 658 anchorElement.style.left = anchorInfo.x - handleWidth + "px"; | 658 anchorElement.style.left = anchorInfo.x - handleWidth + "px"; |
| 659 anchorElement.style.top = anchorInfo.y - handleWidth + "px"; | 659 anchorElement.style.top = anchorInfo.y - handleWidth + "px"; |
| 660 anchorElement.addEventListener("mousedown", onAnchorMouseDown.bind(null,anch orInfo)); | |
|
dgozman
2015/06/25 10:10:39
nit: space before comma
sergeyv
2015/06/25 12:19:16
Done.
| |
| 660 return anchorElement; | 661 return anchorElement; |
| 661 } | 662 } |
| 662 | 663 |
| 664 function calculateDelta(deltaVector, moveDelta) | |
| 665 { | |
| 666 return (deltaVector.x * moveDelta.x + deltaVector.y * moveDelta.y) / Math.sq rt(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.
| |
| 667 } | |
| 668 | |
| 669 function onAnchorMouseDown(anchorInfo, event) | |
|
dgozman
2015/06/25 10:10:39
Copy buttons handling from UIUtils.
sergeyv
2015/06/25 12:19:16
Done.
| |
| 670 { | |
| 671 event.preventDefault(); | |
| 672 window.boundDragMove = onDragMove.bind(null, new Point(event.screenX, event. screenY), anchorInfo.deltaVector); | |
| 673 document.addEventListener("mousemove", boundDragMove); | |
| 674 document.addEventListener("mouseup", onDragEnd); | |
| 675 InspectorOverlayHost.startPropertyChange(anchorInfo.propertyName); | |
| 676 } | |
| 677 | |
| 678 function onDragMove(mouseDownPoint, deltaVector, event) | |
| 679 { | |
| 680 event.preventDefault(); | |
| 681 InspectorOverlayHost.changeProperty(calculateDelta(deltaVector, new Point(ev ent.screenX - mouseDownPoint.x, event.screenY - mouseDownPoint.y))); | |
| 682 } | |
| 683 | |
| 684 function onDragEnd(event) | |
| 685 { | |
| 686 document.removeEventListener("mousemove", boundDragMove); | |
| 687 delete window.boundDragMove; | |
| 688 document.removeEventListener("mouseup", onDragEnd); | |
| 689 event.preventDefault(); | |
| 690 InspectorOverlayHost.endPropertyChange(); | |
| 691 } | |
| 692 | |
| 693 function Point(x, y) | |
| 694 { | |
| 695 this.x = x; | |
| 696 this.y = y; | |
| 697 } | |
| 698 | |
| 663 window.addEventListener("DOMContentLoaded", onLoaded); | 699 window.addEventListener("DOMContentLoaded", onLoaded); |
| 664 document.addEventListener("keydown", onDocumentKeyDown); | 700 document.addEventListener("keydown", onDocumentKeyDown); |
| 665 | 701 |
| 666 </script> | 702 </script> |
| 667 </head> | 703 </head> |
| 668 <body class="fill"> | 704 <body class="fill"> |
| 669 <div class="controls-line"> | 705 <div class="controls-line"> |
| 670 <div class="message-box"><div id="paused-in-debugger"></div></div> | 706 <div class="message-box"><div id="paused-in-debugger"></div></div> |
| 671 <div class="button" id="resume-button" title="Resume script execution (F8)." ><div class="glyph"></div></div> | 707 <div class="button" id="resume-button" title="Resume script execution (F8)." ><div class="glyph"></div></div> |
| 672 <div class="button" id="step-over-button" title="Step over next function cal l (F10)."><div class="glyph"></div></div> | 708 <div class="button" id="step-over-button" title="Step over next function cal l (F10)."><div class="glyph"></div></div> |
| 673 </div> | 709 </div> |
| 674 </body> | 710 </body> |
| 675 <canvas id="canvas" class="fill"></canvas> | 711 <canvas id="canvas" class="fill"></canvas> |
| 676 <div id="element-title"> | 712 <div id="element-title"> |
| 677 <span id="tag-name"></span><span id="node-id"></span><span id="class-name"></s pan> | 713 <span id="tag-name"></span><span id="node-id"></span><span id="class-name"></s pan> |
| 678 <span id="node-width"></span><span class="px">px</span><span class="px"> × ; </span><span id="node-height"></span><span class="px">px</span> | 714 <span id="node-width"></span><span class="px">px</span><span class="px"> × ; </span><span id="node-height"></span><span class="px">px</span> |
| 679 </div> | 715 </div> |
| 680 <div id="editor" class="fill"></div> | 716 <div id="editor" class="fill"></div> |
| 681 <div id="log"></div> | 717 <div id="log"></div> |
| 682 </html> | 718 </html> |
| OLD | NEW |