From dfca9098862bd6594fe0b5479eb455de8d766a97 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 1 Mar 2012 08:54:02 +1100 Subject: Enable basic pinch zoom. From Matthew Brush. --- cocoa/ScintillaView.mm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index 0659eb2c2..2a3546b7b 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -637,6 +637,22 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI"; //-------------------------------------------------------------------------------------------------- +/** + * Receives zoom messages, for example when a "pinch zoom" is performed on the trackpad. + */ +- (void) magnifyWithEvent: (NSEvent *) event +{ + CGFloat z = [event magnification]; + + // Zoom out or in 1pt depending on sign of magnification event value (0.0 = no change) + if (z <= 0.0) + [ScintillaView directCall: self message: SCI_ZOOMOUT wParam: 0 lParam: 0]; + else if (z >= 0.0) + [ScintillaView directCall: self message: SCI_ZOOMIN wParam: 0 lParam: 0]; +} + +//-------------------------------------------------------------------------------------------------- + /** * Sends a new notification of the given type to the default notification center. */ -- cgit v1.2.3