OS X horizontal scrolling, pinch zoom

135 views
Skip to first unread message

Neil Hodgson

unread,
Jul 24, 2012, 1:04:11 AM7/24/12
to scintilla...@googlegroups.com
An issue came up off-list with horizontal scrolling on OS X: currently you can use the mouse wheel (or touch area) to scroll right beyond the scroll range and the scroll bar shows no indication of this. You then have to scroll back with no visual indication of what is happening.

The scroll range could be extended in this case and the 'knob' shortened to indicate the expanded range. Then scrolling back to the left would move the shortened knob.

However, its unlikely the user wants to extend the scroll range when using this gesture, so another approach is to limit wheel scrolling to the already established width. Are there any other points of view?

One user doesn't like accidentally performing pinch zoom and would like an option to disable it or make it less sensitive.

Neil

Mike Lischke

unread,
Jul 24, 2012, 3:23:13 AM7/24/12
to scintilla...@googlegroups.com
Hey Neil,

> An issue came up off-list with horizontal scrolling on OS X: currently you can use the mouse wheel (or touch area) to scroll right beyond the scroll range and the scroll bar shows no indication of this. You then have to scroll back with no visual indication of what is happening.

This code was written without touch devices in mind and hence doesn't properly handle those events.

>
> The scroll range could be extended in this case and the 'knob' shortened to indicate the expanded range. Then scrolling back to the left would move the shortened knob.
>
> However, its unlikely the user wants to extend the scroll range when using this gesture, so another approach is to limit wheel scrolling to the already established width. Are there any other points of view?

Especially touch scrolling should behave like in other controls of this kind (momentum scrolling at the extremes). Not sure how this can be done well with the current horizontal scroll implementation in scintilla.

> One user doesn't like accidentally performing pinch zoom and would like an option to disable it or make it less sensitive.


I'm not aware of a pinch-zoom implementation. Must be a conversion to a different mouse related action (e.g. Ctrl+Cmd+Wheel changes the zoom factor).

Mike
--
www.soft-gems.net

Neil Hodgson

unread,
Jul 24, 2012, 9:14:44 PM7/24/12
to scintilla...@googlegroups.com
Mike Lischke:

Especially touch scrolling should behave like in other controls of this kind (momentum scrolling at the extremes). Not sure how this can be done well with the current horizontal scroll implementation in scintilla.

   It would be much work either through reimplementing momentum and elasticity or through adapting Scintilla to work in an NSScrollView where that behaviour is free.

I'm not aware of a pinch-zoom implementation. Must be a conversion to a different mouse related action (e.g. Ctrl+Cmd+Wheel changes the zoom factor).

   The pinch zoom implementation was contributed by Matthew Brush:
http://scintilla.hg.sourceforge.net/hgweb/scintilla/scintilla/rev/3a7899a248a8

   Neil

Matthew Brush

unread,
Jul 24, 2012, 9:26:21 PM7/24/12
to scintilla...@googlegroups.com
On 12-07-24 06:14 PM, Neil Hodgson wrote:
> Mike Lischke:
>
>> I'm not aware of a pinch-zoom implementation. Must be a conversion to
>> a different mouse related action (e.g. Ctrl+Cmd+Wheel changes the
>> zoom factor).
>
> The pinch zoom implementation was contributed by Matthew Brush:
> http://scintilla.hg.sourceforge.net/hgweb/scintilla/scintilla/rev/3a7899a248a8
>
>

Also of interest:
https://groups.google.com/forum/?fromgroups#!topic/scintilla-interest/y4Yg62F1blg

Cheers,
Matthew Brush

Chinh Nguyen

unread,
Jul 26, 2012, 11:37:37 AM7/26/12
to scintilla...@googlegroups.com, nyama...@me.com
Neil Hodgson:

   One user doesn't like accidentally performing pinch zoom and would like an option to disable it or make it less sensitive.

 
Funny, I was thinking pinch zoom was too sensitive just today.  I changed the behavior and was going to suggest my change.

- (void) magnifyWithEvent: (NSEvent *) event
{
  zoomDelta += event.magnification * 10.;

  if (fabsf(zoomDelta)>=1.) {
    long zoomFactor = [self getGeneralProperty: SCI_GETZOOM] + zoomDelta;
    [self setGeneralProperty: SCI_SETZOOM parameter: zoomFactor value:0];
    zoomDelta = 0.;
  }     
}

- (void) beginGestureWithEvent: (NSEvent *) event
{
  zoomDelta = 0.;
}

zoomDelta is declared as a CGFloat in the @interface.

Neil Hodgson

unread,
Jul 27, 2012, 12:32:06 AM7/27/12
to scintilla...@googlegroups.com
Chinh Nguyen:

> zoomDelta += event.magnification * 10.;
>
> if (fabsf(zoomDelta)>=1.) {
> long zoomFactor = [self getGeneralProperty: SCI_GETZOOM] + zoomDelta;
> [self setGeneralProperty: SCI_SETZOOM parameter: zoomFactor value:0];

Zoom was originally implemented when fonts were only available in integral sizes. With fractional sizes now supported on some platforms, including Cocoa, adding a fractional zoom level may be an improvement and allow for better control with pinching. My also be better to make the zoom factor multiply the font sizes: its currently added.

Neil

Neil Hodgson

unread,
Jul 29, 2012, 3:06:21 AM7/29/12
to scintilla...@googlegroups.com
Chinh Nguyen:

> - (void) magnifyWithEvent: (NSEvent *) event
> {
> zoomDelta += event.magnification * 10.;
> …

OK, committed.

Neil

Reply all
Reply to author
Forward
0 new messages