-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resizing on changeFlags.viewportChanged slower than storing viewState in application state #4504
Comments
An easier way to do this is via multi-view: new Deck({
views: [
new OrthographicView({id: 'main', controller: true}),
new OrthographicView({id: 'legend', x: 0, y: 0, target: [0, 0]})
],
layers: [
new LineLayer({
id: 'scale-bar',
data: [[0, 0], [100, 0]],
getSourcePosition: d => d[0],
getTargetPosition: d => d[1],
getWidth: 2,
getColor: [220, 220, 220]
})
],
layerFilter: ({layer, viewport}) => {
if ( layer.id === 'scale-bar' ) return viewport.id === 'legend';
return true;
}
}) |
@Pessimistress Is there a way to force the recursive update? I was mimicking the Also, for multiple views, is there a way to make the one on top transparent? If both the answers to those are negative, then I will probably just stick with storing the |
The way it's implemented now, you can't update layers recursively on viewport change without substantially affecting perf. We can revisit this in the next major release. Multiple views can be on top of each other, and by default they just render their own content without clearing the region (aka transparent). |
Thank you for the clarification on that. |
Hello, I am trying to make a resizable scale bar layer. To do this, I am trying to implement a custom layer that wraps a couple of
LineLayer
s. However, the performance is a little jumpy. I have noticed that it is considerably less jumpy if, instead of calculating the bounding box in therenderLayers()
call, I store theviewState
in state, and use that instead to directly create aLineLayer
. Am I missing some sort of data comparator or the like? I would totally believe that. Sorry if this is something silly!UPDATE: I realized I wasn't totally clear. The idea is to resize as you zoom in and out, which is what is causing the update in the below screen-grab.
Here is a screen-grab - top left is using state and bottom left is using
this.context.viewport
for projection.Here is some code for reproduction:
The text was updated successfully, but these errors were encountered: