-
Notifications
You must be signed in to change notification settings - Fork 12
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
AccordionBox does not handle dynamic layout of title. #890
Comments
Here's the relevant code in AccordionBox.ts. Note that there's no listener for // title horizontal layout
if ( isWidthSizable( this.titleNode ) ) {
this.titleNode.preferredWidth = titleRightSpan - titleLeftSpan;
}
if ( options.titleAlignX === 'left' ) {
this.titleNode.left = titleLeftSpan;
}
else if ( options.titleAlignX === 'right' ) {
this.titleNode.right = titleRightSpan;
}
else { // center
this.titleNode.centerX = collapsedBounds.centerX;
}
// button & title vertical layout
if ( options.titleAlignY === 'top' ) {
this.expandCollapseButton.top = this.collapsedBox.top + Math.max( options.buttonYMargin, options.titleYMargin );
this.titleNode.top = this.expandCollapseButton.top;
}
else { // center
this.expandCollapseButton.centerY = this.collapsedBox.centerY;
this.titleNode.centerY = this.expandCollapseButton.centerY;
} |
Weird, adding the titleNode to the LayoutConstraint with addNode ( Line 523 in 43ac9f1
|
Ahh, |
Will do for BoxNode. But in general... Why does |
Because the layout code is currently responsible for aligning the title, and resize:false is currently used to determine whether we run the layout more than one time. This seems a bit conceptually wrong, since the title positioning (and potentially other parts of the layout) aren't technically related to resizing. |
We could wrap the titleNode within an AlignBox that is sized to the space it has (determined during layout), so that it will correct alignment when not resizing. Do you think that would be helpful? |
Yes. |
For example, here's what I see in BCE with
?stringTest=dynamic
. The titles should remain centered. The relevant code in BCE is BoxNode, a subclass of AccordionBox.The text was updated successfully, but these errors were encountered: