-
Notifications
You must be signed in to change notification settings - Fork 528
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
custimizable TitleRenderer callback for tab titles #759
base: master
Are you sure you want to change the base?
Conversation
This follows the conventions of the HTML5 drag-and-drop API, and replaces the _extraAllowableChildTargets property.
This replaces the long-title branch and pull-request.
I checked in some polishing of the logic to layout tabs headers. I think it is pretty good now. One new feature is "tight mode", indicated by adding The overlap logic is enhanced. The active tab has highest z-index, and then drops off on either side. Overlap is added whenever the active tab is partially hidden. Very narrow windows degrade in a much nicer way. |
I optimized updateTabSizes by wrapping it in a requestAnimationFrame. |
Some tweaks when really low on space and dropdownActive: Don't overlap tabs too much, unless needed for active tab.
This is on git@github.com:PerBothner/golden-layout.git See golden-layout/golden-layout#759
@PerBothner any news about this PR actually being merged and released? |
@WillooWisp Sorry, none of the maintainers seem to have time for GoldenLayout. |
This implements a customization hook that allows an application to customize how tab titles are drawn. It is based on this comment. It provides part of the needed functionality for issue #736 - it allows customizing the title part of an individual tab, but does not provide any mechanism to further customize headers, (That is a problem for another day, and can build on this PR.)
The hook is a function that has type
TitleRenderer
and is registered bycontainer.setTitleRenderer
. As an example of how it is used in DomTerm:The functions takes four argument:
lm_title
element to "paint". The function is responsible for reusing or removing existing children. This allows reuse of title components, which may sometimes be a worthwhile optimization. Existing children are automatically replaced byinnerHTML
orinnerText
, which is while the example doesn't do it explicitly.DropdownActive
if there is a drop-down menu in the header;InDropdownMenu
if we're creating the drop-down menu;IsActiveTab
if the tab is active.This is working acceptably for me in DomTerm, but should be considered a work-in-process. Most specifically, the
tryUpdateTabSizes
function intabs-container.ts
needs some polishing. For example, if space is tight, we could and should remove the close button for inactive tabs. It also needs some work to truncate a tab title if necessary.This builds on PR #737. I've made some progress some progress is using HTML drag-and-drop (issue #680): I can drag and sort-of-drop a component from one top-level window to another. However, I'd like to move forward on customizing titles so I don't have too many changes at once - but regardless using the
draggable
attribute seems a good step.