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

Make Block.inner* values public #23

Closed
beefsack opened this issue Apr 8, 2015 · 3 comments
Closed

Make Block.inner* values public #23

beefsack opened this issue Apr 8, 2015 · 3 comments

Comments

@beefsack
Copy link
Contributor

beefsack commented Apr 8, 2015

I'm currently writing a rich text widget which has a cursor and allows input, essentially allowing text editing using this library.

Basic functionality is already there but I'm not able to cleanly embed Block into my widget because the innerX, innerY, innerWidth and innerHeight values are all private.

If you're happy to make them public somehow, would you prefer just expose the properties, or expose them through methods like InnerX() etc.? Or perhaps an InnerBounds() (x, y, width, height int) method to get them all at once?

If you're happy with one of those I'll throw something together and make a PR.

@beefsack beefsack changed the title Make Block.inner* values public Make Block.inner* values public Apr 8, 2015
@Matt3o12
Copy link
Contributor

Matt3o12 commented Apr 8, 2015

👍

I've also wondered why they're not public but you can calculate them yourself.
One reason their private is probably because they are only available after align (private as well) or Buffer (public) is called.
I'd prefer to have getters and setters that calculate the correct values everytime they're called so we don't have to rely on Buffer getting called.

Disclaimer : I'm not the repo owner.

Sent from my iPhone

On Apr 8, 2015, at 3:52 PM, Michael Alexander notifications@github.com wrote:

I'm currently writing a rich text widget which has a cursor and allows input, essentially allowing text editing using this library.

Basic functionality is already there but I'm not able to cleanly embed Block into my widget because the innerX, innerY, innerWidth and innerHeight values are all private.

If you're happy to make them public somehow, would you prefer just expose the properties, or expose them through methods like InnerX() etc.? Or perhaps an InnerBounds() (x, y, width, height int) method to get them all at once?

If you're happy with one of those I'll throw something together and make a PR.


Reply to this email directly or view it on GitHub.

@gizak
Copy link
Owner

gizak commented Apr 8, 2015

PRs are welcome! The reason I set them private in the first place because the inner* are computed values, so I did not think we actually need them. Seems not the case for now ;) InnerX() and InnerBounds() look great to me!

@beefsack
Copy link
Contributor Author

beefsack commented Apr 9, 2015

Have implemented an InnerBounds method with an associated test (#24), decided a single call made more sense as the consumer would probably need all four anyway and this way ensures align is only called once.

@gizak gizak closed this as completed in 27b93c6 Apr 9, 2015
gizak added a commit that referenced this issue Apr 9, 2015
Fix #23 by implementing Block.InnerBounds() and associated test.
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