Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c05df26cf | ||
|
|
ef5e6d9017 | ||
|
|
049143a385 |
2 changed files with 94 additions and 50 deletions
|
|
@ -163,8 +163,19 @@ function reattachAndResizeMap(retry = 0) {
|
|||
mapView.value.container = activeContainer
|
||||
}
|
||||
|
||||
// เรียก resize() อย่างปลอดภัยด้วยการตรวจสอบว่ามี method นี้หรือไม่
|
||||
try {
|
||||
if (typeof mapView.value.resize === 'function') {
|
||||
mapView.value.resize()
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Map resize failed:', error)
|
||||
}
|
||||
|
||||
if (typeof mapView.value.requestRender === 'function') {
|
||||
mapView.value.requestRender?.()
|
||||
}
|
||||
|
||||
mapView.value
|
||||
.goTo(
|
||||
{
|
||||
|
|
@ -285,7 +296,11 @@ async function initializeMap() {
|
|||
geometry: userPoint,
|
||||
symbol: userSymbol,
|
||||
})
|
||||
|
||||
// เพิ่มการตรวจสอบความปลอดภัยก่อนเข้าถึง graphics
|
||||
if (mapView.value && mapView.value.graphics && !mapView.value.destroyed) {
|
||||
mapView.value.graphics.add(userGraphic)
|
||||
}
|
||||
// Get POI place ยิงไปขอที่ server ของกทม.ก่อน
|
||||
// await axios
|
||||
// .get(
|
||||
|
|
@ -381,12 +396,22 @@ async function initializeMap() {
|
|||
geometry: poiPoint,
|
||||
symbol: poiSymbol,
|
||||
})
|
||||
|
||||
// เพิ่มการตรวจสอบความปลอดภัยก่อนเข้าถึง graphics และ goTo
|
||||
if (mapView.value && !mapView.value.destroyed) {
|
||||
if (mapView.value.graphics) {
|
||||
mapView.value.graphics.add(poiGraphic)
|
||||
}
|
||||
// อัปเดตการแสดงผลให้แสดงทั้งตำแหน่งของผู้ใช้และ POI
|
||||
if (typeof mapView.value.goTo === 'function') {
|
||||
mapView.value.goTo({
|
||||
target: [userPoint, poiPoint],
|
||||
zoom: zoomMap.value,
|
||||
}).catch(() => {
|
||||
// Ignore goTo errors
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
updateLocation(latitude, longitude, poiPlaceName.value)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -638,19 +638,18 @@ async function fetchCheckStatus() {
|
|||
/** inQueue เป็น true */
|
||||
isDisabledCheckTime.value = true
|
||||
msgCheckTime.value = 'ระบบกำลังประมวลผล'
|
||||
if (intervalId.value === undefined) {
|
||||
intervalId.value = setInterval(async () => {
|
||||
try {
|
||||
await fetchCheckStatus()
|
||||
} catch (error) {
|
||||
console.error('Error in interval fetchCheckStatus:', error)
|
||||
// หยุด interval ถ้าเกิด error
|
||||
stopChecking()
|
||||
}
|
||||
}, 3000)
|
||||
console.log('startChecking called, intervalId:', intervalId.value)
|
||||
}
|
||||
// hideLoader()
|
||||
// if (intervalId.value === undefined) {
|
||||
// intervalId.value = setInterval(async () => {
|
||||
// try {
|
||||
// await fetchCheckStatus()
|
||||
// } catch (error) {
|
||||
// console.error('Error in interval fetchCheckStatus:', error)
|
||||
// // หยุด interval ถ้าเกิด error
|
||||
// stopChecking()
|
||||
// }
|
||||
// }, 3000)
|
||||
// console.log('startChecking called, intervalId:', intervalId.value)
|
||||
// }
|
||||
} else {
|
||||
/** inQueue เป็น false */
|
||||
isDisabledCheckTime.value = false
|
||||
|
|
@ -1414,13 +1413,13 @@ watch(notificationCounter, () => {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="cameraIsOn">
|
||||
<div v-if="cameraIsOn && img == null">
|
||||
<div
|
||||
v-if="$q.screen.gt.xs"
|
||||
class="absolute-bottom-right q-ma-md"
|
||||
>
|
||||
<q-btn
|
||||
v-if="availableCameras.length > 1 && img == null"
|
||||
v-if="availableCameras.length > 1"
|
||||
round
|
||||
push
|
||||
icon="flip_camera_ios"
|
||||
|
|
@ -1430,7 +1429,6 @@ watch(notificationCounter, () => {
|
|||
@click="switchCamera"
|
||||
/>
|
||||
<q-btn
|
||||
v-if="img == null"
|
||||
round
|
||||
push
|
||||
icon="photo_camera"
|
||||
|
|
@ -1438,8 +1436,41 @@ watch(notificationCounter, () => {
|
|||
color="positive"
|
||||
@click="capturePhoto"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div
|
||||
class="absolute-bottom text-subtitle2 text-center q-py-sm"
|
||||
style="background: #00000021"
|
||||
>
|
||||
<q-btn
|
||||
v-if="availableCameras.length > 1"
|
||||
round
|
||||
icon="flip_camera_ios"
|
||||
size="16px"
|
||||
style="background: #424242; color: white"
|
||||
@click="switchCamera"
|
||||
unelevated
|
||||
class="q-mr-xs"
|
||||
/>
|
||||
<q-btn
|
||||
round
|
||||
icon="photo_camera"
|
||||
size="18px"
|
||||
style="background: #263238; color: white"
|
||||
@click="capturePhoto"
|
||||
unelevated
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Refresh button - shows when photo is captured regardless of camera state -->
|
||||
<div v-if="img != null && !useNativePhotoCapture">
|
||||
<div
|
||||
v-if="$q.screen.gt.xs"
|
||||
class="absolute-bottom-right q-ma-md"
|
||||
>
|
||||
<q-btn
|
||||
v-else
|
||||
round
|
||||
push
|
||||
icon="refresh"
|
||||
|
|
@ -1454,31 +1485,12 @@ watch(notificationCounter, () => {
|
|||
style="background: #00000021"
|
||||
>
|
||||
<q-btn
|
||||
v-if="availableCameras.length > 1 && img == null"
|
||||
round
|
||||
icon="flip_camera_ios"
|
||||
size="16px"
|
||||
style="background: #424242; color: white"
|
||||
@click="switchCamera"
|
||||
unelevated
|
||||
class="q-mr-xs"
|
||||
/>
|
||||
<q-btn
|
||||
round
|
||||
v-if="img == null"
|
||||
icon="photo_camera"
|
||||
size="18px"
|
||||
style="background: #263238; color: white"
|
||||
@click="capturePhoto"
|
||||
unelevated
|
||||
/>
|
||||
<q-btn
|
||||
v-else
|
||||
round
|
||||
icon="refresh"
|
||||
size="18px"
|
||||
style="background: #263238; color: white"
|
||||
@click="refreshPhoto"
|
||||
unelevated
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1550,13 +1562,13 @@ watch(notificationCounter, () => {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="cameraIsOn">
|
||||
<div v-if="cameraIsOn && img == null">
|
||||
<div
|
||||
class="absolute-bottom text-subtitle2 text-center q-py-sm"
|
||||
style="background: #00000021"
|
||||
>
|
||||
<q-btn
|
||||
v-if="availableCameras.length > 1 && img == null"
|
||||
v-if="availableCameras.length > 1"
|
||||
round
|
||||
icon="flip_camera_ios"
|
||||
size="16px"
|
||||
|
|
@ -1567,15 +1579,22 @@ watch(notificationCounter, () => {
|
|||
/>
|
||||
<q-btn
|
||||
round
|
||||
v-if="img == null"
|
||||
icon="photo_camera"
|
||||
size="18px"
|
||||
style="background: #263238; color: white"
|
||||
@click="capturePhoto"
|
||||
unelevated
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Refresh button - shows when photo is captured regardless of camera state -->
|
||||
<div v-if="img != null && !useNativePhotoCapture">
|
||||
<div
|
||||
class="absolute-bottom text-subtitle2 text-center q-py-sm"
|
||||
style="background: #00000021"
|
||||
>
|
||||
<q-btn
|
||||
v-else
|
||||
round
|
||||
icon="refresh"
|
||||
size="18px"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue