import View from "../view/View";

export default class MapView extends View
{
    metadata = {
		properties: {
			defaultCenterLocation: {
				type: "object",
                defaultValue: [ 32.04389, 118.77881 ]
			},
			defaultZoom: {
				type: "int",
				defaultValue: 15
			},
			minZoom: {
				type: "int",
				defaultValue: 11
			},
			maxZoom: {
				type: "int",
				defaultValue: 17
			},
			allowZoom: {
				type: "boolean",
				defaultValue: true
			},
			allowDrag: {
				type: "boolean",
				defaultValue: true
			}
		}
    };

    init()
    {
        super.init();
        this.addStyleClass("sap-a-map-view");
        this._initMap();

        this.attachAddedToParent(() => {
			setTimeout(() => {
				this.invalidateSize();
			});
		});
    }

    _initMap()
    {
        const options = {
            zoomControl: false,
			attributionControl: false,
			center: this.getDefaultCenterLocation(),
			zoom: this.getDefaultZoom(),
			minZoom: this.getMinZoom(),
			maxZoom: this.getMaxZoom(),
			dragging: this.getAllowDrag(),
			scrollWheelZoom: this.getAllowZoom(),
			doubleClickZoom: this.getAllowZoom()
        };
        this.map = L.map(this.$element[0], options);
        L.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png").addTo(this.map);
    }

    invalidateSize(...args)
    {
        this.map.invalidateSize(...args);
    }
}

@@ -822,28 +822,27 @@
 oomControl: 
-fals
+tru
 e,%0A%09%09%09attrib
@@ -1175,24 +1175,24 @@
 , options);%0A
-
         L.ti
@@ -1262,24 +1262,485 @@
 ap);%0A    %7D%0A%0A
+    setCenterLocation(centerLocation, zoom, options)%0A    %7B%0A        this.map.setView(centerLocation, zoom, options);%0A    %7D%0A%0A    getCenterLocation()%0A    %7B%0A        return this.map.getCenter();%0A    %7D%0A%0A    getBounds()%0A    %7B%0A        return this.map.getBounds();%0A    %7D%0A%0A    setBounds(bounds)%0A    %7B%0A        this.map.fitBounds(bounds);%0A    %7D%0A%0A    getZoom()%0A    %7B%0A        return this.map.getZoom();%0A    %7D%0A%0A    setZoom(value)%0A    %7B%0A        this.map.setZoom(value);%0A    %7D%0A%0A
     invalida

Add bounds zoom.