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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 181723006: Handle mac trackpad zoom via GesturePinch events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jdduke CR feedback and fix win build errors Created 6 years, 9 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
Index: chrome/browser/ui/cocoa/browser_window_controller.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 2a75efd9d422d64b9830dd486d7b81344a1a5f7e..53a1a2603e19faef91d8ec0434b4b6e06b350570 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -1868,41 +1868,6 @@ enum {
}
}
-// Called repeatedly during a pinch gesture, with incremental change values.
-- (void)magnifyWithEvent:(NSEvent*)event {
- // The deltaZ difference necessary to trigger a zoom action. Derived from
- // experimentation to find a value that feels reasonable.
- const float kZoomStepValue = 0.6;
-
- // Find the (absolute) thresholds on either side of the current zoom factor,
- // then convert those to actual numbers to trigger a zoom in or out.
- // This logic deliberately makes the range around the starting zoom value for
- // the gesture twice as large as the other ranges (i.e., the notches are at
- // ..., -3*step, -2*step, -step, step, 2*step, 3*step, ... but not at 0)
- // so that it's easier to get back to your starting point than it is to
- // overshoot.
- float nextStep = (abs(currentZoomStepDelta_) + 1) * kZoomStepValue;
- float backStep = abs(currentZoomStepDelta_) * kZoomStepValue;
- float zoomInThreshold = (currentZoomStepDelta_ >= 0) ? nextStep : -backStep;
- float zoomOutThreshold = (currentZoomStepDelta_ <= 0) ? -nextStep : backStep;
-
- unsigned int command = 0;
- totalMagnifyGestureAmount_ += [event magnification];
- if (totalMagnifyGestureAmount_ > zoomInThreshold) {
- command = IDC_ZOOM_PLUS;
- } else if (totalMagnifyGestureAmount_ < zoomOutThreshold) {
- command = IDC_ZOOM_MINUS;
- }
-
- if (command && chrome::IsCommandEnabled(browser_.get(), command)) {
- currentZoomStepDelta_ += (command == IDC_ZOOM_PLUS) ? 1 : -1;
- chrome::ExecuteCommandWithDisposition(
- browser_.get(),
- command,
- ui::WindowOpenDispositionFromNSEvent(event));
- }
-}
-
// Delegate method called when window is resized.
- (void)windowDidResize:(NSNotification*)notification {
[self saveWindowPositionIfNeeded];

Powered by Google App Engine
This is Rietveld 408576698