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

GetContentWidth ignores padding #11

Open
jon4hz opened this issue Feb 3, 2023 · 2 comments
Open

GetContentWidth ignores padding #11

jon4hz opened this issue Feb 3, 2023 · 2 comments

Comments

@jon4hz
Copy link
Contributor

jon4hz commented Feb 3, 2023

Hi, I noticed that the GetContentWidth method ignores the padding of the cells style.
Is this intended?

If not the getExtraWidth method should be changed from:

stickers/flexBoxCell.go

Lines 117 to 119 in d6bf5dc

func (r *FlexBoxCell) getExtraWidth() int {
return r.style.GetHorizontalMargins() + r.style.GetHorizontalBorderSize()
}

To:

func (r *FlexBoxCell) getExtraWidth() int { 
 	return r.style.GetHorizontalFrameSize()
} 

Same for GetContentHeight()

Omnikron13 added a commit to Omnikron13/stickers that referenced this issue Jun 21, 2024
…ertialFrameSize() methods to include padding for extra cell height/width
@Omnikron13
Copy link

Opened PR #16 implementing the fix specified here.

I'm not familiar with the internals, but I note there are identical getContentHeight(), getContentWidth(), getExtraHeight(), and getExtraWidth() methods in row.go, column.go, flexbox.go, and horizontal_flexbox.go, and so I presume these ought to have to same fix applied? If so, perhaps they should be refactored with a base type for the sake of DRY principles?

@76creates
Copy link
Owner

Im not sure what are we trying to achieve with this, getContentWidth is used to determine the total width of the "outer" cell, I don't see how padding affects this as its "inner" part of the cell. Maybe the function name is misleading, and it used to be exported thus the user might have been using it for something that is not originally intended for.

I might be getting this wrong, if so please provide a working example to show the unwanted behaviour. @jon4hz

As far as making things DRY, I will look deeper into this, everything could be a child of Cell is the first thing that comes to my mind, but will need to check it out in more detail.

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

3 participants