New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make center divider adjustable #403 #418
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the comment. Right now it cannot be dragged very fast. The cursor need to stay in the black bar for the dragging to work. Future plan: finding a way to allow more responsive dragging or allow dragging despite cursor not in the black bar. |
hmm... we need something that works for all users when used as per normal user expectations. Can look for an alternative that doesn't have that restriction? |
one way to do it is to do it relative to the global div (more specifically |
yeah I thought of someting similar just now, using another div wrapper but turns out there is |
I will work on it on Sunday night, GMT+2 (currently in Israel on NOC). Unavailable until then. I apologize for the absence. |
Fixed the issue above. Now the dragging is more intuitive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -13,7 +13,7 @@ function toggleNext(ele) { | |||
} | |||
|
|||
parent.className = classes.join(' '); | |||
}; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for lines that are irrelevant to your PR, please avoid modifying them as it may cause unnecessary conflict and also deviates from the purpose of your PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comes from ESLint
7fe7e5b
to
5564678
Compare
5564678
to
9e7d245
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using the flex prop is a smart trick 👍
it will be best if are could work on the lag, maybe the double rendering on both .tab-resize
and app-wrapper
might be the cause, do give a more detailed look.
frontend/src/index.jade
Outdated
@@ -13,7 +13,7 @@ html | |||
script(src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js") | |||
body | |||
div#app | |||
#app-wrapper(v-if="userUpdated") | |||
#app-wrapper(v-if="userUpdated", v-on:mousemove="mouseMove", v-on:mouseup="deregisterMouseMove", v-bind:style="{ 'user-select': appWrapperUserSelect }") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha, newline pls, just break on commas
frontend/src/index.jade
Outdated
@@ -26,7 +26,8 @@ html | |||
strong RepoSense | |||
span on {{ creationDate }} | |||
|
|||
#tabs-wrapper(v-if="isTabActive") | |||
#tabs-wrapper(v-if="isTabActive", v-bind:style="{ flex: `0 0 ${flexWidth * 100}%` }") | |||
.tab-resize(v-on:mousedown="registerMouseMove", v-on:mousemove="mouseMove", v-on:mouseup="deregisterMouseMove") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same and why did you have to do it in two place tho? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I thought that without it, we can only register the mouse event outside of the resize bar
frontend/src/static/js/main.js
Outdated
window.innerWidth - (DRAG_BAR_WIDTH / 2) | ||
) / window.innerWidth; | ||
|
||
this.flexWidth = calculatedWidth; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just this.flexWidth = ...
, dun need set const then set again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you want to deal with the lag, you can do some event buffering mechanism, so that the heavy lifting at the front can be avoided.
Proposed commit message
|
sorry @emer7 , i just realized something: When I adjust the divider position, hiding the code panel and show it again, it resets to the middle position. Only when I interacts with the dashboard again, it goes back to the adjusted position. Can you look into it to see if we can let it maintain the adjusted position through out? |
Done, width now persists |
frontend/src/static/js/main.js
Outdated
mouseMove = throttledEvent(30, innerMouseMove); | ||
}; | ||
|
||
const deregisterMouseMove = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lint your code, migth not be able to do this, do window.deregisterMouseMove
instead, same above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is this pesky #514 that is going to go in, it will fail your code, so lint on local first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed const xxx = ...
to window.xxx = ...
but I don't lint everything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work @emer7 👍
Thanks to reviewers too, for shepherding this PR all this way 💯 |
Fix #403
This is implemented by constantly changing the inline style following cursor movement.
I avoid direct DOM manipulation.