stefanceriu / SCXcodeMiniMap

Sublime Text like Minimap for Xcode
GNU General Public License v3.0
1.03k stars 87 forks source link

Unwanted horizontal scrolling #41

Closed mike-lischke closed 9 years ago

mike-lischke commented 9 years ago

When clicking in the minimap to go to a specific location (or when dragging within the minimap) often the editor is not only vertcially scrolled but also horizontally, which is annoying. The best solution is probably to have no horizontal scrolling at all (and hence keep what was last set by the user). Thanks.

stefanceriu commented 9 years ago

Thanks for reporting this, it was definitely not my intention to have it scroll horizontally.

mike-lischke commented 9 years ago

That was fast Stefan, thanks. But I think that's not the right solution. Atm the scrolling is so weird, it's practically unusuable when using the minimap for scrolling (even though the horizontal scrolling is fixed).

1) Scrolling with a wheel mouse scrolls the minimap horizontally. 2) Clicking in the minimap now only scrolls one page it seems, not to the position where I clicked on. It's a bit hard to say, because that constant scrolling of the minimap is so irritating. 3) Dragging with the mouse (clicking somewhere in the minimap + holding the left mouse button, then move the mouse) moves the selection in a weird way. It looks as if it works delayed, especially when I change the direction (from up to down or vice versa) it still scrolls a while in the old direction. Very weird.

I believe fixing the minimap scrolling and then centering the selection area around the position where clicked (or dragged) would solve all these issues. Otherwise that plugin is a very nice addition and I'm thankful you created it.

stefanceriu commented 9 years ago

Okay, I think I have a hardware problem, let me get a proper mouse and get back to you on this :)

stefanceriu commented 9 years ago

Okay, so I changed a couple of things and I think you'll find it allot better now. What I did was: 1) Disable horizontal scrolling from the minimap 2) Link the horizontal scrolling of the main editor to the minimap 3) Switched the way I center the selection view when the user clicks on the minimap

Can you please give it another go and let me know what you think ?

mike-lischke commented 9 years ago

1 and 2 are fine now. However point 3 is still a problem. When I click on the minimap the gray rect only moves a little (in a reasonable large file) instead of moving to the actual mouse position. Not even the part that was under the mouse when I clicked is scrolled into view (it only moves partially down, but is still not covered by the preview area). Dragging with the mouse still works only erratic. There seems to be no logic behind it. I can easily make the editor scrolling down while dragging the mouse up. Seems to be a function of the distance between mouse and the preview rect, and on which side (above or below the preview rect) is the mouse. Very weird.

stefanceriu commented 9 years ago

It seems that the problem is related to non-contiguous layouts and the layout manager not knowing the exact frames for all the glyphs. As far as I can tell this is a problem only on large source files and the only way to get it working properly is going through the whole file once, allowing both layout managers to calculate the full layouts. Unfortunately I'm not really sure how to fix the problem so any ideas are more than welcome.

stefanceriu commented 9 years ago

Closing in favor of https://github.com/stefanceriu/SCXcodeMiniMap/issues/52