GithubHelp home page GithubHelp logo

Comments (6)

texus avatar texus commented on May 30, 2024

getSize would make sence for both without the text or with the text, but the problem is that setSize only makes sence for the image.

So I would have to make the getSize function return the whole size and the setSize function only change the size of the image. Or make them both work on the size including both image and text, but this is a bit tricky. (first solution looks better)

Neither solution seems really good, but leaving it like it is ain't great either.

Any suggestions?

from tgui.

gupascal avatar gupascal commented on May 30, 2024

I think that having the two functions working on the full size (image+text) is more logical, imho. In the most of the cases, the widget will normally be kept auto sized by the user.
You can also add get/setBoxSize functions...

from tgui.

texus avatar texus commented on May 30, 2024

Maybe it is more logical, but there are a lot of things to look at.
What happens with the text when you set the size of the checkbox? Are you just going to clip it?
When you change the text after setting the size, are you going to reset the clipping? This would actually be nice, but then you get different behaviour if you change the order of setSize and setText function calls. And if you don't reset the clipping then you basically have to know the size of the text upfront.

I actually agree that your solution with having both set- and getSize work on the full size and add get/setBoxSize function might be the best, but I just don't like the fact that there doens't seems to be a clean solution and that whatever I do there will always be pitfalls.

from tgui.

gupascal avatar gupascal commented on May 30, 2024

Yes, I think that the checkbox should be clipped, and when the text is changed you should keep the clipping. You can perhaps add a setAutoSize() function, but I don't think is very important. If someone use setSize, it will know what he does, so he won't use setAutoSize(true) after I think.

from tgui.

texus avatar texus commented on May 30, 2024

Alright, I'll make the changes (tomorrow).

In the end, normally you'll have an image of the correct size anyway.

from tgui.

texus avatar texus commented on May 30, 2024

I actually did implement the clipping and setBoxSize function, but I really don't like it. It makes CheckBox unnecessary more difficult. Also the clipping would make it slightly slower. And that all for a setSize function that probably isn't going to be used anyway.

So I'm going to do it in another way. For now I'm just going to fix this issue by making the changes in the getSize function. As long as you don't use the setSize function there won't be a real difference and I don't have to add functions to CheckBox and a lot of extra code in the draw function.

But I have the full changes with clipping and get- and setBoxSize function on a seperate local branch, so if I later would have to make this changes then I will be able to do so instantly.

from tgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.