Zooming-in using Fit-Rectangle #132

Open
ghali opened this Issue Apr 11, 2017 · 5 comments

Comments

Projects
None yet
3 participants
@ghali

ghali commented Apr 11, 2017

Ipe's UI offers three methods for rapid zooming in/out:

  • '\' Fit page
  • '=' Fit objects
  • '@' Fit selection

It would be nice if a fourth option

  • 'f' Fit rectangle

is added, with a default shortcut (such as the currently unused 'f') that is easily accessible with the left hand.

It would work like this: Once the option is selected, any rectangular region the user draws is maximized and centered in the current canvas. The user can then zoom out again with \, =, or @.

Those using Ipe with a mouse and a scroll wheel can already zoom in to draw something with precision by using 'x' (pan here) followed by zooming using the scroll wheel, but no matter how the parameters are set for the trackpad—at least for Apple's ultra-high resolution trackpad—this kind of interaction doesn't work. OS X generates scroll-wheel-like events (mouse keys 4/5) with two-finger vertical swipes. It may be that a mapping function specific to Apple's trackpad needs to be implemented, but "fit rectangle" is simpler and usable on any OS and input device.

One can of course select a few objects and then press '@' (fit selection), but almost always that requires a second step of zooming out just a little. "Fit selection" also can't be used when one wants to draw something in an area adjacent to, not on top of, objects that are already drawn.

@otfried

This comment has been minimized.

Show comment
Hide comment
@otfried

otfried Apr 12, 2017

Owner

Scrolling on trackpads is somewhat broken, because I didn't have a trackpad when I worked on the Cocoa version of Ipe last year.

Have you tried changing the setting of prefs.wheel_zoom_factor and prefs.wheel_other_factor?

If you run Ipe from the command line, you will see lines of the form:

wheel_zoom	1.0	true

For your trackpad, the second parameter should be true (it's false for some external mice under OSX). Then the zoom factor is adjusted by prefs.wheel_zoom_factor to the power delta, where delta is the number reported by the trackpad (the first parameter in the debug output).

How large are your delta values? You may need to make the wheel_zoom_factor much smaller.

(Nothing against your suggestion, but the trackpad also needs to be fixed.)

Owner

otfried commented Apr 12, 2017

Scrolling on trackpads is somewhat broken, because I didn't have a trackpad when I worked on the Cocoa version of Ipe last year.

Have you tried changing the setting of prefs.wheel_zoom_factor and prefs.wheel_other_factor?

If you run Ipe from the command line, you will see lines of the form:

wheel_zoom	1.0	true

For your trackpad, the second parameter should be true (it's false for some external mice under OSX). Then the zoom factor is adjusted by prefs.wheel_zoom_factor to the power delta, where delta is the number reported by the trackpad (the first parameter in the debug output).

How large are your delta values? You may need to make the wheel_zoom_factor much smaller.

(Nothing against your suggestion, but the trackpad also needs to be fixed.)

@ghali

This comment has been minimized.

Show comment
Hide comment
@ghali

ghali Apr 12, 2017

On stock-release 7.2.7 (after mv ~/.ipe ~/.ipe--hide), it takes about 4-5mm of swiping on the trackpad to go from the top to the bottom of the (default) zoom range.

If I modify

/Applications/Ipe.app/Contents/Resources/lua/prefs.lua

to have either

if config.toolkit == "cocoa" then
  prefs.wheel_zoom_factor = 100.1
  prefs.wheel_other_factor = 100.3 -- used on some external mice
else
  prefs.wheel_zoom_factor = 100.3
end

or

if config.toolkit == "cocoa" then
  prefs.wheel_zoom_factor = 0.011
  prefs.wheel_other_factor = 0.013 -- used on some external mice
else
  prefs.wheel_zoom_factor = 0.013
end

the top to bottom zoom-flight takes barely 1 mm. (The initial values are 1.1 and 1.3.)
I'm changing both sides of the if/else to be certain, but it appears the if-side is indeed taken.

If you run Ipe from the command line, you will see lines of the form: wheel_zoom 1.0 true

I don't understand. Running Ipe from the command line

~/> which ipe
/Applications/Ipe.app/Contents/MacOS/ipe

produces no output in the Terminal.

ghali commented Apr 12, 2017

On stock-release 7.2.7 (after mv ~/.ipe ~/.ipe--hide), it takes about 4-5mm of swiping on the trackpad to go from the top to the bottom of the (default) zoom range.

If I modify

/Applications/Ipe.app/Contents/Resources/lua/prefs.lua

to have either

if config.toolkit == "cocoa" then
  prefs.wheel_zoom_factor = 100.1
  prefs.wheel_other_factor = 100.3 -- used on some external mice
else
  prefs.wheel_zoom_factor = 100.3
end

or

if config.toolkit == "cocoa" then
  prefs.wheel_zoom_factor = 0.011
  prefs.wheel_other_factor = 0.013 -- used on some external mice
else
  prefs.wheel_zoom_factor = 0.013
end

the top to bottom zoom-flight takes barely 1 mm. (The initial values are 1.1 and 1.3.)
I'm changing both sides of the if/else to be certain, but it appears the if-side is indeed taken.

If you run Ipe from the command line, you will see lines of the form: wheel_zoom 1.0 true

I don't understand. Running Ipe from the command line

~/> which ipe
/Applications/Ipe.app/Contents/MacOS/ipe

produces no output in the Terminal.

@otfried

This comment has been minimized.

Show comment
Hide comment
@otfried

otfried Apr 13, 2017

Owner

The wheel_zoom_factor is a multiplication factor to magnify the zoom. So it must be larger than 1, and the closer to 1 it gets the smaller the change. Both of your attempts are way off - try 1.01, and if even that is too fast, 1.001

Owner

otfried commented Apr 13, 2017

The wheel_zoom_factor is a multiplication factor to magnify the zoom. So it must be larger than 1, and the closer to 1 it gets the smaller the change. Both of your attempts are way off - try 1.01, and if even that is too fast, 1.001

@ghali

This comment has been minimized.

Show comment
Hide comment
@ghali

ghali Apr 13, 2017

1.01 works perfectly. Thanks!

For reference, one needs to add the line

prefs.wheel_zoom_factor = 1.01

to the file

~/.ipe/ipelets/myconfig.lua

The filename (myconfig) apparently doesn't matter.

ghali commented Apr 13, 2017

1.01 works perfectly. Thanks!

For reference, one needs to add the line

prefs.wheel_zoom_factor = 1.01

to the file

~/.ipe/ipelets/myconfig.lua

The filename (myconfig) apparently doesn't matter.

@RoyiAvital

This comment has been minimized.

Show comment
Hide comment
@RoyiAvital

RoyiAvital Apr 21, 2017

@otfried , Why isn't the project on GitHub?
Namely all the code ans issues under the IPE repository?

Just a curiosity.

Thank You.

@otfried , Why isn't the project on GitHub?
Namely all the code ans issues under the IPE repository?

Just a curiosity.

Thank You.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment