diff options
author | nyamatongwe <nyamatongwe@gmail.com> | 2012-07-29 17:05:26 +1000 |
---|---|---|
committer | nyamatongwe <nyamatongwe@gmail.com> | 2012-07-29 17:05:26 +1000 |
commit | 455081f4b96fde8d552bdf8fa772f9957f65c8ed (patch) | |
tree | b62cdccd03b24edd9d3d2b87e5d42989c815734f | |
parent | a159a1c45644957fc14425937870f82a88569c31 (diff) | |
download | scintilla-mirror-455081f4b96fde8d552bdf8fa772f9957f65c8ed.tar.gz |
Decrease sensitivity of pinch-zoom. From Chinh Nguyen.
-rw-r--r-- | cocoa/ScintillaView.h | 2 | ||||
-rw-r--r-- | cocoa/ScintillaView.mm | 19 | ||||
-rw-r--r-- | doc/ScintillaHistory.html | 1 |
3 files changed, 15 insertions, 7 deletions
diff --git a/cocoa/ScintillaView.h b/cocoa/ScintillaView.h index bcbd1eea0..638001efd 100644 --- a/cocoa/ScintillaView.h +++ b/cocoa/ScintillaView.h @@ -62,6 +62,8 @@ extern NSString *SCIUpdateUINotification; NSScroller* mHorizontalScroller; NSScroller* mVerticalScroller; + CGFloat zoomDelta; + // Area to display additional controls (e.g. zoom info, caret position, status info). NSView <InfoBarCommunicator>* mInfoBar; BOOL mInfoBarAtTop; diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index 3cdc612c7..68290f74d 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -643,16 +643,21 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI"; - (void) magnifyWithEvent: (NSEvent *) event { #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 - 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]; + zoomDelta += event.magnification * 10.0; + + if (fabsf(zoomDelta)>=1.0) { + long zoomFactor = [self getGeneralProperty: SCI_GETZOOM] + zoomDelta; + [self setGeneralProperty: SCI_SETZOOM parameter: zoomFactor value:0]; + zoomDelta = 0.0; + } #endif } +- (void) beginGestureWithEvent: (NSEvent *) event +{ + zoomDelta = 0.0; +} + //-------------------------------------------------------------------------------------------------- /** diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 49aaff9dc..fe4bc838c 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -409,6 +409,7 @@ <td>Denis Shelomovskij</td> <td>darmar</td> <td>John Vella</td> + <td>Chinh Nguyen</td> </tr> </table> <p> |