Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw circle dosent show as Point #68

Open
Zeroooo0 opened this issue Jan 2, 2025 · 0 comments
Open

Draw circle dosent show as Point #68

Zeroooo0 opened this issue Jan 2, 2025 · 0 comments

Comments

@Zeroooo0
Copy link

Zeroooo0 commented Jan 2, 2025

Draw circle shows only one point in coordinates and when it is returned it returns only point not draw circle from db
Here is value what i get when i draw circle and also doesn't update state on change:

array:3 [▼ 
  "lat" => 42.640020373863
  "lng" => 19.703979492188
  "geojson" => array:2 [▼
    "type" => "FeatureCollection"
    "features" => array:1 [▼
      0 => array:3 [▼
        "type" => "Feature"
        "properties" => []
        "geometry" => array:2 [▼
          "type" => "Point"
          "coordinates" => array:2 [▼
            0 => 18.792114
            1 => 42.425484
          ]
        ]
      ]
    ]
  ]
]

Also the filament form is here:

Map::make('configuration.location')
                                ->label('Location')
                                ->columnSpan('full')
                                ->defaultLocation(latitude: 42.6939651, longitude: 19.3933591)
                                ->afterStateUpdated(function (Set $set, ?array $state): void {
                                    dd($state);
                                    $set('latitude',  $state['lat']);
                                    $set('longitude', $state['lng']);
                                    !in_array('geojson', $state) ??
                                        $set('geojson',   $state['geojson']);
                                })
                                ->afterStateHydrated(function ($state, $record, Set $set): void {
                                    $locationData = $record?->configuration['location'];
                                    // dd($locationData);
                                    !$locationData ??
                                        $set(
                                            'location',
                                            [
                                                'lat'     => $locationData['lat'],
                                                'lng'     => $locationData['lng'],
                                                'geojson' => $locationData['geojson']
                                            ]
                                        );
                                })
                                ->extraStyles([
                                    'min-height: 500px',
                                    'width: 100%'

                                ])
                                ->liveLocation(true, true, 5000)
                                ->showMarker(false)
                                ->markerColor("#22c55eff")
                                ->markerIconSize([32, 32])
                                ->markerIconAnchor([16, 32])
                                ->showFullscreenControl()
                                ->showZoomControl()
                                ->draggable()
                                ->zoom(9)
                                ->detectRetina()
                                ->showMyLocationButton()
                                ->geoMan(true)
                                ->geoManEditable(true)
                                ->geoManPosition('topleft')
                                ->drawCircleMarker(false)
                                ->rotateMode()
                                ->clickable(true) //click to move marker
                                ->drawMarker(false)
                                ->drawPolygon()
                                ->drawPolyline(false)
                                ->drawCircle()
                                ->dragMode()
                                ->cutPolygon()
                                ->editPolygon()
                                ->deleteLayer()
                                ->setColor('#3388ff')
                                ->setFilledColor('#cad9ec')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant