React batching commit phase across renders - reactjs

I've looked far and wide and can't find the answer to this:
Use case is scrolling a mouse wheel to zoom in.
Every time the wheel is moved a notch, an update is issued with a new level of zoom.
If a new setState is called before the previous one is finished and displayed, it will start processing the next call. However, react will not display the results of the previous render on the screen!
So, if i molest the scroll wheel, it will push dozens of render calls before actually showing anything on the screen, causing very poor user experience. (Here's the video: https://youtu.be/YRVK8uoVml0)
I don't know hot to force it to draw each render on screen.
And please, not answers like "You shouldn't be doing that", or "Just fire one update at a time". Only answer if you actually know the answer. Thank you.

Related

How to animate CN1 Slider progress on load

Please can you help me work out how to build a Codenameone Slider control that simply animates its Progress when it renders initially, so the user sees the progress bar increase over the course of a few seconds.
My actual implementation is to use Chen's awesome ArcProgress control to show how far something has grown, so as the control renders the arc is filled to its 70% or so level over a few seconds. I have the image above all built and working so far.
Many thanks
You just need to invoke setValue to indicate the current position. I'm guessing you don't see the progress moving because you're doing the progress on the EDT thus blocking painting.
All paint operations are performed on the EDT thread and so if your loading/processing code runs on that thread (the main thread) you're effectively blocking the paint operations. There's a long discussion of this in the EDT section of the developer guide.

Auto Scrolling Within a View with React Native

Currently working on a project where I want to implement Auto Scrolling in a view. Is this possible with React Native? I have searched the internet and have not come across anything that shows this capability.
Most Stack Overflow questions and YouTube videos deal with scrolling between different views (not within the same view), scrolling to the bottom (with Scroll To), infinite scrolling, or scrolling responsively. But I haven't been able to find anything dealing specifically with auto-scrolling within a given view.
Please let me know. Thank you in advance.
Something that just came to my mind would be like...
Store current x and y offset values of the scrollview in the component's state, setState every 'x' seconds with the new offset and call scrollTo() method of scrollview. That would change the x and y offset repetitively and make it looks like is auto scrolling.
PS: I know is not a full solution and should be posted in the comments section but I'm not able to comment yet... hope this helps anyway :)

Manually triggering a redraw on AnyMap

on mobile devices the map renders sometimes a bit buggy.. markers are moved or too big.. can't really describe what happens there, it just looks really weird. However it does fade away when I move the map a bit, so I guess they are redrawn that moment. So to do that automatically I was listening to some events and then moved the map just for a pixel.. is there some better way to trigger a redraw? as everybody can see the map moving for a pixel.
AnyIdeas?
//edit: after testing a bit more I can say that moving the map using the move method doesn't trigger a redraw, it only works if I move the map myself, e.g. by touch gesture
//edit2: for now I am using anyMap.zoom(1) for triggering that redraw, it works but seems like a hacky solution
There is a bug in 7.13.0, AnyChart team will try to fix it in 7.13.1 which is scheduled do be released in a couple of weeks. There is no good workaround at the moment, unfortunately.

Loop video file placed in interactive pdf

I have an interactive pdf document that is displayed fullscreen. there's a navigation bar that users can press to jump to different pages.
What I need is some sort of looping screensaver (a collection of photos) that can be enabled by the user pressing a button.
I considered dropping in a video of a slideshow that I made in after effects, until I realised it's not that easy to loop the playback of that video!
How can I loop a video that I have placed onto a page in a pdf? I've read somewhere about swf's looping but I've tried that and there's no loop option when I place the file in acrobat?
Can someone give me some advice as I thought it would be pretty straightforward to loop a video and now it's looking far from easy.
Thanks
If it is just a slide show, meaning changing images at regular intervals, a few things could be done with Acrobat/Reader's on-board means.
In Full Screen, Acrobat allows to cycle through pages every whatever second. A button on those "screensaver" pages would get back to a "real" page. The question is whether that would interfere with the rest of the document.
Another approach would be having a Button field, icon only, read-only, no action, where you would show an image (preferably PDF) as an icon, and have a control loop running (using interval, timeout) loading different icons. This could be implemented with quite little JavaScript.

FlowDocumentScrollViewer vs FlowDocumentPageViewer

I have 2 possible ways to display my FlowDocument:
FlowDocumentScrollViewer
Upside:
- This just presents me the data, with no attention to pages, so the user simply scrolls through everything. On printing I can add a header and a footer and the pages are decided there.
- When I resize my window, the content stays correctly at 100% zoom, as I want it to be.
Downside:
- With a lot of data it just crashes, it seems to render all controls at once, or something.
FlowDocumentPageViewer
Upside:
- With a lot of data it's still fast.
Downside:
- It decides pages for me, which are irrelevant.
- When I resize my window, the content zooms out to fit the window. Which makes the content unreadable very quickly. Possible fix to this is surrounding the control with a ScrollViewer, which works. But when you scroll down to view bottom page content, at the end it goes to the next page, and if you then scroll up too far it goes to previous page, very annoying.
What I eventually want is the FlowDocumentScrollViewer, but then with fast loading time.
Anyone with any ideas/tips on this matter? Much appreciated!
Use a FlowDocumentReader then the user can can go scroll or page at run time. This will not solve stability problems. I display some documents with 200,000 characters and it is stable for me. It load via Dispatcher so may want to look there.

Resources