polarvo-layout 1.0.79 → 1.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
:id="preview ? 'previewLayout' : 'baseLayout'"
|
|
4
|
-
class="grid h-full p-
|
|
4
|
+
class="grid h-full p-[10px] bg-transparent rounded-lg"
|
|
5
5
|
:class="[layoutType + '-layout', `grid-cols-${gridNumber?.column}`, { 'mb-4': layoutType === 'three-column-split' }]"
|
|
6
6
|
:style="getBaseStyle"
|
|
7
7
|
@contextmenu.prevent
|
|
@@ -26,7 +26,7 @@ const props = defineProps({
|
|
|
26
26
|
const DEFAULT_DISPLAY_SIZE = {
|
|
27
27
|
px: 1200,
|
|
28
28
|
percent: 100,
|
|
29
|
-
gridSize:
|
|
29
|
+
gridSize: 10,
|
|
30
30
|
aspectRatio: '16/9',
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -74,7 +74,7 @@ const containerStyle = computed(() => {
|
|
|
74
74
|
linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px)
|
|
75
75
|
`,
|
|
76
76
|
backgroundSize: `${DEFAULT_DISPLAY_SIZE.gridSize}px ${DEFAULT_DISPLAY_SIZE.gridSize}px`,
|
|
77
|
-
backgroundPosition: '
|
|
77
|
+
backgroundPosition: '10px 10px', // BaseLayout의 p-[10px]와 맞춰 좌상단 기준으로 정렬 (gridSize와 무관한 고정값)
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -90,7 +90,7 @@ const containerStyle = computed(() => {
|
|
|
90
90
|
linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px)
|
|
91
91
|
`,
|
|
92
92
|
backgroundSize: `${displaySize.value.gridSize}px ${displaySize.value.gridSize}px`,
|
|
93
|
-
backgroundPosition: '
|
|
93
|
+
backgroundPosition: '10px 10px', // BaseLayout의 p-[10px]와 맞춰 좌상단 기준으로 정렬 (gridSize와 무관한 고정값)
|
|
94
94
|
};
|
|
95
95
|
});
|
|
96
96
|
</script>
|
|
@@ -542,22 +542,15 @@ class FreeDropEngine {
|
|
|
542
542
|
const rawX = event.clientX - layoutRect.left - offsetPos.x;
|
|
543
543
|
const rawY = event.clientY - layoutRect.top - offsetPos.y;
|
|
544
544
|
|
|
545
|
-
//
|
|
546
|
-
//
|
|
545
|
+
// grid snap을 먼저 적용한 뒤 경계로 clamp해야 함
|
|
546
|
+
// (clamp 후 snap하면 반올림으로 인해 경계값(maxX/maxY, grid 배수가 아님)보다 커질 수 있어
|
|
547
|
+
// 우측/하단 경계를 넘어가는 문제가 발생함)
|
|
548
|
+
const gridX = this._snapToGrid(rawX);
|
|
549
|
+
const gridY = this._snapToGrid(rawY);
|
|
547
550
|
|
|
548
|
-
|
|
549
|
-
// const clampedX = Math.min(Math.max(0, rawX), maxX);
|
|
550
|
-
// const clampedY = Math.min(Math.max(0, rawY), maxY);
|
|
551
|
+
const clamped = this._clampToLayoutBounds(gridX, gridY, layoutRect);
|
|
551
552
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
// const gridX = this._snapToGrid(rawX);
|
|
555
|
-
// const gridY = this._snapToGrid(rawY);
|
|
556
|
-
|
|
557
|
-
const gridX = this._snapToGrid(clamped.x);
|
|
558
|
-
const gridY = this._snapToGrid(clamped.y);
|
|
559
|
-
|
|
560
|
-
return { x: gridX, y: gridY };
|
|
553
|
+
return { x: clamped.x, y: clamped.y };
|
|
561
554
|
}
|
|
562
555
|
|
|
563
556
|
/** [내부함수] 새로운 크기와 위치 계산
|