File tree Expand file tree Collapse file tree 2 files changed +40
-2
lines changed
Expand file tree Collapse file tree 2 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -1081,6 +1081,7 @@ export function addCommands(
10811081 console . log ( 'shut up' ) ;
10821082 return ;
10831083 }
1084+
10841085 const layerParams : ILandmarkLayer = { extent, zoom } ;
10851086 const layerModel : IJGISLayer = {
10861087 type : 'LandmarkLayer' ,
@@ -1091,7 +1092,6 @@ export function addCommands(
10911092
10921093 current . model . addLayer ( newLandmarkId , layerModel ) ;
10931094
1094- // TODO Add to story when making landmark
10951095 // check for stories
10961096 const isStoriesExist =
10971097 Object . keys ( current . model . sharedModel . storiesMap ) . length !== 0 ;
Original file line number Diff line number Diff line change @@ -24,7 +24,11 @@ import React, {
2424
2525import { CommandIDs , icons } from '@/src/constants' ;
2626import { useGetSymbology } from '@/src/dialogs/symbology/hooks/useGetSymbology' ;
27- import { nonVisibilityIcon , visibilityIcon } from '@/src/icons' ;
27+ import {
28+ nonVisibilityIcon ,
29+ targetWithCenterIcon ,
30+ visibilityIcon ,
31+ } from '@/src/icons' ;
2832import { ILeftPanelClickHandlerParams } from '@/src/panelview/leftpanel' ;
2933import { LegendItem } from './legendItem' ;
3034
@@ -568,6 +572,26 @@ const LayerComponent: React.FC<ILayerProps> = props => {
568572 }
569573 } ;
570574
575+ /**
576+ * Set landmark layer to current map view.
577+ */
578+ const handleSetLandmarkToCurrentView = ( ) => {
579+ if ( ! gisModel ) {
580+ return ;
581+ }
582+ const { zoom, extent } = gisModel . getOptions ( ) ;
583+ const updatedLayer = {
584+ ...layer ,
585+ parameters : {
586+ ...layer . parameters ,
587+ zoom,
588+ extent,
589+ } ,
590+ } ;
591+
592+ gisModel . sharedModel . updateLayer ( layerId , updatedLayer ) ;
593+ } ;
594+
571595 return (
572596 < div
573597 className = { `${ LAYER_ITEM_CLASS } ${ LAYER_CLASS } ${ selected ? ' jp-mod-selected' : '' } ` }
@@ -644,6 +668,20 @@ const LayerComponent: React.FC<ILayerProps> = props => {
644668 { name }
645669 </ span >
646670 ) }
671+
672+ { layer . type === 'LandmarkLayer' && (
673+ < Button
674+ title = { 'Set landmark to current view' }
675+ onClick = { handleSetLandmarkToCurrentView }
676+ minimal
677+ >
678+ < LabIcon . resolveReact
679+ icon = { targetWithCenterIcon }
680+ className = { LAYER_ICON_CLASS }
681+ tag = "span"
682+ />
683+ </ Button >
684+ ) }
647685 </ div >
648686
649687 { /* Show legend only if supported symbology */ }
You can’t perform that action at this time.
0 commit comments