Skip to content
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

Enhancement: Popup positioning. #36

Closed
ghost opened this issue Apr 12, 2014 · 4 comments
Closed

Enhancement: Popup positioning. #36

ghost opened this issue Apr 12, 2014 · 4 comments

Comments

@ghost
Copy link

ghost commented Apr 12, 2014

Hi Tomas,
Thanks for adding the popup property. Would be possible to add an alignment or offset methods for that position?

Example use case: selecting a range of text. In some situations, it would make sense to have the pop up centered in the selected range horizontally, and maybe indented down a few lines vertically.. I am not sure how feasible it is to implement. but thought I'll make a suggestion.
Thanks,
Maher

@TomasMikula
Copy link
Member

Hi Maher,

it would be quite easy to support some user-settable offset. Currently, the popup is actually shifted 4px to the right of the caret so that the caret is not shadowed by the popup. The 4px are hard-coded, but could be changed to some user-settable value.

Alignment with respect to selection would be more complicated to implement, but is definitely something to consider.

@ghost
Copy link
Author

ghost commented Apr 13, 2014

If there is a way to translate character width and height to pixels then it
should be easy to align things.

Which brings me to suggest providing a pixel height and pixel length
properties for selected text or pixel height at caret position. Something
that allows me to control the location accurately. Not sure if I am making
sense ..
On Apr 13, 2014 2:24 PM, "TomasMikula" notifications@github.com wrote:

Hi Maher,

it would be quite easy to support some user-settable offset. Currently,
the popup is actually shifted 4px to the right of the caret so that the
caret is not shadowed by the popup. The 4px are hard-coded, but could be
changed to some user-settable value.

Alignment with respect to selection would be more complicated to
implement, but is definitely something to consider.

Reply to this email directly or view it on GitHubhttps://github.com//issues/36#issuecomment-40320338
.

@TomasMikula
Copy link
Member

With the latest snapshot, if you want to position the popup window 10 pixels down from the bottom center of the selection, you can do it like this:

Popup popup = new Popup();
area.setPopupWindow(popup);
area.setPopupAlignment(PopupAlignment.SELECTION_BOTTOM_CENTER);
area.setPopupAnchorOffset(new Point2D(0, 10));

@ghost
Copy link
Author

ghost commented Jun 2, 2014

Thanks! This is what I was looking for!
On Jun 1, 2014 5:10 PM, "TomasMikula" notifications@github.com wrote:

With the latest snapshot, if you want to position the popup window 10
pixels down from the bottom center of the selection, you can do it like
this:

Popup popup = new Popup();area.setPopupWindow(popup);area.setPopupAlignment(PopupAlignment.SELECTION_BOTTOM_CENTER);area.setPopupAnchorOffset(new Point2D(0, 10));


Reply to this email directly or view it on GitHub
#36 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant