Giter VIP home page Giter VIP logo

Comments (8)

g-zachar avatar g-zachar commented on August 18, 2024

@AndriyShpyra What's the size of text block you're mentioning? Can you provide code snippet? Also, what platform are you running Lightning on?

from lightning.

AndriyShpyra avatar AndriyShpyra commented on August 18, 2024

Size of text block depends on the response from an api, it can be around 600 000 symbols.
During the development process Lightning is being run mostly on chrome browser

class TextDemo extends lng.Application { _init() { this.patch({ x: 50, y: 50, Text: { text: { wordWrapWidth: 600, textColor: 0xffff00ff, fontSize: 36, text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Cursus turpis massa tincidunt dui ut ornare lectus sit amet. Augue ut lectus arcu bibendum at varius vel pharetra vel. Amet mattis vulputate enim nulla aliquet. Ac turpis egestas integer eget aliquet. Potenti nullam ac tortor vitae purus faucibus. Duis ut diam quam nulla. Posuere lorem ipsum dolor sit. Faucibus ornare suspendisse sed nisi. Scelerisque felis imperdiet proin fermentum leo vel orci. Faucibus in ornare quam viverra orci .....and a lot more text}
}
})
}
}

const options = {stage: {w: window.innerWidth, h: window.innerHeight, useImageWorker: false}};
const app = new TextDemo(options);
document.body.appendChild(app.stage.getCanvas());`
__

from lightning.

erikhaandrikman avatar erikhaandrikman commented on August 18, 2024

Probably you hit the max texture size and the texture will not be rendered, a valid solution would to split the text up in chunks and use some form of pagination

from lightning.

erikhaandrikman avatar erikhaandrikman commented on August 18, 2024

@AndriyShpyra Can we close the ticket?

from lightning.

g-zachar avatar g-zachar commented on August 18, 2024

We actually could try solving it on Lightning's end, for example by doing text chunking text into smaller pieces and composing several textures. This could be increasingly a problem, because different platforms have different GL capabilities and code that works on desktop browser or even existing low end platforms would break when hitting target platform.

from lightning.

erikhaandrikman avatar erikhaandrikman commented on August 18, 2024

Good suggestion, but what are we going to do after all the textures are created? We would end up with a batch of textures and only one them would be visible. We then need to offer additional functionality to display one after the other, and the question is if it will match the expectation.

We can create some configurable text components for the SDK like scroller / paging.

from lightning.

AndriyShpyra avatar AndriyShpyra commented on August 18, 2024

Thanks for help!
It would be cool if such functionality was added to Lightning

from lightning.

g-zachar avatar g-zachar commented on August 18, 2024

I analysed the possibilities and unfortunately creating complex text component would not be a good idea.

For one, many developers are used to current way of representing text via texture and introducing different way (e.g. text element) would introduce unnecessary confusion.

Additionally, it would probably take some time before such element would become stable and bug free. It is good candidate for next major release but not as a feature for current one.

And to answer your initial question, to avoid such bugs from occuring it is recommended to create textures that do not exceed viewport dimensions.

from lightning.

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.