vektah / CodeGlance

Intelij IDEA plugin for displaying a code mini-map similar to the one found in Sublime
BSD 2-Clause "Simplified" License
1.06k stars 104 forks source link

Click behavior changed #187

Open a1tus opened 7 years ago

a1tus commented 7 years ago

Hello. It seems that click behavior has changed recently but I'm not sure if it was affected by CodeGlance update or by platform itself.

If I try to drag highlighted area (mousedown) it instantly jumps to the cursor position. It's inconsistent with scrollbar behavior (we can click on it or drag from any position and it would not move until mouse moves). I'm pretty sure that it didn't act like that in past.

vektah commented 7 years ago

It was caused by https://github.com/Vektah/CodeGlance/commit/0d76bb9fdb1bdebcba825d1d56d43b0298d1d967 which fixed a bunch of long standing bugs and generally made things easier to reason about.

It's a little different from a scroll bar, and I don't really want to maintain two code paths through the scrolling logic, but I'll explain what the current behavior is because I think its quite useful.

From the outline you can see the structure of your code (unlike a scroll bar), if you click on something codeglance will scroll to put the thing you clicked on in the center of your screen. Very useful for jumping around quickly and leverages the strengths CodeGlance but its different and takes a little getting used to.

Dragging comes automatically out of this click behavior, the area under your mouse is whats visible in the editor. Click always used to be the same, but drag had two different implementations. One that does what it does now and one that acted more "normal".

Unless there are a bunch of people that really want this, I doubt I will re implement it.

Give it a try, you might like it.

a1tus commented 7 years ago

Thanks for the explanation. I've decided to create an issue to ensure that it's not a regression. I'm quite used to it already.

douglascayers commented 7 years ago

Hi @Vektah,

Thanks for this plugin; coming from SublimeText3 to IntelliJ I was surprised this wasn't out-of-the-box.

You can put me in the same camp as @a1tus who prefer that when I mouseclick in the highlighted region that represents my current editor's view to not immediately scroll until I drag my mouse.

If I mouseclick outside of the rectangle that represents my current editor's view I would expect the plugin to immediately scroll to that posision.

Is it possible for the plugin to know when we do mouseclick in the sidebar if the click occurred inside or outside of the currently viewed region? If it could then on detection that click occurred inside the region then do nothing?

I won't presume to think this is necessarily a simple task, from your earlier comment doesn't sound like an easy ask, but would be most appreciated!

Thanks,

Doug

douglascayers commented 7 years ago

I think we're talking about Scrollbar.kt#L95 where when the mouseclick event occurs, if we could determine if that occurred inside the rectangle region that represent the editor's current view then do nothing, else scroll.

illmillrig commented 6 years ago

Hi, I prefer the previous behavior. Thanks!