UNPKG

vue-tianditu2

Version:
66 lines (65 loc) 1.74 kB
import { watch as t } from "vue"; import { toLngLat as i, toBounds as d } from "../../utils/converter.mjs"; function l({ props: m, instance: o }) { t( () => ({ center: m.center, zoom: m.zoom }), (e) => { !e.center || !e.zoom || o.panTo(i(e.center), e.zoom); } ), t( () => m.drag, (e) => e ? o.enableDrag() : o.disableDrag(), { immediate: !0 } ), t( () => m.scrollWheelZoom, (e) => e ? o.enableScrollWheelZoom() : o.disableScrollWheelZoom(), { immediate: !0 } ), t( () => m.doubleClickZoom, (e) => e ? o.enableDoubleClickZoom() : o.disableDoubleClickZoom(), { immediate: !0 } ), t( () => m.keyboard, (e) => e ? o.enableKeyboard() : o.disableKeyboard(), { immediate: !0 } ), t( () => m.inertia, (e) => e ? o.enableInertia() : o.disableInertia(), { immediate: !0 } ), t( () => m.continuousZoom, (e) => e ? o.enableContinuousZoom() : o.disableContinuousZoom(), { immediate: !0 } ), t( () => m.pinchToZoom, (e) => e ? o.enablePinchToZoom() : o.disablePinchToZoom(), { immediate: !0 } ), t( () => m.autoResize, (e) => e ? o.enableAutoResize() : o.disableAutoResize(), { immediate: !0 } ), t( () => m.minZoom, (e) => e && o.setMinZoom(e) ), t( () => m.maxZoom, (e) => e && o.setMaxZoom(e), { immediate: !0 } ), t( () => m.maxBounds, (e) => e && o.setMaxBounds(d(e)), { immediate: !0 } ), t( () => m.viewport, (e) => e && o.setViewport(e == null ? void 0 : e.map((u) => i(u))), { immediate: !0 } ), t( () => m.mapStyle, (e) => e ? o.setStyle(e) : o.removeStyle(), { immediate: !0 } ); } export { l as useWatch }; //# sourceMappingURL=watch.mjs.map