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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js

Issue 1995123002: Revert of DevTools: Add inertia to flamechart dragging. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/devtools/front_end/ui_lazy/FlameChart.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698