Skip to content

Commit

Permalink
Merge pull request #410 from wearepal/set-as-project-extent
Browse files Browse the repository at this point in the history
Set as project extent button in Snapshot Tool
  • Loading branch information
paulthatjazz authored Aug 22, 2024
2 parents ec497d0 + 6ea5744 commit 5df56fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/javascript/projects/analysis_panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ interface AnalysisPanelProps {
selectedLayer: Layer | null
layerStats: (layer: DatasetLayer | ModelOutputLayer) => BooleanTileGrid | NumericTileGrid | CategoricalTileGrid | null
currentTab: number
projectExtent: Extent
}

let dataSourceType: string = "null"
Expand All @@ -156,7 +157,7 @@ ChartTypeArray.set("NumericTileGrid", ["hist"])



export const AnalysisPanel = ({ selectedArea, setSelectedArea, setShowAP, selectedLayer, layerStats, currentTab }: AnalysisPanelProps) => {
export const AnalysisPanel = ({ selectedArea, setSelectedArea, setShowAP, selectedLayer, layerStats, currentTab, projectExtent }: AnalysisPanelProps) => {

const [chartType, setChartType] = React.useState<ChartType>()
const [chartData, setChartData] = React.useState<ChartData>()
Expand Down Expand Up @@ -341,7 +342,7 @@ export const AnalysisPanel = ({ selectedArea, setSelectedArea, setShowAP, select
<button className="btn btn-sm btn-outline-primary">
<i className="fas fa-square" /> Set extent
</button>
</div>
</div>
<div className="btn-group mr-2" style={{paddingBottom: 15}} onClick={()=>{navigator.clipboard.writeText(selectedArea ? selectedArea.join(",") : ""); alert("Copied selected area to clipboard.")}}>
<button className="btn btn-sm btn-outline-primary">
<i className="fas fa-copy" /> Copy extent
Expand Down Expand Up @@ -382,6 +383,8 @@ export const AnalysisPanel = ({ selectedArea, setSelectedArea, setShowAP, select
</div>
<div className="modal-footer">
<button type="button" className="btn btn-secondary" data-dismiss="modal">Close</button>

<button type='button' className='btn btn-primary' data-dismiss="modal" onClick={()=>setSelectedArea(projectExtent)}>Use project extent</button>
<button
id="save-snapshot-extent-btn"
type="button"
Expand Down
1 change: 1 addition & 0 deletions app/javascript/projects/project_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export function ProjectEditor({ projectId, projectSource, backButtonPath, dbMode
return cache[id] ? cache[id] : null
}}
currentTab={currentTab}
projectExtent={projectExtent}
/>
}
{
Expand Down

0 comments on commit 5df56fa

Please sign in to comment.