Skip to content

Commit 02ebdf0

Browse files
committed
feat(ngx-ukis-ui-clarity): use bbox and nativeBbox in zoom to layer - LayerControl
1 parent 5cc1902 commit 02ebdf0

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

projects/ngx-ukis-ui-clarity/src/lib/layerentry-group/layerentry-group.component.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ enum EactiveTabs {
2323
type TactiveTabs = keyof typeof EactiveTabs;
2424

2525
@Component({
26-
selector: 'ukis-layerentry-group',
27-
templateUrl: './layerentry-group.component.html',
28-
styleUrls: ['./layerentry-group.component.scss'],
29-
imports: [ClrIconModule, NgClass, ClrCommonFormsModule, CdkDropList, CdkDrag, LayerentryComponent, CdkDragHandle, ItemsFilterPipe, ReversePipe, DynamicComponent]
26+
selector: 'ukis-layerentry-group',
27+
templateUrl: './layerentry-group.component.html',
28+
styleUrls: ['./layerentry-group.component.scss'],
29+
imports: [ClrIconModule, NgClass, ClrCommonFormsModule, CdkDropList, CdkDrag, LayerentryComponent, CdkDragHandle, ItemsFilterPipe, ReversePipe, DynamicComponent]
3030
})
3131
export class LayerentryGroupComponent implements OnInit {
3232
@HostBinding('class.group-visible') get visible() { return this.group.visible; }
@@ -77,7 +77,7 @@ export class LayerentryGroupComponent implements OnInit {
7777
if (Object.keys(EactiveTabs).includes(this.group.expanded.tab)) {
7878
this.switchTab(this.group.expanded.tab as TactiveTabs);
7979
/** let the user reset the default open tab */
80-
if(this.group.expanded.expanded === false){
80+
if (this.group.expanded.expanded === false) {
8181
this.activeTabs[this.group.expanded.tab] = false;
8282
}
8383
} else {
@@ -187,8 +187,13 @@ export class LayerentryGroupComponent implements OnInit {
187187

188188

189189
zoomTo(group: LayerGroup) {
190-
if (this.mapState && group.bbox && group.bbox.length >= 4) {
191-
this.mapState.setExtent(group.bbox);
190+
if (this.mapState) {
191+
const state = this.mapState.getMapState().value;
192+
if (group.bbox && group?.nativeBbox?.epsg !== state?.proj?.epsg) {
193+
this.mapState.setExtent(group.bbox);
194+
} else if (group.nativeBbox && group.nativeBbox.epsg === state?.proj?.epsg) {
195+
this.mapState.setNativeExtent(group.nativeBbox.bbox)
196+
}
192197
}
193198
}
194199

projects/ngx-ukis-ui-clarity/src/lib/layerentry/layerentry.component.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,13 @@ export class LayerentryComponent implements OnInit {
257257
}
258258

259259
zoomTo(layer: Layer) {
260-
if (this.mapState && layer.bbox && layer.bbox.length >= 4) {
261-
this.mapState.setExtent(layer.bbox as [number, number, number, number]);
260+
if (this.mapState) {
261+
const state = this.mapState.getMapState().value;
262+
if (layer.bbox && layer?.nativeBbox?.epsg !== state?.proj?.epsg) {
263+
this.mapState.setExtent(layer.bbox);
264+
} else if (layer.nativeBbox && layer.nativeBbox.epsg === state?.proj?.epsg) {
265+
this.mapState.setNativeExtent(layer.nativeBbox.bbox);
266+
}
262267
}
263268
}
264269

0 commit comments

Comments
 (0)