Comments (2)
Hello,
A control is associated with only one map. So you have to create one control per map (as mouse position in the example).
The trick is to hide the control when the map is not concerned and show only one at a time.
You can use setMap
to switch the control map when a map is active.
But don't have to use it, you can add a control per map and you just have to show / hide the control when the map is active or not (if the mouse is on the viewport or if a map is clicked).
@+
from ol-ext-angular.
Thank you so much again for your precious feedback!
I was able to implement the outside controls.
What I did was:
- create one control per each map and associate each of them to one map
- draw them concurrently BUT one on top of the other, to give the impression that it's just one control
- create a service that, after clicking one control (they actually are all buttons in my case), handles the activation/deactivation of all other similar controls underneath
- activation/deactivation of controls also implies adding/removing the click event listener to each maps the controls are associated with (i.e. by using e.g.
this.clickKey = map.on('click', whatever)
to a variable on activation and usingunByKey(this.clickKey)
when deactivating
Again, thankyou so much for clatrifying the 1 control -> 1 map rule, and to give me a suggestion for solving the problem!
Closing now 👍
from ol-ext-angular.
Related Issues (8)
- Storymap with angular
- Cannot display imageLayer without setting position:fixed in css HOT 1
- controlcomponent - should `this.mapService.getMap(this.mapidService)` be `this.mapService.getMap(this.mapidService.getId())` instead? HOT 1
- Styling custom controls HOT 2
- Save Vector layer on completion of draw HOT 8
- Not getting vector layer displayed on map HOT 4
- Not working with angular 13
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 ol-ext-angular.