-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/add-build-outputs-to-turbo
- Loading branch information
Showing
8 changed files
with
161 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# feat/fix/chore: pr title | ||
|
||
## JIRA Ticket | ||
|
||
[<JIRA_TICKET>](https://jira.csiro.com/browse/<JIRA_TICKET>) | ||
|
||
## Description | ||
|
||
Briefly describe the purpose of this pull request. | ||
|
||
## Proposed Changes | ||
|
||
List the changes made in this PR. | ||
|
||
## How to Test | ||
|
||
Explain how to test the changes. | ||
|
||
## Additional Information | ||
|
||
Add any additional information or context about the pull request here. | ||
|
||
## Checklist | ||
|
||
- [ ] I have confirmed all commits have been signed. | ||
- [ ] I have added JSDoc style comments to any new functions or classes. | ||
- [ ] Relevant documentation such as READMEs, guides, and class comments are updated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {Control} from 'ol/control'; | ||
import {Coordinate} from 'ol/coordinate'; | ||
import {View} from 'ol'; | ||
import {CreateDomIcon} from './dom-icon'; | ||
import src from '../../../target.svg'; | ||
|
||
/** | ||
* Creates a custom control button that centers the map view to a specified coordinate. | ||
* | ||
* @param {View} view - The map view instance to be controlled. | ||
* @param {Coordinate} center - The coordinate to which the map view should be centered. | ||
* @returns {Control} - The custom control instance. | ||
*/ | ||
export const createCenterControl = ( | ||
view: View, | ||
center: Coordinate | ||
): Control => { | ||
const button = document.createElement('button'); | ||
button.className = 'ol-center-button'; | ||
|
||
button.appendChild( | ||
CreateDomIcon({ | ||
src, | ||
width: 24, | ||
height: 24, | ||
alt: 'Center map', | ||
}) | ||
); | ||
|
||
const handleClick = () => { | ||
view.setCenter(center); | ||
}; | ||
|
||
button.addEventListener('click', handleClick); | ||
|
||
const element = document.createElement('div'); | ||
element.className = 'ol-center-box'; | ||
element.appendChild(button); | ||
|
||
return new Control({ | ||
element: element, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
interface CenterControlIconProps { | ||
src: string; | ||
width: number; | ||
height: number; | ||
alt: string; | ||
} | ||
|
||
/** | ||
* Creates a DOM image element with the specified properties. | ||
* | ||
* @param {CenterControlIconProps} props - The properties for the image element. | ||
* @param {string} props.src - The source URL of the image. | ||
* @param {number} props.width - The width of the image in pixels. | ||
* @param {number} props.height - The height of the image in pixels. | ||
* @param {string} props.alt - The alternative text for the image. | ||
* @returns {HTMLImageElement} - The created image element. | ||
*/ | ||
export const CreateDomIcon = ({ | ||
src, | ||
width, | ||
height, | ||
alt, | ||
}: CenterControlIconProps) => { | ||
const img = document.createElement('img'); | ||
|
||
img.width = width; | ||
img.height = height; | ||
img.src = src; | ||
img.alt = alt; | ||
|
||
return img; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.