aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils.mjs
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-11-03 13:58:38 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-11-03 14:36:15 +0800
commitf4910b66e74034db14619ee384dc261423dc19fc (patch)
tree78382b3bb600b61a43b48d417cfbe3873d8da623 /src/utils.mjs
parent3086cc484857dea32a33f829ec173adaf0cf8fbe (diff)
feat: use bbox to update camera for result of Geocoding
* show markers from all Geocoding Results * update mapclay for latest updateCamera method * 3 steps for camera animation: 1. zoom out to bbox which contains all Geocoding Result 2. pan to marker of hovered result 3. zoom in to bbox from nonimatim query * remove markers except selected Geocoding Result
Diffstat (limited to 'src/utils.mjs')
-rw-r--r--src/utils.mjs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/utils.mjs b/src/utils.mjs
index c0da23a..4cce323 100644
--- a/src/utils.mjs
+++ b/src/utils.mjs
@@ -113,6 +113,7 @@ export function debounce (func, delay = 1000) {
113 * @param {HTMLElement} element 113 * @param {HTMLElement} element
114 */ 114 */
115export const shiftByWindow = element => { 115export const shiftByWindow = element => {
116 delete element.style.transform
116 const rect = element.getBoundingClientRect() 117 const rect = element.getBoundingClientRect()
117 const offsetX = window.innerWidth - rect.left - rect.width 118 const offsetX = window.innerWidth - rect.left - rect.width
118 const offsetY = window.innerHeight - rect.top - rect.height 119 const offsetY = window.innerHeight - rect.top - rect.height