Comments (6)
With this sequence:
requestRenderFrame();
withFrozenRendering(function() {
setCenter();
setResolution();
});
withFrozenRendering
will fire the rendering. This is definitely is a bug in withFrozenRendering
(unfreezeRendering
actually).
We could consider that it's stupid to use both requestRenderFrame
and withFrozenRendering
(as the above example), because withFrozenRendering
is useless if requestRenderFrame
was called. But, the problem is that we have different players here:
View2D.zoom
calls bothsetCenter
andsetResolution
, so it makes sense for it to usewithFrozenRendering
,DragRotateAndZoom.handleDrag
handles drag events, so it makes sense for it to userequestRenderFrame
.
This really suggests fixing withFrozenRendering
(and adding unit tests to test that logic).
Bruno, and I just talked about requestRenderFrame
and withFrozenRendering
.
We agree that calling requestRenderFrame
multiple times is not a problem (a bug, I should say), but we also agree that we need to clean up our mess.
We also think that it's a good thing to have both requestRenderFrame
and withFrozenRendering
. It really separates the concepts. withFrozenRendering
enables grouping changes without triggering rendering, while requestRenderFrame
requests an animation frame.
To answer Tim's question: requestAnimationFrame
is to be used when animating, and in interaction to debounce events (mousemove/touchmove events in the case of our drag interactions). Outside these use cases there probably is no reason to use it. Please tell me this is a too weak justification :)
from openlayers.
+1 to @elemoine and @bbinet's analysis.
unfreezeRendering
triggering a render after requestRenderFrame
has been called is definitely a bug.
To the final paragraph:
To answer Tim's question: requestAnimationFrame is to be used when animating, and in interaction to debounce events (mousemove/touchmove events in the case of our drag interactions). Outside these use cases there probably is no reason to use it. Please tell me this is a too weak justification :)
I'd add that animation is also needed in these cases:
- animating tile fade-in in the Canvas and WebGL renderers (not yet implemented)
- reducing the work done while tiles are loading
- reducing the work done while textures are being uploaded to the GPU
Note that when tiles are loading, we'll need the animation to fade in the tiles anyway, so it makes sense to go into animating mode while tiles are loading rather than responding to image load events.
from openlayers.
I'd add that animation is also needed in these cases:
- animating tile fade-in in the Canvas and WebGL renderers (not yet implemented)
- reducing the work done while tiles are loading
- reducing the work done while textures are being uploaded to the GPU
I was referring to requestAnimationFrame
, not animations per-se. Anyway.
from openlayers.
We have a small problem currently (which I already mentioned in some other comment): the interactions and the view "freeze" and/or request a render frame only for the map the user is interacting with. The view should really not call map functions – the view does not have a map, and there may be multiple maps listening to view property changes. What Tim has in mind would fix that. A while back Tom and I briefly mentioned relying on view hints to fix. I'm even wondering if the current view hints (animating and dragging) would not suffice. I want to give it a try, so more on that next week. In the mean time feedback is welcome.
from openlayers.
I have been experimenting with this in my raf branch. https://github.com/elemoine/ol3/compare/openlayers:master...raf. I'm not too happy with it, and need to think more about the issue.
from openlayers.
Closed with #1732..
from openlayers.
Related Issues (20)
- Add a silent option to the removeFeature method of the vector source. HOT 4
- When adding draw interaction, it flickers while zooming in and out (Version 9.0.0) HOT 38
- ERROR Failed to compile with 1 error HOT 1
- Is there a way to know the style is declutter? HOT 4
- [BUG] Zoom level difference with MVT Layer HOT 5
- Modifying features in an OpenLayers VectorLayer very slow after use HOT 8
- The timezones.kml file is not updated to reflect the current timezone for Kazakhstan - UTC+05:00 HOT 1
- 如何只监听图层变化? HOT 3
- New IGC file format (2011) is not well understood HOT 1
- MapTiler satellite tiles in examples HOT 2
- setColor public method for Icon styles HOT 2
- Scrolling Issue with Input Field Over Map in Div Element
- WebGL Vector Layer wrapX support HOT 1
- Show rendered status from a layer in a specific instant HOT 2
- GeoTIFFSource: Specifying a custom client HOT 2
- Implementing Dynamic Range Adjustment using WebGLTileLayer? Need advice and feedback
- Vector layer canvas has a wrong size when the map is rotated HOT 1
- Problem with setFill() for styling VectorTile HOT 9
- Update terrain-rbg in interpolation examples
- IGC: new file format HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openlayers.