atom-archive / xray

An experimental next-generation Electron-based text editor
MIT License
8.48k stars 235 forks source link

Add mouse "click and drag" to select text #107

Open pranaygp opened 6 years ago

pranaygp commented 6 years ago

I think we can make it way more performant by debouncing "SelectTo" dispatches since we don't need to run that logic to find row/col everytime, however that'll come at the cost of not being as responsive.

What do you think about implementing some sort or "rough estimate" to determin row/column that's faster, and we can debounce an accurate measurement to make everything faster and responsive.

gif

pranaygp commented 6 years ago

I have left to implement alt-click to add a new cursor and use the drag only on that "current" cursor. I ~will do~ did that in a different PR (#108). What else is left to implement on the "multi-cursor"/selection front so we can tick the Further optimize multi-cursor editing checkbox off the README?

pranaygp commented 6 years ago

@as-cii I agree, that does seem a lot more intuitive. Can we still merge this (and possibly #108) while I begin to implement autoscrollOnMouseDrag in a new PR that build on top of these two. This way I can build and test the function on top of this AND #108 to make sure it works as smoothly as I'd like with multi cursor selections too 😄

as-cii commented 6 years ago

I'd prefer merging clean and well-working units into master and, if I understand correctly, #108 is somewhat orthogonal to the changes proposed in this pull request. How would you feel about changing this and then adapting #108 if necessary? I am not entirely opposed to it, but it'd be nice to have exactly what we want on master before going ahead and merging.

pranaygp commented 6 years ago

Ah. Sure. Ideally, the changes from #108 don't affect the scrolling behaviour by much so making any changes necessary isn't too much of a hassle.

I'll update this and ping you @as-cii 😄

as-cii commented 6 years ago

Awesome, thanks for your hard work on this @pranaygp. ⚡️

as-cii commented 6 years ago

Hey @pranaygp, sorry for the late follow-up. I noticed you pushed a commit since the last time I commented on the issue. Do you think this is ready to review now?

pranaygp commented 6 years ago

@as-cii I haven't touched the codebase since that commit but iirc, it implements the edge scrolling behavior based on Atom as you recommended. However, the experience seems rather laggy.

I'd love for you to try it out and perhaps recommended places I can look at improving to make it smoother