-
Notifications
You must be signed in to change notification settings - Fork 20
Creating new panels
Raitis Berzins edited this page May 20, 2022
·
20 revisions
Creating custom panels in the sidebar is possible in the Angular part of the application.
Your custom panel's component must implement HsPanelComponent
like this:
import {HsPanelBaseComponent} from 'hslayers-ng';
export class MyCoolComponent extends HsPanelBaseComponent implements OnInit {
name = 'cool';
constructor(private hsLayoutService: HsLayoutService) {
super(hsLayoutService);
}
ngOnInit(): void {
this.hsSidebarService.addButton(
{
panel: 'cool',
module: 'hs.legend',
order: 1,
fits: true,
title: 'PANEL_HEADER.COOL',
description: 'SIDEBAR.descriptions.COOL',
icon: 'icon-dotlist',
},
this.data.app
);
}
}
And then in your main.service.ts
:
import { Injectable } from '@angular/core';
import { HsSidebarService } from 'hslayers-ng/components/sidebar/sidebar.service';
import { HsPanelContainerService } from 'hslayers-ng/components/layout/panels/panel-container.service';
import { MyCoolComponent } from './cool.component';
@Injectable({providedIn: 'root'})
export class MainService {
constructor(
private hsPanelContainerService: HsPanelContainerService
) { }
init(): void {
this.hsPanelContainerService.create(MyCoolComponent, {});
}
}
Quick Links: Home ➖ App configuration ➖ Layer configuration ➖ Cesium configuration ➖ Composition schema (separate repo)