stickers
stickers copied to clipboard
GetContentWidth ignores padding
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:
https://github.com/76creates/stickers/blob/d6bf5dc8ab6b58b882cb887ad4367249f8684fce/flexBoxCell.go#L117-L119
To:
func (r *FlexBoxCell) getExtraWidth() int {
return r.style.GetHorizontalFrameSize()
}
Same for GetContentHeight()
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?
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.