Minimap that controls the main viewport #5788
-
Working with orthographic layers, I already have a minimap view set up that displays the main viewport bounds (like https://deck.gl/examples/multi-view/), but I've had some difficulty with implementing the ability to interact with the minimap - using mouse events to move the main viewport (e.g. panning on the minimap view moves the main viewport to match) I've tried a couple different ideas like a custom controller - or handling onViewStateChange seperately for the minimap view. In the case of the latter, I have added a controller on the minimap view. The minimap view is not supposed to change states (as it is a static overview), so I do not apply any of the new viewStates to the minimap view. Instead, I've attempted to use the minimap view's new target values, and try and map these into new targets to set on the main view. However I am yet to find a perfect way to map the target from the minimap view to the main view: using the initial main view targets minus the new minimap view targets is close but still not correct. Does any one have any suggestions for mapping target values between views, or know of a better way to do this (move the main viewport via the minimap), or have an example of such an implementation? Thank you for any help!! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You have to update the view state of a view if you want to enable controller. In your use case, you can add a third view that is identical to the minimap, but does not render anything, and set its |
Beta Was this translation helpful? Give feedback.
-
Thanks to @Pessimistress for pointing me in the right direction! In case anyone else wants to do the same:
|
Beta Was this translation helpful? Give feedback.
You have to update the view state of a view if you want to enable controller. In your use case, you can add a third view that is identical to the minimap, but does not render anything, and set its
controller: true
.