-
-
Notifications
You must be signed in to change notification settings - Fork 423
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
mode/hint: Add hints-alignment-x slot #3226
Conversation
eee9db9
to
184ad5f
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.
@MaxGyver83 we need to account for the fact that the hints must be drawn within limits. See the case on the top right in the screenshot below. That can be handled via ps:max
.
I'm not sure how to do this. Lets say Should I correct the position afterwards (after calling UPDATE: Now I'm fixing the position of hint overlays in a second loop (after the hint elements were added to the DOM). |
184ad5f
to
996b8f0
Compare
@MaxGyver83 I'm coming back to this PR in a week. Thanks. |
@MaxGyver83 I think this is going in a good direction but the implementation is too cumbersome - the second loop seems inappropriate. In the same way that |
@aadcg :
This is why I let the renderer do the calculations and check (and adjust) the values afterwards (second loop). UPDATE: UPDATE2: |
@MaxGyver83 I've thought again about this and my conclusions seem to be aligned with yours. Given issue #3250, which impacts hint mode before this PR, it makes little sense to request from your PR that all hints must be fully drawn in viewport. They should be, however, partially visible. I believe that the PR meets this requirement, even if the added loop is deleted. I'm sorry that I have requested from your PR to meet a goal that we don't currently meet, as I was unaware of #3250. I suggest deleting the aforementioned loop and reviewing the code once again. Does that make sense? Thanks. |
Sounds good. I'll update this pull request. |
Done in commit 756bdd7. I have also removed the transform/translate part. This was only a workaround to set the hint's right edge/border position. I think it clearer to set the style.right position using Now, I check the position for a min and a max value: It should be >= 0 and not too close to the window border to make sure the hints are at least partly visible. I'm using now a magic number (25 px). This is probably better than nothing (until we have found a better solution).
This is still open. I tried this at first for the example you mentioned but without success. I guess I have to copy the element as argument to a new function and then return the modified element. Can I pass an element pointer/reference? |
@MaxGyver83, sorry for the late reply. With respect to the functionality itself, I think it's good enough. My suggestion is to improve the readability and maintainability of
You don't need to return the element if you're just interested in the side effects. (defun test (element) (setf (ps:@ element style top) "2px") nil) To check how it compiles to JS, pass it as an argument to function test(element) {
element.style.top = '2px';
return null;
}; Let me know if you're interested in giving it a try. Regardless, one of us can take over and finish this PR. |
Set the horizontal alignment of hints: On top/to the left/to the right of a link
7b1a359
to
6c432f3
Compare
Thank you!
I'll give it a try! (I have started with a rebase + squash.) |
@aadcg:
|
This pull request has been open for quite a while. If you want to get this merged quickly, it's no problem for me if you finish this PR. |
@MaxGyver83 the issue is that you're writing a regular CL function using parenscript syntax. The I'll take over and finish this PR in time for the next 3-series release. Thanks @MaxGyver83! |
Superseded by #3302. Thanks @MaxGyver83! |
Description
Add
hints-alignment-x
slot to allow placing the hint overlays to the left or the right of a link. Possible values::left
,:on-top
(current behavior, default),:right
.Fixes #3179.
Screenshots
:left
::on-top
::right
:Discussion
The left alignment is achieved by setting
transform: translate(-100%, 0);
. This translation is applied after ensuring thatstyle.left
is ≥ 0. This is why some hints may be not completely visible (likeAA
in the first screenshot). Any ideas how to fix? UPDATE: This is now fixed by checking the position of all hints in a loop after they were added to the DOM. AFAIU, the width of a hint overlay isn't known until then.Checklist:
Everything in this checklist is required for each PR. Please do not approve a PR that does not have all of these items.
:documentation
s written in the aforementioned style. (It's OK to skip the docstring for really trivial parts.)changelog.lisp
with my changes if it's anything user-facing (new features, important bug fix, compatibility breakage).migration.lisp
entry for all compatibility-breaking changes.(asdf:test-system :nyxt)
and(asdf:test-system :nyxt/gi-gtk)
) and they pass.