bluehalo / ngx-leaflet-draw

MIT License
88 stars 29 forks source link

Params are not working properly #97

Closed thecodeb closed 3 years ago

thecodeb commented 3 years ago

Hello! I hope you can answer this issue, for sure it´s something I´m doing wrong but...hope to solve it soon.

I´ve created the map component and the html and this is the code:

HTML:

        <div class="col grey p-0 m-0" leaflet leafletDraw [leafletOptions]="options" [(leafletCenter)]="center" [leafletFitBounds]="fitBounds" [leafletFitBoundsOptions]="fitBoundsOptions" (leafletDrawCreated)="onDrawCreated($event)" (leafletDrawEditStop)="onDrawEditStop($event)"
            [leafletDrawLocal]="drawLocalOptions" (leafletDrawStop)="test($event)">
            <div [leafletLayer]="drawItems"></div>
        </div>

TS (Only ngx-leaflet options):

options = {
    layers: [
      tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
        maxZoom: 19,
        attribution:
          '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
      }),
    ],
    zoom: 17
  };

  center = latLng(lat, lng);

  zoomControl = {position: 'bottomright'};

  fitBounds: number[][] = [[0,0]];

  fitBoundsOptions: any = {
    maxZoom: 17,
    animated: true
  };

  tree: TreeviewItem[];

  drawItems: FeatureGroup = featureGroup();

  readonly drawOptions = {
    position: 'topright',
    draw: {
      circle: false,
      circlemarker: false
    },
    edit: {
      featureGroup: this.drawItems,
      remove: false
    }
  };

  readonly drawLocalOptions = {
    draw: {
      toolbar: {
        buttons: {
          polyline: 'Medir línea',
          polygon: 'Medir área',
          rectangle: 'Zoombox',
          marker: 'Obtener coordenadas'
        }
      },
      handlers: {
        polyline: {
          tooltip: {
            start: 'Start',
            edit: 'Edit'
          }
        }
      }
    }
  };

The problem here is that POSITION param is not working anycase and DRAW params like circle or circlemarker that I´ve put in FALSE are not working too.

What can be the problem?

thecodeb commented 3 years ago

Solved, was an issue with map div