Git Product home page Git Product logo

Comments (4)

scottbedard avatar scottbedard commented on July 30, 2024 3

My use case for a threshold is this page. I'd like to avoid rendering 3D content that is off the screen, but it might be nice to render it when it is soon to be on screen to avoid a flicker. This could be over-optimizing though, so why don't we keep it simple to start and return a boolean. If it turns out this is not enough, it'll be an easy option to add and won't be a breaking change.

I'll go ahead and make the changes you suggested in the PR, I like that better. I'm not sure what a use case is for knowing when something is partially in the viewport though πŸ€”

from vueuse.

scottbedard avatar scottbedard commented on July 30, 2024

Quick update, I was bored so I threw together a basic implementation. Let me know if there is anything you want to tweak. One thing that might be nice to add is a "threshold", so we can treat something as on-screen once it gets within 200px or whatever.

Also if you decide you don't want this util, just go ahead and close the issue/pr πŸ‘

from vueuse.

antfu avatar antfu commented on July 30, 2024

It looks great, thank you for the proposal and implementation! I have left some comments in the PR, please have a look :)

For the threshold, I am not sure what use cases this utility would be. A basic one comes in my mind would be returning an invisible | partial | visible state. Another way with better controllability (but more complex and costly) might be returning an object with visibleArea visbileWidth visibleHeight visableState etc and let users decide how to handle those data.

What do you think?

from vueuse.

antfu avatar antfu commented on July 30, 2024

Sure, let's keep it simple first.

Awesome website btw :)

from vueuse.

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.