Index: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js |
index 41fed7a70e127907510fd9f782b7e3c5ec5c3109..cbe69e3c758bfc10100bda4ce8c597f1c6107c45 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js |
+++ b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js |
@@ -197,80 +197,6 @@ |
} |
/** |
- * @param {!Element} element |
- * @param {function(number, number, !MouseEvent): boolean} elementDragStart |
- * @param {function(number, number)} elementDrag |
- * @param {function(number, number)} elementDragEnd |
- * @param {string} cursor |
- * @param {?string=} hoverCursor |
- * @param {number=} startDelay |
- * @param {number=} friction |
- */ |
-WebInspector.installInertialDragHandle = function(element, elementDragStart, elementDrag, elementDragEnd, cursor, hoverCursor, startDelay, friction) |
-{ |
- WebInspector.installDragHandle(element, drag.bind(null, elementDragStart), drag.bind(null, elementDrag), dragEnd, cursor, hoverCursor, startDelay); |
- if (typeof friction !== "number") |
- friction = 50; |
- var lastX; |
- var lastY; |
- var lastTime; |
- var velocityX; |
- var velocityY; |
- var holding = false; |
- |
- /** |
- * @param {function(number, number, !MouseEvent): boolean} callback |
- * @param {!MouseEvent} event |
- * @return {boolean} |
- */ |
- function drag(callback, event) |
- { |
- lastTime = window.performance.now(); |
- lastX = event.pageX; |
- lastY = event.pageY; |
- holding = true; |
- return callback(lastX, lastY, event); |
- } |
- |
- /** |
- * @param {!MouseEvent} event |
- */ |
- function dragEnd(event) |
- { |
- var now = window.performance.now(); |
- var maxVelocity = 4; // 4px per millisecond. |
- var duration = now - lastTime || 1; |
- velocityX = Number.constrain((event.pageX - lastX) / duration, -maxVelocity, maxVelocity); |
- velocityY = Number.constrain((event.pageY - lastY) / duration, -maxVelocity, maxVelocity); |
- lastX = event.pageX; |
- lastY = event.pageY; |
- lastTime = now; |
- holding = false; |
- elementDrag(lastX, lastY); |
- element.window().requestAnimationFrame(animationStep); |
- } |
- |
- function animationStep() |
- { |
- var v2 = velocityX * velocityX + velocityY * velocityY; |
- if (v2 < 0.001 || holding) { |
- elementDragEnd(lastX, lastY); |
- return; |
- } |
- var now = window.performance.now(); |
- var duration = now - lastTime || 1; |
- element.window().requestAnimationFrame(animationStep); |
- lastTime = now; |
- lastX += velocityX * duration; |
- lastY += velocityY * duration; |
- var k = Math.pow(1 / (1 + friction), duration / 1000); |
- velocityX *= k; |
- velocityY *= k; |
- elementDrag(lastX, lastY); |
- } |
-} |
- |
-/** |
* @constructor |
* @param {!Document} document |
* @param {boolean=} dimmed |