Merge pull request '차량 아이콘 안뒤집히게' (#246) from lhj into main
Reviewed-on: http://39.117.244.52:3000/kjs/ERP-node/pulls/246
This commit is contained in:
commit
7a2f80b646
|
|
@ -1409,6 +1409,14 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
|
||||||
// 트럭 마커
|
// 트럭 마커
|
||||||
// 트럭 아이콘이 오른쪽(90도)을 보고 있으므로, 북쪽(0도)으로 가려면 -90도 회전 필요
|
// 트럭 아이콘이 오른쪽(90도)을 보고 있으므로, 북쪽(0도)으로 가려면 -90도 회전 필요
|
||||||
const rotation = heading - 90;
|
const rotation = heading - 90;
|
||||||
|
|
||||||
|
// 회전 각도가 90~270도 범위면 차량이 뒤집어짐 (바퀴가 위로)
|
||||||
|
// 이 경우 scaleY(-1)로 상하 반전하여 바퀴가 아래로 오도록 함
|
||||||
|
const normalizedRotation = ((rotation % 360) + 360) % 360;
|
||||||
|
const isFlipped = normalizedRotation > 90 && normalizedRotation < 270;
|
||||||
|
const transformStyle = isFlipped
|
||||||
|
? `translate(-50%, -50%) rotate(${rotation}deg) scaleY(-1)`
|
||||||
|
: `translate(-50%, -50%) rotate(${rotation}deg)`;
|
||||||
|
|
||||||
markerIcon = L.divIcon({
|
markerIcon = L.divIcon({
|
||||||
className: "custom-truck-marker",
|
className: "custom-truck-marker",
|
||||||
|
|
@ -1419,7 +1427,7 @@ export default function MapTestWidgetV2({ element }: MapTestWidgetV2Props) {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
transform: translate(-50%, -50%) rotate(${rotation}deg);
|
transform: ${transformStyle};
|
||||||
filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
|
filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
|
||||||
">
|
">
|
||||||
<svg width="48" height="48" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
|
<svg width="48" height="48" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue