polarvo-layout 1.0.79 → 1.0.81
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 +1 -1
- package/src/components/Layout/BaseLayout.vue +1 -1
- package/src/components/Layout/CanvasContainer.vue +19 -11
- package/src/components/Layout/FreeItem.vue +4 -4
- package/src/components/Layout/GridItem.vue +3 -3
- package/src/configs/resources/displayResource.js +1 -1
- package/src/core/engines/DisplayEngine.js +1 -1
- package/src/core/engines/FreeDropEngine.js +7 -14
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
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
3
|
-
<div
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
class="absolute bottom-4 left-4 right-4 bg-gray-50 flex items-center justify-center text-gray-400 rounded-lg hover:bg-gray-100 hover:text-gray-600 cursor-pointer"
|
|
7
|
-
@click="expandContainer()"
|
|
8
|
-
>
|
|
9
|
-
<font-awesome-icon :icon="['fas', 'plus']" class="h-8 text-xs" />
|
|
2
|
+
<div class="w-full h-full flex flex-col bg-gray-50">
|
|
3
|
+
<div class="canvas-wrapper w-full flex-1 min-h-0 overflow-y-auto overflow-x-hidden bg-gray-50">
|
|
4
|
+
<div id="canvas-container" class="border rounded-md w-full bg-white" :style="containerStyle">
|
|
5
|
+
<BaseLayout :polarvo="polarvo" class="relative" />
|
|
10
6
|
</div>
|
|
11
7
|
</div>
|
|
8
|
+
<div
|
|
9
|
+
class="py-2 px-2 shrink-0 bg-white border border-gray-300 flex items-center justify-center text-gray-500 rounded-lg hover:bg-gray-100 cursor-pointer"
|
|
10
|
+
:style="{ width: `${displayWidth}px`, margin: '8px auto ' }"
|
|
11
|
+
@click="expandContainer()"
|
|
12
|
+
>
|
|
13
|
+
<font-awesome-icon :icon="['fas', 'plus']" class="h-8 text-xs" />
|
|
14
|
+
</div>
|
|
12
15
|
</div>
|
|
13
16
|
</template>
|
|
14
17
|
|
|
@@ -26,7 +29,7 @@ const props = defineProps({
|
|
|
26
29
|
const DEFAULT_DISPLAY_SIZE = {
|
|
27
30
|
px: 1200,
|
|
28
31
|
percent: 100,
|
|
29
|
-
gridSize:
|
|
32
|
+
gridSize: 10,
|
|
30
33
|
aspectRatio: '16/9',
|
|
31
34
|
};
|
|
32
35
|
|
|
@@ -55,6 +58,11 @@ watch(
|
|
|
55
58
|
|
|
56
59
|
const additionalHeight = ref(0);
|
|
57
60
|
const displayHeight = computed(() => defaultHeight.value + additionalHeight.value);
|
|
61
|
+
const displayWidth = computed(() => {
|
|
62
|
+
const px = displaySize.value?.px ?? DEFAULT_DISPLAY_SIZE.px;
|
|
63
|
+
const percent = displaySize.value?.percent ?? DEFAULT_DISPLAY_SIZE.percent;
|
|
64
|
+
return px * (percent / 100);
|
|
65
|
+
});
|
|
58
66
|
|
|
59
67
|
function expandContainer() {
|
|
60
68
|
additionalHeight.value += 200;
|
|
@@ -74,7 +82,7 @@ const containerStyle = computed(() => {
|
|
|
74
82
|
linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px)
|
|
75
83
|
`,
|
|
76
84
|
backgroundSize: `${DEFAULT_DISPLAY_SIZE.gridSize}px ${DEFAULT_DISPLAY_SIZE.gridSize}px`,
|
|
77
|
-
backgroundPosition: '
|
|
85
|
+
backgroundPosition: '10px 10px', // BaseLayout의 p-[10px]와 맞춰 좌상단 기준으로 정렬 (gridSize와 무관한 고정값)
|
|
78
86
|
};
|
|
79
87
|
}
|
|
80
88
|
|
|
@@ -90,7 +98,7 @@ const containerStyle = computed(() => {
|
|
|
90
98
|
linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px)
|
|
91
99
|
`,
|
|
92
100
|
backgroundSize: `${displaySize.value.gridSize}px ${displaySize.value.gridSize}px`,
|
|
93
|
-
backgroundPosition: '
|
|
101
|
+
backgroundPosition: '10px 10px', // BaseLayout의 p-[10px]와 맞춰 좌상단 기준으로 정렬 (gridSize와 무관한 고정값)
|
|
94
102
|
};
|
|
95
103
|
});
|
|
96
104
|
</script>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
@mousedown.stop="activeEditMode ? null : handleMouseDown($event, item.id)"
|
|
8
8
|
>
|
|
9
9
|
<!-- 크기-->
|
|
10
|
-
<div v-if="item.id === activeId" class="absolute bg-blue-400 px-2 py-1 text-sm text-white right-0 z-
|
|
10
|
+
<div v-if="item.id === activeId" class="absolute bg-blue-400 px-2 py-1 text-sm text-white right-0 z-20">
|
|
11
11
|
가로: {{ Math.round(size.w) }} 세로: {{ Math.round(size.h) }}
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
<div
|
|
17
17
|
v-for="handle in handles"
|
|
18
18
|
:key="handle.name"
|
|
19
|
-
:class="`handle absolute bg-blue-400 z-
|
|
19
|
+
:class="`handle absolute bg-blue-400 z-20 pointer-events-auto hover:bg-blue-700 ${handle.name}`"
|
|
20
20
|
@mousedown="startResize($event, handle.name)"
|
|
21
21
|
></div>
|
|
22
22
|
<div class="flex flex-row m-1 gap-1">
|
|
23
23
|
<!-- 잠금 토글-->
|
|
24
|
-
<div class="z-
|
|
24
|
+
<div class="z-20 pointer-events-auto cursor-pointer" @click="toggleLock()">
|
|
25
25
|
<LockIcon v-if="item.isLocked" />
|
|
26
26
|
<UnlockIcon v-else />
|
|
27
27
|
</div>
|
|
28
28
|
<!-- 편집 토글-->
|
|
29
|
-
<div class="z-
|
|
29
|
+
<div class="z-20 pointer-events-auto cursor-pointer">
|
|
30
30
|
<div v-if="item.type === 'inputForm'" @click="toggleEditMode">
|
|
31
31
|
<div v-if="activeEditMode" class="bg-red-100 text-red-400 px-2 py-1 text-sm rounded-md hover:opacity-80 animate-pulse">
|
|
32
32
|
편집모드 on
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
<!-- 리사이즈 핸들 -->
|
|
15
15
|
<div v-if="item.id === activeId" class="absolute inset-0 pointer-events-none">
|
|
16
16
|
<div
|
|
17
|
-
class="absolute w-2 h-2 bottom-0 right-0 bg-blue-400 z-
|
|
17
|
+
class="absolute w-2 h-2 bottom-0 right-0 bg-blue-400 z-20 pointer-events-auto cursor-se-resize"
|
|
18
18
|
@mousedown="startResize($event, item.id)"
|
|
19
19
|
></div>
|
|
20
20
|
<div class="flex gap-1 m-1">
|
|
21
21
|
<!-- 잠금 토글-->
|
|
22
|
-
<div class="z-
|
|
22
|
+
<div class="z-20 pointer-events-auto cursor-pointer" @click="toggleLock()">
|
|
23
23
|
<LockIcon v-if="item.isLocked" />
|
|
24
24
|
<UnlockIcon v-else />
|
|
25
25
|
</div>
|
|
26
26
|
<!-- 편집 토글-->
|
|
27
|
-
<div class="z-
|
|
27
|
+
<div class="z-20 pointer-events-auto cursor-pointer">
|
|
28
28
|
<div v-if="item.type === 'inputForm'" @click="toggleEditMode">
|
|
29
29
|
<div v-if="activeEditMode" class="bg-red-100 text-red-400 px-2 py-1 text-sm rounded-md hover:opacity-80 animate-pulse">
|
|
30
30
|
편집모드 on
|
|
@@ -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
|
/** [내부함수] 새로운 크기와 위치 계산
|