Coder Social home page Coder Social logo

Comments (1)

philj56 avatar philj56 commented on September 26, 2024

Hey, sorry for the slow response, been busy with work recently.

Is there a way to calculate num_results_drawn without actually rendering the text?

Not with the current way things are done unfortunately. Tofi is designed to start up as fast as possible, and quite a few shortcuts are taken to achieve that (especially for the first two frames).

The whole problem of auto-detecting how many results to draw is a tough one. In vertical mode it's fine — you can just divide the space available by the size of each entry, as they're all the same height. In horizontal mode, the only way to know how many results will be drawn is to draw (or at least shape) them all. This is kind of the crux of the issues behind #21 and #73.

I think it might be possible to solve this if the shaping and drawing were split up, so you'd shape all the text, measure that, do any shifting necessary, and finally render all the text. That'd be a pretty significant overhaul of how tofi handles drawing though, so it's unlikely to happen in the near future. I'll try and look into it at some point though.

Thanks for the suggestion!

from tofi.

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.