Draw toolbar - hslayers/hslayers-ng GitHub Wiki

Draw toolbar

Draw toolbar component

Config parameters

List of useful config parameters for the draw toolbar can be found here:

componentsEnabled

defaultDrawLayerPath

openQueryPanelOnDrawEnd

preserveLastSketchPoint

Enable/disable

import {HsConfig} from 'hslayers-ng/config';
@Component({
  selector: 'your-app-component',
  templateUrl: 'your-app-component.html',
})
export class YourAppComponent {
  constructor(hsConfig: HsConfig) {
    this.HsConfig.update({
      componentsEnabled: {
        toolbar: true, //(true by default)
        guiOverlay: true, //(true by default)
        drawToolbar: true, //(true by default)
      }
    });
  }
}

If not using HslayersModule containing all components

Add HsDrawModule import:

import {HsDrawModule} from 'hslayers-ng/components/draw';
@NgModule({
  imports: [HsDrawModule],
})
export class YourAppModule {}

Add HsDrawToolbarComponent component:

import {HsLayoutService } from 'hslayers-ng/core';
import {HsDrawToolbarComponent} from 'hslayers-ng/components/draw';
@Component({
  selector: 'your-app-component',
  templateUrl: 'your-app-component.html',
})
export class YourAppComponent {
  constructor(hsLayoutService: HsLayoutService) {
    hsLayoutService.createOverlay(HsDrawToolbarComponent, {});
  }
}