ngx-google-map-helper
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-google-map-helper",["exports","@angular/core","@angular/common"],t):t(e["ngx-google-map-helper"]={},e.ng.core,e.ng.common)}(this,function(e,i,o){"use strict";var l=function f(){this.apiKey=""},n=function(){function e(e){this.apiKey="",e&&(this.apiKey=e.apiKey)}return e.prototype.getApiKey=function(){return this.apiKey},e.decorators=[{type:i.Injectable,args:[{providedIn:"root"}]},{type:i.Injectable}],e.ctorParameters=function(){return[{type:l,decorators:[{type:i.Optional}]}]},e}();function v(e){var t="function"==typeof Symbol&&e[Symbol.iterator],i=0;return t?t.call(e):{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}}}var h={clear:'<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',"delete":'<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 24 24"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM8 9h8v10H8V9zm7.5-5l-1-1h-5l-1 1H5v2h14V4z"/><path fill="none" d="M0 0h24v24H0V0z"/></svg>',save:'<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 24 24"><path d="M19 12v7H5v-7H3v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zm-6 .67l2.59-2.58L17 11.5l-5 5-5-5 1.41-1.41L11 12.67V3h2z"/><path fill="none" d="M0 0h24v24H0z"/></svg>',saveAll:'<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z"/></svg>',undo:'<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>'},s=["marker","circle","polygon","polyline","rectangle"],a=["TOP_CENTER","TOP_LEFT","TOP_RIGHT","BOTTOM_CENTER","BOTTOM_LEFT","BOTTOM_RIGHT"],r={fillColor:"#005696",fillOpacity:.2,strokeColor:"#005696",strokeWeight:3,clickable:!0,editable:!0,draggable:!0,zIndex:1},p={animation:"DROP",draggable:!0,title:"",icon:null},y=[{key:"undo",label:"Undo"},{key:"clear",label:"Clear All"},{key:"delete",label:"Delete Selected"},{key:"save",label:"Save Selected"},{key:"saveAll",label:"Save All"}],g="500px",c="100%",d=10,m={lat:-34.397,lng:150.644},u=function(){function e(e,t){this.elementRef=e,this.mapHeight=g,this.mapWidth=c,this.zoom=d,this.center=null,this.mapType="ROADMAP",this.placeMarkerOnClick=!1,this.showControl=!0,this.position=a[0],this.showModes=s,this.locationAccess=!1,this.commonOption=r,this.markerOption=p,this.customButtons=!0,this.onlyCustomButtons=[],this.googleMapObjects=!1,this.showErrors=!0,this.shapes=[],this.mapClicked=new i.EventEmitter,this.overlayCompleted=new i.EventEmitter,this.overlaySelected=new i.EventEmitter,this.saveSeleted=new i.EventEmitter,this.saveAll=new i.EventEmitter,this.isWorldView=!1,this.allOverlays=[],this.customButtonsList=y,this.apiKey=t.getApiKey()}return e.prototype.ngOnInit=function(){var t=this;console.log(this.shapes),this.apiKey&&""!==this.apiKey?(Promise.all([this.lazyLoadMap()]).then(function(e){return t.initMap()}),this.initOverlayOptions()):this.showError("google map key required, include in forroot()",null)},e.prototype.checkValues=function(){this.mapWidth||(this.mapWidth=c),this.mapHeight||(this.mapHeight=g),this.zoom||(this.zoom=d)},e.prototype.lazyLoadMap=function(){var o=this;return new Promise(function(e,t){if("object"==typeof google&&"object"==typeof google.maps)e();else{var i=document.createElement("script");i.setAttribute("id","googleMap"),i.type="text/javascript",i.src="https://maps.googleapis.com/maps/api/js?key="+o.apiKey+"&libraries=drawing",o.elementRef.nativeElement.appendChild(i)}setTimeout(function(){e()},1e3)})},e.prototype.initOverlayOptions=function(){this.circleOption||(this.circleOption=this.commonOption),this.polygonOption||(this.polygonOption=this.commonOption),this.polylineOption||(this.polylineOption=this.commonOption),this.rectangleOption||(this.rectangleOption=this.commonOption)},e.prototype.initMap=function(){var t=this;this.locationAccess&&navigator?navigator.geolocation.getCurrentPosition(function(e){t.center.lng=+e.coords.longitude,t.center.lat=+e.coords.latitude,t.setUpMap(!1)},function(e){t.setUpMap(!0),t.isWorldView=!0,t.showError("error while reading location",t.onlyCustomButtons)}):(this.setUpMap(!0),this.isWorldView=!0,this.locationAccess&&this.showError("please allow location access on browser",this.onlyCustomButtons))},e.prototype.setUpWorldView=function(){var e=new google.maps.LatLngBounds(new google.maps.LatLng(85,-180),new google.maps.LatLng(-85,180)),t=e.getNorthEast().lat()-5,i=e.getNorthEast().lng()-5,o=e.getSouthWest().lat()+5,l=e.getSouthWest().lng()+5,n=new google.maps.LatLng(t,i),s=new google.maps.LatLng(o,l),a=new google.maps.LatLngBounds(s,n);this.map.fitBounds(a)},e.prototype.setUpMap=function(e){var t;this.center?(t=this.center,e=this.isWorldView=!1):t=m,this.map=new google.maps.Map(document.getElementById("map"),{center:{lat:t.lat,lng:t.lng},zoom:this.zoom,minZoom:2,mapTypeId:google.maps.MapTypeId[this.mapType],styles:[{featureType:"administrative.province",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"administrative.locality",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"administrative.neighborhood",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"administrative.land_parcel",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"landscape",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{color:"#e9e5dc"}]},{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#b8cb93"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"poi.attraction",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.business",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.business",elementType:"geometry.fill",stylers:[{visibility:"on"}]},{featureType:"poi.government",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.government",elementType:"geometry.fill",stylers:[{visibility:"on"}]},{featureType:"poi.medical",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.medical",elementType:"geometry.fill",stylers:[{visibility:"on"}]},{featureType:"poi.park",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#ccdca1"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{visibility:"on"}]},{featureType:"poi.place_of_worship",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.school",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.sports_complex",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"road",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{hue:"#ff0000"},{saturation:-100},{lightness:99}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#808080"},{lightness:54},{visibility:"off"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#767676"}]},{featureType:"road",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]},{featureType:"transit.station.airport",elementType:"labels.text.fill",stylers:[{visibility:"on"}]},{featureType:"transit.station.airport",elementType:"labels.icon",stylers:[{visibility:"on"}]},{featureType:"water",elementType:"all",stylers:[{saturation:43},{lightness:-11},{color:"#89cada"}]},{featureType:"water",elementType:"geometry",stylers:[{visibility:"on"}]}]}),e&&this.setUpWorldView(),this.placeMarkerOnClick?google.maps.event.addListener(this.map,"click",function(e){this.placeMarker(e.latLng),this.mapClicked.emit(e)}.bind(this)):google.maps.event.addListener(this.map,"click",function(e){this.mapClicked.emit(e)}.bind(this)),this.drawingManager=new google.maps.drawing.DrawingManager({drawingMode:google.maps.drawing.OverlayType.MARKER,drawingControl:this.showControl,drawingControlOptions:{position:google.maps.ControlPosition[this.position],drawingModes:this.showModes},markerOptions:{icon:this.markerOption.icon,title:this.markerOption.title,animation:google.maps.Animation[this.markerOption.animation],draggable:this.markerOption.draggable},circleOptions:{fillColor:this.circleOption.fillColor,fillOpacity:this.circleOption.fillOpacity,strokeColor:this.circleOption.strokeColor,strokeWeight:this.circleOption.strokeWeight,clickable:this.circleOption.clickable,editable:this.circleOption.editable,draggable:this.circleOption.draggable,zIndex:this.circleOption.zIndex},polygonOptions:{fillColor:this.polygonOption.fillColor,fillOpacity:this.polygonOption.fillOpacity,strokeColor:this.polygonOption.strokeColor,strokeWeight:this.polygonOption.strokeWeight,clickable:this.polygonOption.clickable,editable:this.polygonOption.editable,draggable:this.polygonOption.draggable,zIndex:this.polygonOption.zIndex},rectangleOptions:{fillColor:this.rectangleOption.fillColor,fillOpacity:this.rectangleOption.fillOpacity,strokeColor:this.rectangleOption.strokeColor,strokeWeight:this.rectangleOption.strokeWeight,clickable:this.rectangleOption.clickable,editable:this.rectangleOption.editable,draggable:this.rectangleOption.draggable,zIndex:this.rectangleOption.zIndex},polylineOptions:{fillColor:this.polylineOption.fillColor,fillOpacity:this.polylineOption.fillOpacity,strokeColor:this.polylineOption.strokeColor,strokeWeight:this.polylineOption.strokeWeight,clickable:this.polylineOption.clickable,editable:this.polylineOption.editable,draggable:this.polylineOption.draggable,zIndex:this.polylineOption.zIndex}}),this.drawingManager.setMap(this.map),google.maps.event.addListener(this.drawingManager,"overlaycomplete",function(e){if(this.addOverlay(e),this.googleMapObjects)this.overlayCompleted.emit(e);else{var t=this.getOverlayType(e);this.overlayCompleted.emit(t)}}.bind(this)),this.customButtons&&this.initCustomButtons(this.map),this.shapes&&0<this.shapes.length&&this.loadShapeToMap(this.shapes)},e.prototype.addOverlay=function(e){if(this.allOverlays&&this.allOverlays.push(e),e.type!==google.maps.drawing.OverlayType.MARKER){this.drawingManager.setDrawingMode(null);var t=e.overlay;t.type=e.type,google.maps.event.addListener(t,"click",function(){this.setSelection(t)}.bind(this)),this.setSelection(t)}},e.prototype.placeMarker=function(e){new google.maps.Marker({position:e,map:this.map,icon:this.markerOption.icon,title:this.markerOption.title,animation:google.maps.Animation[this.markerOption.animation],draggable:this.markerOption.draggable})},e.prototype.initCustomButtons=function(l){var e,t,i=this,o=this.customButtonsList;if(this.onlyCustomButtons&&0<this.onlyCustomButtons.length&&(o=this.customButtonsList.filter(function(e){return i.onlyCustomButtons.includes(e.key)})),o&&0<o.length){var n=function(e){var t=document.createElement("div");t.style.marginRight="2px";var i=document.createElement("div");i.style.backgroundColor="#fff",i.style.border="2px solid #fff",i.style.borderRadius="3px",i.style.boxShadow="0 2px 6px rgba(0,0,0,.3)",i.style.cursor="pointer",i.style.marginTop="5px",i.style.marginBottom="5px",i.style.width="23px",i.style.height="20px",i.style.textAlign="center",i.title=e.label,t.appendChild(i);var o=document.createElement("div");o.style.color="rgb(25,25,25)",o.style.fontFamily="Roboto,Arial,sans-serif",o.style.fontSize="12px",o.style.lineHeight="20px",o.style.paddingLeft="3px",o.style.paddingRight="3px",o.innerHTML="<span> "+h[e.key]+" </span>",i.appendChild(o),i.addEventListener("click",function(){this.handleCustomButtonEvent(e.key)}.bind(s)),l.controls[google.maps.ControlPosition[s.position]].push(t)},s=this;try{for(var a=v(o),r=a.next();!r.done;r=a.next()){n(r.value)}}catch(p){e={error:p}}finally{try{r&&!r.done&&(t=a["return"])&&t.call(a)}finally{if(e)throw e.error}}}else this.showError("please check onlyCustomButtons property",this.onlyCustomButtons)},e.prototype.handleCustomButtonEvent=function(e){switch(e){case"undo":this.undoShape();break;case"clear":this.deleteAllShape();break;case"delete":this.deleteSelectedShape();break;case"save":this.saveSelectedShape();break;case"saveAll":this.saveAllShape()}},e.prototype.setSelection=function(e){if(this.clearSelection(),(this.selectedShape=e).setEditable(!0),this.googleMapObjects)this.overlaySelected.emit(e);else{var t=this.getOverlayType(e);this.overlaySelected.emit(t)}},e.prototype.clearSelection=function(){this.selectedShape&&(this.selectedShape.setEditable(!1),this.selectedShape=null)},e.prototype.deleteSelectedShape=function(){this.selectedShape&&this.selectedShape.setMap(null)},e.prototype.saveSelectedShape=function(){if(this.googleMapObjects)this.saveSeleted.emit(this.selectedShape);else if(this.selectedShape){var e=this.getOverlayType(this.selectedShape);this.saveSeleted.emit(e),console.log(e)}},e.prototype.deleteAllShape=function(){for(var e=0;e<this.allOverlays.length;e++)this.allOverlays[e].overlay.setMap(null);this.allOverlays=[]},e.prototype.undoShape=function(){this.allOverlays!==undefined&&null!==this.allOverlays&&1<=this.allOverlays.length&&(this.allOverlays[this.allOverlays.length-1].overlay.setMap(null),this.allOverlays.pop())},e.prototype.saveAllShape=function(){var e,t;if(this.allOverlays&&0<this.allOverlays.length)if(this.googleMapObjects)this.saveAll.emit(this.allOverlays);else{var i=[];try{for(var o=v(this.allOverlays),l=o.next();!l.done;l=o.next()){var n=l.value;if(n){var s=this.getOverlayType(n);s&&i.push(s)}}}catch(a){e={error:a}}finally{try{l&&!l.done&&(t=o["return"])&&t.call(o)}finally{if(e)throw e.error}}this.saveAll.emit(i)}},e.prototype.getOverlayType=function(e){var t,i,o=null,l=null;if(e.map)l=e;else{if(!e.overlay.map)return void this.showError("Error while reading overlay, try googleMapObjects = true",e);l=e.overlay}if("circle"===e.type){var n={center:s={lat:l.center.lat(),lng:l.center.lng()},radius:l.radius};o={type:e.type,shape:n}}else if("polygon"===e.type||"polyline"===e.type){var s={lat:l.map.center.lat(),lng:l.map.center.lng()},a=l.latLngs.j[0].j,r=[];try{for(var p=v(a),h=p.next();!h.done;h=p.next()){var y=h.value,g={lat:y.lat(),lng:y.lng()};r.push(g)}}catch(f){t={error:f}}finally{try{h&&!h.done&&(i=p["return"])&&i.call(p)}finally{if(t)throw t.error}}var c={center:s,points:r};o={type:e.type,shape:c}}else if("rectangle"===e.type){s={lat:l.map.center.lat(),lng:l.map.center.lng()};var d=l.getBounds(),m={center:s,northEastBound:{lat:d.getNorthEast().lat(),lng:d.getNorthEast().lng()},southWestBound:{lat:d.getSouthWest().lat(),lng:d.getSouthWest().lng()}};o={type:e.type,shape:m}}else if("marker"===e.type){var u={center:s={lat:l.map.center.lat(),lng:l.map.center.lng()},position:{lat:l.position.lat(),lng:l.position.lng()}};o={type:e.type,shape:u}}return o},e.prototype.loadShapeToMap=function(e){if(e&&0<e.length)for(var t=0;t<e.length;t++){var i=e[t];if("marker"===i.type){var o=i.shape,l={type:"marker",overlay:new google.maps.Marker({position:o.position,map:this.map,icon:this.markerOption.icon,title:this.markerOption.title,animation:google.maps.Animation[this.markerOption.animation],draggable:this.markerOption.draggable})};if(this.addOverlay(l),this.isWorldView&&0===t){var n=new google.maps.LatLngBounds,s=new google.maps.LatLng(o.position.lat,o.position.lng);n.extend(s),this.map.fitBounds(n)}}else if("circle"===i.type){var a=i.shape,r=new google.maps.Circle({fillColor:this.circleOption.fillColor,fillOpacity:this.circleOption.fillOpacity,strokeColor:this.circleOption.strokeColor,strokeWeight:this.circleOption.strokeWeight,clickable:this.circleOption.clickable,editable:this.circleOption.editable,draggable:this.circleOption.draggable,zIndex:this.circleOption.zIndex,map:this.map,center:a.center,radius:a.radius});l={type:"circle",overlay:r};this.addOverlay(l),this.isWorldView&&0===t&&this.map.fitBounds(r.getBounds())}else if("polygon"===i.type){var p=i.shape;(c=new google.maps.Polygon({paths:p.points,fillColor:this.polygonOption.fillColor,fillOpacity:this.polygonOption.fillOpacity,strokeColor:this.polygonOption.strokeColor,strokeWeight:this.polygonOption.strokeWeight,clickable:this.polygonOption.clickable,editable:this.polygonOption.editable,draggable:this.polygonOption.draggable,zIndex:this.polygonOption.zIndex})).setMap(this.map);l={type:"polygon",overlay:c};if(this.addOverlay(l),this.isWorldView&&0===t){n=new google.maps.LatLngBounds;for(var h=0;h<p.points.length;h++){s=new google.maps.LatLng(p.points[h].lat,p.points[h].lng);n.extend(s)}this.map.fitBounds(n)}}else if("rectangle"===i.type){var y=i.shape,g=new google.maps.Rectangle({fillColor:this.rectangleOption.fillColor,fillOpacity:this.rectangleOption.fillOpacity,strokeColor:this.rectangleOption.strokeColor,strokeWeight:this.rectangleOption.strokeWeight,clickable:this.rectangleOption.clickable,editable:this.rectangleOption.editable,draggable:this.rectangleOption.draggable,zIndex:this.rectangleOption.zIndex,map:this.map,bounds:{north:y.northEastBound.lat,south:y.southWestBound.lat,east:y.northEastBound.lng,west:y.southWestBound.lng}});l={type:"rectangle",overlay:g};this.addOverlay(l),this.isWorldView&&0===t&&this.map.fitBounds(g.getBounds())}else if("polyline"===i.type){var c;p=i.shape;(c=new google.maps.Polygon({paths:p.points,fillColor:this.polygonOption.fillColor,fillOpacity:this.polygonOption.fillOpacity,strokeColor:this.polygonOption.strokeColor,strokeWeight:this.polygonOption.strokeWeight,clickable:this.polygonOption.clickable,editable:this.polygonOption.editable,draggable:this.polygonOption.draggable,zIndex:this.polygonOption.zIndex})).setMap(this.map);l={type:"polyline",overlay:c};if(this.addOverlay(l),this.isWorldView&&0===t){for(n=new google.maps.LatLngBounds,h=0;h<p.points.length;h++){s=new google.maps.LatLng(p.points[h].lat,p.points[h].lng);n.extend(s)}this.map.fitBounds(n)}}}},e.prototype.showError=function(e,t){this.showErrors&&(t?console.error("ngx-google-map-helper: "+e,t):console.error("ngx-google-map-helper: "+e))},e.decorators=[{type:i.Component,args:[{selector:"ngx-google-map-helper",template:'\r\n<div class="map-wrapper" [ngStyle]="{\'width\': mapWidth, \'height\': mapHeight}">\r\n <div id="map" class="google-map" style="height:100%; margin: 0"></div>\r\n</div>\r\n\r\n ',styles:[".map-wrapper{position:relative;left:0;bottom:0}"]}]}],e.ctorParameters=function(){return[{type:i.ElementRef},{type:n}]},e.propDecorators={mapHeight:[{type:i.Input}],mapWidth:[{type:i.Input}],zoom:[{type:i.Input}],center:[{type:i.Input}],mapType:[{type:i.Input}],placeMarkerOnClick:[{type:i.Input}],showControl:[{type:i.Input}],position:[{type:i.Input}],showModes:[{type:i.Input}],locationAccess:[{type:i.Input}],commonOption:[{type:i.Input}],circleOption:[{type:i.Input}],polygonOption:[{type:i.Input}],polylineOption:[{type:i.Input}],rectangleOption:[{type:i.Input}],markerOption:[{type:i.Input}],customButtons:[{type:i.Input}],onlyCustomButtons:[{type:i.Input}],googleMapObjects:[{type:i.Input}],showErrors:[{type:i.Input}],shapes:[{type:i.Input}],mapClicked:[{type:i.Output}],overlayCompleted:[{type:i.Output}],overlaySelected:[{type:i.Output}],saveSeleted:[{type:i.Output}],saveAll:[{type:i.Output}]},e}(),t=function(){function t(){}return t.forRoot=function(e){return{ngModule:t,providers:[{provide:l,useValue:e}]}},t.decorators=[{type:i.NgModule,args:[{imports:[o.CommonModule],declarations:[u],exports:[u],providers:[n]}]}],t}();e.NgxGoogleMapHelperService=n,e.NgxGoogleMapHelperComponent=u,e.NgxGoogleMapHelperModule=t,e.ɵa=l,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-google-map-helper",["exports","@angular/core","@angular/common"],t):t(e["ngx-google-map-helper"]={},e.ng.core,e.ng.common)}(this,function(e,i,o){"use strict";var l=function v(){this.apiKey=""},n=function(){function e(e){this.apiKey="",e&&(this.apiKey=e.apiKey)}return e.prototype.getApiKey=function(){return this.apiKey},e.decorators=[{type:i.Injectable,args:[{providedIn:"root"}]},{type:i.Injectable}],e.ctorParameters=function(){return[{type:l,decorators:[{type:i.Optional}]}]},e}();function f(e){var t="function"==typeof Symbol&&e[Symbol.iterator],i=0;return t?t.call(e):{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}}}var h={clear:'<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',"delete":'<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 24 24"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM8 9h8v10H8V9zm7.5-5l-1-1h-5l-1 1H5v2h14V4z"/><path fill="none" d="M0 0h24v24H0V0z"/></svg>',save:'<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 24 24"><path d="M19 12v7H5v-7H3v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zm-6 .67l2.59-2.58L17 11.5l-5 5-5-5 1.41-1.41L11 12.67V3h2z"/><path fill="none" d="M0 0h24v24H0z"/></svg>',saveAll:'<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z"/></svg>',undo:'<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>'},s=["marker","circle","polygon","polyline","rectangle"],a=["TOP_CENTER","TOP_LEFT","TOP_RIGHT","BOTTOM_CENTER","BOTTOM_LEFT","BOTTOM_RIGHT"],r={fillColor:"#005696",fillOpacity:.2,strokeColor:"#005696",strokeWeight:3,clickable:!0,editable:!0,draggable:!0,zIndex:1},p={animation:"DROP",draggable:!0,title:"",icon:null},y=[{key:"undo",label:"Undo"},{key:"clear",label:"Clear All"},{key:"delete",label:"Delete Selected"},{key:"save",label:"Save Selected"},{key:"saveAll",label:"Save All"}],g="500px",c="100%",d=10,m={lat:-34.397,lng:150.644},u=function(){function e(e,t){this.elementRef=e,this.mapHeight=g,this.mapWidth=c,this.zoom=d,this.center=null,this.mapType="ROADMAP",this.placeMarkerOnClick=!1,this.showControl=!0,this.position=a[0],this.showModes=s,this.locationAccess=!1,this.commonOption=r,this.markerOption=p,this.customButtons=!0,this.onlyCustomButtons=[],this.googleMapObjects=!1,this.showErrors=!0,this.shapes=[],this.mapClicked=new i.EventEmitter,this.overlayCompleted=new i.EventEmitter,this.overlaySelected=new i.EventEmitter,this.saveSeleted=new i.EventEmitter,this.saveAll=new i.EventEmitter,this.isWorldView=!1,this.allOverlays=[],this.customButtonsList=y,this.apiKey=t.getApiKey()}return e.prototype.ngOnInit=function(){var t=this;console.log(this.shapes),this.apiKey&&""!==this.apiKey?(Promise.all([this.lazyLoadMap()]).then(function(e){return t.initMap()}),this.initOverlayOptions()):this.showError("google map key required, include in forroot()",null)},e.prototype.checkValues=function(){this.mapWidth||(this.mapWidth=c),this.mapHeight||(this.mapHeight=g),this.zoom||(this.zoom=d)},e.prototype.lazyLoadMap=function(){var o=this;return new Promise(function(e,t){if("object"==typeof google&&"object"==typeof google.maps)e();else{var i=document.createElement("script");i.setAttribute("id","googleMap"),i.type="text/javascript",i.src="https://maps.googleapis.com/maps/api/js?key="+o.apiKey+"&libraries=drawing",o.elementRef.nativeElement.appendChild(i)}setTimeout(function(){e()},1e3)})},e.prototype.initOverlayOptions=function(){this.circleOption||(this.circleOption=this.commonOption),this.polygonOption||(this.polygonOption=this.commonOption),this.polylineOption||(this.polylineOption=this.commonOption),this.rectangleOption||(this.rectangleOption=this.commonOption)},e.prototype.initMap=function(){var t=this;this.locationAccess&&navigator?navigator.geolocation.getCurrentPosition(function(e){t.center.lng=+e.coords.longitude,t.center.lat=+e.coords.latitude,t.setUpMap(!1)},function(e){t.setUpMap(!0),t.isWorldView=!0,t.showError("error while reading location",null)}):(this.setUpMap(!0),this.isWorldView=!0,this.locationAccess&&this.showError("please allow location access on browser",null))},e.prototype.setUpWorldView=function(){var e=new google.maps.LatLngBounds(new google.maps.LatLng(85,-180),new google.maps.LatLng(-85,180)),t=e.getNorthEast().lat()-5,i=e.getNorthEast().lng()-5,o=e.getSouthWest().lat()+5,l=e.getSouthWest().lng()+5,n=new google.maps.LatLng(t,i),s=new google.maps.LatLng(o,l),a=new google.maps.LatLngBounds(s,n);this.map.fitBounds(a)},e.prototype.setUpMap=function(e){var t;this.center?(t=this.center,e=this.isWorldView=!1):t=m,this.map=new google.maps.Map(document.getElementById("map"),{center:{lat:t.lat,lng:t.lng},zoom:this.zoom,minZoom:2,mapTypeId:google.maps.MapTypeId[this.mapType],styles:[{featureType:"administrative.province",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"administrative.locality",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"administrative.neighborhood",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"administrative.land_parcel",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"landscape",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{color:"#e9e5dc"}]},{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#b8cb93"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"poi.attraction",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.business",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.business",elementType:"geometry.fill",stylers:[{visibility:"on"}]},{featureType:"poi.government",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.government",elementType:"geometry.fill",stylers:[{visibility:"on"}]},{featureType:"poi.medical",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.medical",elementType:"geometry.fill",stylers:[{visibility:"on"}]},{featureType:"poi.park",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#ccdca1"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{visibility:"on"}]},{featureType:"poi.place_of_worship",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.school",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.sports_complex",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"road",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{hue:"#ff0000"},{saturation:-100},{lightness:99}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#808080"},{lightness:54},{visibility:"off"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#767676"}]},{featureType:"road",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]},{featureType:"transit.station.airport",elementType:"labels.text.fill",stylers:[{visibility:"on"}]},{featureType:"transit.station.airport",elementType:"labels.icon",stylers:[{visibility:"on"}]},{featureType:"water",elementType:"all",stylers:[{saturation:43},{lightness:-11},{color:"#89cada"}]},{featureType:"water",elementType:"geometry",stylers:[{visibility:"on"}]}]}),e&&this.setUpWorldView(),this.placeMarkerOnClick?google.maps.event.addListener(this.map,"click",function(e){this.placeMarker(e.latLng),this.mapClicked.emit(e)}.bind(this)):google.maps.event.addListener(this.map,"click",function(e){this.mapClicked.emit(e)}.bind(this)),this.drawingManager=new google.maps.drawing.DrawingManager({drawingMode:google.maps.drawing.OverlayType.MARKER,drawingControl:this.showControl,drawingControlOptions:{position:google.maps.ControlPosition[this.position],drawingModes:this.showModes},markerOptions:{icon:this.markerOption.icon,title:this.markerOption.title,animation:google.maps.Animation[this.markerOption.animation],draggable:this.markerOption.draggable},circleOptions:{fillColor:this.circleOption.fillColor,fillOpacity:this.circleOption.fillOpacity,strokeColor:this.circleOption.strokeColor,strokeWeight:this.circleOption.strokeWeight,clickable:this.circleOption.clickable,editable:this.circleOption.editable,draggable:this.circleOption.draggable,zIndex:this.circleOption.zIndex},polygonOptions:{fillColor:this.polygonOption.fillColor,fillOpacity:this.polygonOption.fillOpacity,strokeColor:this.polygonOption.strokeColor,strokeWeight:this.polygonOption.strokeWeight,clickable:this.polygonOption.clickable,editable:this.polygonOption.editable,draggable:this.polygonOption.draggable,zIndex:this.polygonOption.zIndex},rectangleOptions:{fillColor:this.rectangleOption.fillColor,fillOpacity:this.rectangleOption.fillOpacity,strokeColor:this.rectangleOption.strokeColor,strokeWeight:this.rectangleOption.strokeWeight,clickable:this.rectangleOption.clickable,editable:this.rectangleOption.editable,draggable:this.rectangleOption.draggable,zIndex:this.rectangleOption.zIndex},polylineOptions:{fillColor:this.polylineOption.fillColor,fillOpacity:this.polylineOption.fillOpacity,strokeColor:this.polylineOption.strokeColor,strokeWeight:this.polylineOption.strokeWeight,clickable:this.polylineOption.clickable,editable:this.polylineOption.editable,draggable:this.polylineOption.draggable,zIndex:this.polylineOption.zIndex}}),this.drawingManager.setMap(this.map),google.maps.event.addListener(this.drawingManager,"overlaycomplete",function(e){if(this.addOverlay(e),this.googleMapObjects)this.overlayCompleted.emit(e);else{var t=this.getOverlayType(e);this.overlayCompleted.emit(t)}}.bind(this)),this.customButtons&&this.initCustomButtons(this.map),this.shapes&&0<this.shapes.length&&this.loadShapeToMap(this.shapes)},e.prototype.addOverlay=function(e){if(this.allOverlays&&this.allOverlays.push(e),e.type!==google.maps.drawing.OverlayType.MARKER){this.drawingManager.setDrawingMode(null);var t=e.overlay;t.type=e.type,google.maps.event.addListener(t,"click",function(){this.setSelection(t)}.bind(this)),this.setSelection(t)}},e.prototype.placeMarker=function(e){var t={type:"marker",overlay:new google.maps.Marker({position:e,map:this.map,icon:this.markerOption.icon,title:this.markerOption.title,animation:google.maps.Animation[this.markerOption.animation],draggable:this.markerOption.draggable})};this.addOverlay(t)},e.prototype.initCustomButtons=function(l){var e,t,i=this,o=this.customButtonsList;if(this.onlyCustomButtons&&0<this.onlyCustomButtons.length&&(o=this.customButtonsList.filter(function(e){return i.onlyCustomButtons.includes(e.key)})),o&&0<o.length){var n=function(e){var t=document.createElement("div");t.style.marginRight="2px";var i=document.createElement("div");i.style.backgroundColor="#fff",i.style.border="2px solid #fff",i.style.borderRadius="3px",i.style.boxShadow="0 2px 6px rgba(0,0,0,.3)",i.style.cursor="pointer",i.style.marginTop="5px",i.style.marginBottom="5px",i.style.width="23px",i.style.height="20px",i.style.textAlign="center",i.title=e.label,t.appendChild(i);var o=document.createElement("div");o.style.color="rgb(25,25,25)",o.style.fontFamily="Roboto,Arial,sans-serif",o.style.fontSize="12px",o.style.lineHeight="20px",o.style.paddingLeft="3px",o.style.paddingRight="3px",o.innerHTML="<span> "+h[e.key]+" </span>",i.appendChild(o),i.addEventListener("click",function(){this.handleCustomButtonEvent(e.key)}.bind(s)),l.controls[google.maps.ControlPosition[s.position]].push(t)},s=this;try{for(var a=f(o),r=a.next();!r.done;r=a.next()){n(r.value)}}catch(p){e={error:p}}finally{try{r&&!r.done&&(t=a["return"])&&t.call(a)}finally{if(e)throw e.error}}}else this.showError("please check onlyCustomButtons property",this.onlyCustomButtons)},e.prototype.handleCustomButtonEvent=function(e){switch(e){case"undo":this.undoShape();break;case"clear":this.deleteAllShape();break;case"delete":this.deleteSelectedShape();break;case"save":this.saveSelectedShape();break;case"saveAll":this.saveAllShape()}},e.prototype.setSelection=function(e){if(this.clearSelection(),(this.selectedShape=e).setEditable(!0),this.googleMapObjects)this.overlaySelected.emit(e);else{var t=this.getOverlayType(e);this.overlaySelected.emit(t)}},e.prototype.clearSelection=function(){this.selectedShape&&(this.selectedShape.setEditable(!1),this.selectedShape=null)},e.prototype.deleteSelectedShape=function(){this.selectedShape&&this.selectedShape.setMap(null)},e.prototype.saveSelectedShape=function(){if(this.googleMapObjects)this.saveSeleted.emit(this.selectedShape);else if(this.selectedShape){var e=this.getOverlayType(this.selectedShape);this.saveSeleted.emit(e),console.log(e)}},e.prototype.deleteAllShape=function(){for(var e=0;e<this.allOverlays.length;e++)this.allOverlays[e].overlay.setMap(null);this.allOverlays=[]},e.prototype.undoShape=function(){this.allOverlays!==undefined&&null!==this.allOverlays&&1<=this.allOverlays.length&&(this.allOverlays[this.allOverlays.length-1].overlay.setMap(null),this.allOverlays.pop())},e.prototype.saveAllShape=function(){var e,t;if(this.allOverlays&&0<this.allOverlays.length)if(this.googleMapObjects)this.saveAll.emit(this.allOverlays);else{var i=[];try{for(var o=f(this.allOverlays),l=o.next();!l.done;l=o.next()){var n=l.value;if(n){var s=this.getOverlayType(n);s&&i.push(s)}}}catch(a){e={error:a}}finally{try{l&&!l.done&&(t=o["return"])&&t.call(o)}finally{if(e)throw e.error}}this.saveAll.emit(i)}},e.prototype.getOverlayType=function(e){var t,i,o=null,l=null;if(e.map)l=e;else{if(!e.overlay.map)return void this.showError("Error while reading overlay, try googleMapObjects = true",e);l=e.overlay}if("circle"===e.type){var n={center:s={lat:l.center.lat(),lng:l.center.lng()},radius:l.radius};o={type:e.type,shape:n}}else if("polygon"===e.type||"polyline"===e.type){var s={lat:l.map.center.lat(),lng:l.map.center.lng()},a=l.latLngs.j[0].j,r=[];try{for(var p=f(a),h=p.next();!h.done;h=p.next()){var y=h.value,g={lat:y.lat(),lng:y.lng()};r.push(g)}}catch(v){t={error:v}}finally{try{h&&!h.done&&(i=p["return"])&&i.call(p)}finally{if(t)throw t.error}}var c={center:s,points:r};o={type:e.type,shape:c}}else if("rectangle"===e.type){s={lat:l.map.center.lat(),lng:l.map.center.lng()};var d=l.getBounds(),m={center:s,northEastBound:{lat:d.getNorthEast().lat(),lng:d.getNorthEast().lng()},southWestBound:{lat:d.getSouthWest().lat(),lng:d.getSouthWest().lng()}};o={type:e.type,shape:m}}else if("marker"===e.type){var u={center:s={lat:l.map.center.lat(),lng:l.map.center.lng()},position:{lat:l.position.lat(),lng:l.position.lng()}};o={type:e.type,shape:u}}return o},e.prototype.loadShapeToMap=function(e){if(e&&0<e.length)for(var t=0;t<e.length;t++){var i=e[t];if("marker"===i.type){var o=i.shape,l={type:"marker",overlay:new google.maps.Marker({position:o.position,map:this.map,icon:this.markerOption.icon,title:this.markerOption.title,animation:google.maps.Animation[this.markerOption.animation],draggable:this.markerOption.draggable})};if(this.addOverlay(l),this.isWorldView&&0===t){var n=new google.maps.LatLngBounds,s=new google.maps.LatLng(o.position.lat,o.position.lng);n.extend(s),this.map.fitBounds(n)}}else if("circle"===i.type){var a=i.shape,r=new google.maps.Circle({fillColor:this.circleOption.fillColor,fillOpacity:this.circleOption.fillOpacity,strokeColor:this.circleOption.strokeColor,strokeWeight:this.circleOption.strokeWeight,clickable:this.circleOption.clickable,editable:this.circleOption.editable,draggable:this.circleOption.draggable,zIndex:this.circleOption.zIndex,map:this.map,center:a.center,radius:a.radius});l={type:"circle",overlay:r};this.addOverlay(l),this.isWorldView&&0===t&&this.map.fitBounds(r.getBounds())}else if("polygon"===i.type){var p=i.shape;(c=new google.maps.Polygon({paths:p.points,fillColor:this.polygonOption.fillColor,fillOpacity:this.polygonOption.fillOpacity,strokeColor:this.polygonOption.strokeColor,strokeWeight:this.polygonOption.strokeWeight,clickable:this.polygonOption.clickable,editable:this.polygonOption.editable,draggable:this.polygonOption.draggable,zIndex:this.polygonOption.zIndex})).setMap(this.map);l={type:"polygon",overlay:c};if(this.addOverlay(l),this.isWorldView&&0===t){n=new google.maps.LatLngBounds;for(var h=0;h<p.points.length;h++){s=new google.maps.LatLng(p.points[h].lat,p.points[h].lng);n.extend(s)}this.map.fitBounds(n)}}else if("rectangle"===i.type){var y=i.shape,g=new google.maps.Rectangle({fillColor:this.rectangleOption.fillColor,fillOpacity:this.rectangleOption.fillOpacity,strokeColor:this.rectangleOption.strokeColor,strokeWeight:this.rectangleOption.strokeWeight,clickable:this.rectangleOption.clickable,editable:this.rectangleOption.editable,draggable:this.rectangleOption.draggable,zIndex:this.rectangleOption.zIndex,map:this.map,bounds:{north:y.northEastBound.lat,south:y.southWestBound.lat,east:y.northEastBound.lng,west:y.southWestBound.lng}});l={type:"rectangle",overlay:g};this.addOverlay(l),this.isWorldView&&0===t&&this.map.fitBounds(g.getBounds())}else if("polyline"===i.type){var c;p=i.shape;(c=new google.maps.Polygon({paths:p.points,fillColor:this.polygonOption.fillColor,fillOpacity:this.polygonOption.fillOpacity,strokeColor:this.polygonOption.strokeColor,strokeWeight:this.polygonOption.strokeWeight,clickable:this.polygonOption.clickable,editable:this.polygonOption.editable,draggable:this.polygonOption.draggable,zIndex:this.polygonOption.zIndex})).setMap(this.map);l={type:"polyline",overlay:c};if(this.addOverlay(l),this.isWorldView&&0===t){for(n=new google.maps.LatLngBounds,h=0;h<p.points.length;h++){s=new google.maps.LatLng(p.points[h].lat,p.points[h].lng);n.extend(s)}this.map.fitBounds(n)}}}},e.prototype.showError=function(e,t){this.showErrors&&(t?console.error("ngx-google-map-helper: "+e,t):console.error("ngx-google-map-helper: "+e))},e.decorators=[{type:i.Component,args:[{selector:"ngx-google-map-helper",template:'\r\n<div class="map-wrapper" [ngStyle]="{\'width\': mapWidth, \'height\': mapHeight}">\r\n <div id="map" class="google-map" style="height:100%; margin: 0"></div>\r\n</div>\r\n\r\n ',styles:[".map-wrapper{position:relative;left:0;bottom:0}"]}]}],e.ctorParameters=function(){return[{type:i.ElementRef},{type:n}]},e.propDecorators={mapHeight:[{type:i.Input}],mapWidth:[{type:i.Input}],zoom:[{type:i.Input}],center:[{type:i.Input}],mapType:[{type:i.Input}],placeMarkerOnClick:[{type:i.Input}],showControl:[{type:i.Input}],position:[{type:i.Input}],showModes:[{type:i.Input}],locationAccess:[{type:i.Input}],commonOption:[{type:i.Input}],circleOption:[{type:i.Input}],polygonOption:[{type:i.Input}],polylineOption:[{type:i.Input}],rectangleOption:[{type:i.Input}],markerOption:[{type:i.Input}],customButtons:[{type:i.Input}],onlyCustomButtons:[{type:i.Input}],googleMapObjects:[{type:i.Input}],showErrors:[{type:i.Input}],shapes:[{type:i.Input}],mapClicked:[{type:i.Output}],overlayCompleted:[{type:i.Output}],overlaySelected:[{type:i.Output}],saveSeleted:[{type:i.Output}],saveAll:[{type:i.Output}]},e}(),t=function(){function t(){}return t.forRoot=function(e){return{ngModule:t,providers:[{provide:l,useValue:e}]}},t.decorators=[{type:i.NgModule,args:[{imports:[o.CommonModule],declarations:[u],exports:[u],providers:[n]}]}],t}();e.NgxGoogleMapHelperService=n,e.NgxGoogleMapHelperComponent=u,e.NgxGoogleMapHelperModule=t,e.ɵa=l,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngx-google-map-helper.umd.min.js.map |
@@ -248,3 +248,3 @@ import { Injectable, Optional, Component, ElementRef, Input, Output, EventEmitter, NgModule } from '@angular/core'; | ||
this.isWorldView = true; | ||
this.showError('error while reading location', this.onlyCustomButtons); | ||
this.showError('error while reading location', null); | ||
})); | ||
@@ -256,3 +256,3 @@ } | ||
if (this.locationAccess) { | ||
this.showError('please allow location access on browser', this.onlyCustomButtons); | ||
this.showError('please allow location access on browser', null); | ||
} | ||
@@ -744,2 +744,8 @@ } | ||
}); | ||
/** @type {?} */ | ||
const overlay = { | ||
type: 'marker', | ||
overlay: marker | ||
}; | ||
this.addOverlay(overlay); | ||
} | ||
@@ -746,0 +752,0 @@ // Initialize custom buttons |
@@ -271,3 +271,3 @@ import { __values } from 'tslib'; | ||
_this.isWorldView = true; | ||
_this.showError('error while reading location', _this.onlyCustomButtons); | ||
_this.showError('error while reading location', null); | ||
})); | ||
@@ -279,3 +279,3 @@ } | ||
if (this.locationAccess) { | ||
this.showError('please allow location access on browser', this.onlyCustomButtons); | ||
this.showError('please allow location access on browser', null); | ||
} | ||
@@ -788,2 +788,8 @@ } | ||
}); | ||
/** @type {?} */ | ||
var overlay = { | ||
type: 'marker', | ||
overlay: marker | ||
}; | ||
this.addOverlay(overlay); | ||
}; | ||
@@ -790,0 +796,0 @@ // Initialize custom buttons |
{ | ||
"name": "ngx-google-map-helper", | ||
"description": "An angular package for using drawing control options of Google Map API", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"author": { | ||
@@ -32,2 +32,3 @@ "name": "Imanshu Jayasinghe", | ||
"google map API", | ||
"googlemaps", | ||
"drawing controls" | ||
@@ -34,0 +35,0 @@ ], |
# Google Map Drawing Controls for Angular (NgxGoogleMapHelper) | ||
[![Build Status](https://travis-ci.org/imanshu15/ngx-google-map-helper.svg?branch=master)](https://travis-ci.org/imanshu15/ngx-google-map-helper) [![Fork](https://img.shields.io/github/forks/imanshu15/ngx-google-map-helper.svg?label=Forks&style=social)](https://github.com/imanshu15/ngx-google-map-helper) | ||
[![Build Status](https://travis-ci.org/imanshu15/ngx-google-map-helper.svg?branch=master)](https://travis-ci.org/imanshu15/ngx-google-map-helper) [![NpmVersion](https://img.shields.io/npm/v/ngx-google-map-helper.svg)](https://www.npmjs.com/package/ngx-google-map-helper) [![Downloads](https://img.shields.io/npm/dt/ngx-google-map-helper.svg)](https://www.npmjs.com/package/ngx-google-map-helper) [![Fork](https://img.shields.io/github/forks/imanshu15/ngx-google-map-helper.svg?label=Forks&style=social)](https://github.com/imanshu15/ngx-google-map-helper) | ||
@@ -11,3 +11,4 @@ An angular package for using drawing control options of Google Map API. It provides following features, | ||
You can check it online through here [NGXGoogleMapHelper Demo](https://imanshu15.github.io/ngx-google-map-helper/) | ||
You can check it online through here [NGXGoogleMapHelperDemo](https://imanshu15.github.io/ngx-google-map-helper/) | ||
![](assets/map-helper.png) | ||
@@ -17,4 +18,2 @@ | ||
NgxGoogleMapHelper requires [Angular](https://angular.io/) v7+ to run. | ||
Install using npm, | ||
@@ -42,2 +41,6 @@ ```sh | ||
Refer to main app in this repository for working example. | ||
Or this [Stackblitz Demo](https://stackblitz.com/edit/ngx-google-map-helper-demo) (Please change the API Key with your key in app.module , | ||
If the map is not loaded please try - Open In New Window option.) | ||
After importing ```NgxGoogleMapHelperModule``` in your module file just use the ```ngx-google-map-helper``` component as below, | ||
@@ -51,3 +54,2 @@ ```html | ||
[mapWidth] = "'50%'"> </ngx-google-map-helper> | ||
</form> | ||
@@ -54,0 +56,0 @@ ``` |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
771457
7770
123