Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "venus-map", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "tq-fed-map", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
@@ -20,4 +20,6 @@ import OlMap from 'ol/Map' | ||
import Point from 'ol/geom/Point' | ||
class Map { | ||
import EventBus from './components/EventBus' | ||
class Map extends EventBus { | ||
constructor(appKey, id, opt = {}) { | ||
super() | ||
const { center = [116.405994, 39.913607], zoom = 10, minZoom = 4, maxZoom = 19 } = opt | ||
@@ -36,2 +38,15 @@ this.appKey = appKey // 天地图 app key | ||
}) | ||
if (window && window.MutationObserver) { | ||
const wrapper = document.getElementById(id) | ||
const observer = new MutationObserver(() => { | ||
const { width, height } = wrapper.getBoundingClientRect() | ||
this.instance.updateSize(width, height) | ||
this.emit('update-size') | ||
}) | ||
observer.observe(wrapper, { | ||
attributes: true, | ||
attributeFilter: ['style'], | ||
attributeOldValue: true, | ||
}) | ||
} | ||
this.instance.getControls().forEach(c => this.instance.removeControl(c)) | ||
@@ -38,0 +53,0 @@ this.instance.appKey = appKey |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2996326
3799