diff --git a/README.md b/README.md index 7814ffb..64b3c1a 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,12 @@ return [ ``` ```php -use Elbgoods\NovaMapboxMarkerField\NovaMapboxMarkerField; +use Elbgoods\NovaMapboxMarkerField\MapboxMarkerField; public function fields(Request $request) { return [ - NovaMapboxMarkerField::make('Marker') + MapboxMarkerField::make('Marker') ->longitude($this->longitude) ->latitude($this->latitude) ->zoom(8), diff --git a/resources/js/components/DetailField.vue b/resources/js/components/DetailField.vue index 305090e..62e635a 100644 --- a/resources/js/components/DetailField.vue +++ b/resources/js/components/DetailField.vue @@ -14,15 +14,7 @@ export default { props: ['index', 'resource', 'resourceName', 'resourceId', 'field'], data() { return { - map: null, - draw: null, - geoJsonSource: { - type: "geojson", - data: { - type: "Feature", - geometry: this.field.geoJson, - } - } + map: null }; }, mounted() { @@ -44,20 +36,8 @@ export default { showCompass: false }), 'top-left'); + // marker this.map.on('load', () => { - // shape - this.map.addSource('layer', this.geoJsonSource) - this.map.addLayer({ - id: 'layer', - type: 'fill', - source: 'layer', - layout: {}, - paint: { - 'fill-color': '#0080ff', // blue color fill - 'fill-opacity': 0.5 - } - }); - // marker new mapboxgl.Marker() .setLngLat([longitude, latitude]) .addTo(this.map); @@ -69,6 +49,6 @@ export default { @import "~mapbox-gl/dist/mapbox-gl.css"; #mapContainer { - height: 450px; + height: 480px; } diff --git a/src/NovaMapboxMarkerField.php b/src/MapboxMarkerField.php similarity index 94% rename from src/NovaMapboxMarkerField.php rename to src/MapboxMarkerField.php index 526b5bc..1633aee 100644 --- a/src/NovaMapboxMarkerField.php +++ b/src/MapboxMarkerField.php @@ -4,7 +4,7 @@ use Laravel\Nova\Fields\Field; -class NovaMapboxMarkerField extends Field +class MapboxMarkerField extends Field { public $component = 'nova-mapbox-marker-field';