From ec22714f01a4190321375d1ea5ef54ea8a536388 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Thu, 30 Apr 2026 11:50:20 +0700 Subject: [PATCH 01/10] fix code error --- src/views/HomeView.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 9de4f22..8017b7c 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -69,7 +69,7 @@ const formattedM = ref() const formattedH = ref() const formattedHH = ref() const formattedA = ref() -const clockInterval = ref() +const clockInterval = ref() /** function อัพเดทเวลา*/ function updateClock() { @@ -194,7 +194,7 @@ const availableCameras = ref([]) const currentCameraIndex = ref(0) const currentCameraType = ref<'front' | 'back' | 'unknown'>('unknown') -const intervalId = ref(undefined) // ต้องใช้ตัวแปรเก็บค่า interval +const intervalId = ref(undefined) // ต้องใช้ตัวแปรเก็บค่า interval /** * เริ่มจาก onMounted #1 เช็ค status คิว @@ -316,7 +316,7 @@ async function openCamera() { if (!isPermissionCameraDenied.value) { // change camera device if (cameraIsOn.value) { - await camera.value?.stop() + camera.value?.stop() } else { await camera.value?.start() const devices: any = await camera.value?.devices(['videoinput']) @@ -405,7 +405,7 @@ async function capturePhoto() { const file = new File([imageBlob], fileName, { type: 'image/png' }) fileImg.value = file //แสดงรูป - await camera.value?.stop() + camera.value?.stop() const url = URL.createObjectURL(imageBlob) img.value = url } From e9d28197df551ef9d0716663073c8c051bfbb26a Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Thu, 30 Apr 2026 15:55:31 +0700 Subject: [PATCH 02/10] fix switch Landscape -> Portrait --- .../hrms-checkin-expert/MEMORY.md | 5 + .../issue_position_orientation_change.md | 48 ++ src/components/AscGISMap.vue | 756 ++++++++++++++---- src/components/AscGISMapTime.vue | 335 +++++--- src/views/HomeView.vue | 99 ++- 5 files changed, 964 insertions(+), 279 deletions(-) create mode 100644 .claude/agent-memory/hrms-checkin-expert/MEMORY.md create mode 100644 .claude/agent-memory/hrms-checkin-expert/issue_position_orientation_change.md diff --git a/.claude/agent-memory/hrms-checkin-expert/MEMORY.md b/.claude/agent-memory/hrms-checkin-expert/MEMORY.md new file mode 100644 index 0000000..f5b3ed9 --- /dev/null +++ b/.claude/agent-memory/hrms-checkin-expert/MEMORY.md @@ -0,0 +1,5 @@ +# HRMS Check-in Expert Memory + +## Project Issues & Fixes + +- [Position Orientation Change Fix](issue_position_orientation_change_fix.md) - Fix for position map not displaying on screen orientation changes diff --git a/.claude/agent-memory/hrms-checkin-expert/issue_position_orientation_change.md b/.claude/agent-memory/hrms-checkin-expert/issue_position_orientation_change.md new file mode 100644 index 0000000..7abffd3 --- /dev/null +++ b/.claude/agent-memory/hrms-checkin-expert/issue_position_orientation_change.md @@ -0,0 +1,48 @@ +--- +name: position_orientation_change_fix +description: Fix for position map not displaying on screen orientation changes +type: project +--- + +## Issue: Position/Geolocation Not Displaying on Screen Orientation Changes + +**Problem:** +The ArcGIS map component (`AscGISMap.vue`) failed to display or update position when the screen orientation changed between portrait and landscape modes. + +**Root Cause:** +1. The component uses `v-if="$q.screen.gt.xs"` for conditional rendering of different layouts +2. When orientation changes, the ArcGIS MapView doesn't automatically resize to fit the new container dimensions +3. ArcGIS MapView requires manual `resize()` call when its container's size changes + +**Solution Implemented:** +Added screen resize handling to `src/components/AscGISMap.vue`: + +1. **Added state tracking:** + - `isMapInitialized` ref to track when map is ready + - `isInitializing` ref to prevent concurrent initializations + +2. **Added `handleMapResize()` function:** + - Checks if mapView exists and isn't destroyed + - Uses `nextTick()` to ensure DOM updates complete before resizing + - Calls `mapView.value.resize()` to update map dimensions + +3. **Added watcher on `$q.screen.gt.xs`:** + - Triggers when screen size crosses the xs breakpoint + - Waits for DOM update via `nextTick()` + - Calls `handleMapResize()` to adjust map + +4. **Added window resize event listener:** + - Falls back for orientation changes that might not trigger Quasar's screen watcher + - Debounced with 300ms timeout to avoid excessive calls + - Properly cleaned up on component unmount + +**Files Modified:** +- `src/components/AscGISMap.vue` - Added resize handling logic + +**Best Practices Applied:** +- Proper cleanup of event listeners in `onBeforeUnmount` +- Debouncing resize events for performance +- Using `nextTick()` to ensure DOM synchronization +- Checking for destroyed state before calling map methods + +**Note:** The Google Maps component (`MapCheckin.vue`) was not affected as `vue3-google-map` handles resize automatically. diff --git a/src/components/AscGISMap.vue b/src/components/AscGISMap.vue index e39f58d..e2dd9b0 100644 --- a/src/components/AscGISMap.vue +++ b/src/components/AscGISMap.vue @@ -1,5 +1,12 @@ -
+
diff --git a/src/components/AscGISMapTime.vue b/src/components/AscGISMapTime.vue index 7360980..2bd31d7 100644 --- a/src/components/AscGISMapTime.vue +++ b/src/components/AscGISMapTime.vue @@ -1,10 +1,8 @@