-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a mixin 'Mapable', which can be used to bind the OpenLayers map instance to any component.
- Loading branch information
1 parent
21b3c32
commit ea077c1
Showing
3 changed files
with
37 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// import Vue from 'vue'; | ||
|
||
import { WguEventBus } from '../WguEventBus.js' | ||
|
||
/** | ||
* Mixin, which binds the OL map to the target component. | ||
* Executes the onMapBound function of the target component, if available. | ||
*/ | ||
export const Mapable = { | ||
created: function () { | ||
WguEventBus.$on('ol-map-mounted', (olMap) => { | ||
// make the OL map accesible in this component | ||
this.map = olMap; | ||
|
||
if (this.onMapBound) { | ||
this.onMapBound(); | ||
} | ||
}); | ||
} | ||
}; |