|
@@ -4,7 +4,7 @@
|
|
|
ref="componentWrapperRef"
|
|
|
:style="warpperStyle"
|
|
|
>
|
|
|
- <div class="component-content">
|
|
|
+ <div class="component-content" @click="handleSelectComponent">
|
|
|
<component :is="component" v-bind="componentData.props" />
|
|
|
</div>
|
|
|
<div v-if="showEditBox" class="edit-box" :style="editWapperStyle">
|
|
@@ -87,8 +87,15 @@ useDraggable(componentWrapperRef, {
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
+ onStart: () => {
|
|
|
+ projectStore.setSelectedElementKeys([componentData.key]);
|
|
|
+ }
|
|
|
});
|
|
|
+const handleSelectComponent = () => {
|
|
|
+ projectStore.setSelectedElementKeys([componentData.key]);
|
|
|
+};
|
|
|
|
|
|
+/* ===============================缩放组件==================================== */
|
|
|
const dragPointList = [
|
|
|
"top-left",
|
|
|
"top-center",
|
|
@@ -100,7 +107,6 @@ const dragPointList = [
|
|
|
"bottom-right",
|
|
|
];
|
|
|
|
|
|
-/* ===============================缩放组件==================================== */
|
|
|
const startPoint = {
|
|
|
x: 0,
|
|
|
y: 0,
|
|
@@ -193,55 +199,55 @@ const handleDragEnd = () => {
|
|
|
position: absolute;
|
|
|
&-point {
|
|
|
position: absolute;
|
|
|
- width: 6px;
|
|
|
- height: 6px;
|
|
|
+ width: 8px;
|
|
|
+ height: 8px;
|
|
|
background: #fff;
|
|
|
border-radius: 50%;
|
|
|
border: solid 1px @primary-color;
|
|
|
}
|
|
|
.top-left {
|
|
|
- top: -3px;
|
|
|
- left: -3px;
|
|
|
+ top: -4px;
|
|
|
+ left: -4px;
|
|
|
cursor: nw-resize;
|
|
|
}
|
|
|
.top-center {
|
|
|
- top: -3px;
|
|
|
+ top: -4px;
|
|
|
left: 50%;
|
|
|
transform: translateX(-50%);
|
|
|
transform-origin: center;
|
|
|
cursor: n-resize;
|
|
|
}
|
|
|
.top-right {
|
|
|
- top: -3px;
|
|
|
- right: -3px;
|
|
|
+ top: -4px;
|
|
|
+ right: -4px;
|
|
|
cursor: ne-resize;
|
|
|
}
|
|
|
.left-center {
|
|
|
top: 50%;
|
|
|
- left: -3px;
|
|
|
+ left: -4px;
|
|
|
transform: translateY(-50%);
|
|
|
cursor: w-resize;
|
|
|
}
|
|
|
.right-center {
|
|
|
top: 50%;
|
|
|
- right: -3px;
|
|
|
+ right: -4px;
|
|
|
transform: translateY(-50%);
|
|
|
cursor: e-resize;
|
|
|
}
|
|
|
.bottom-left {
|
|
|
- bottom: -3px;
|
|
|
- left: -3px;
|
|
|
+ bottom: -4px;
|
|
|
+ left: -4px;
|
|
|
cursor: sw-resize;
|
|
|
}
|
|
|
.bottom-center {
|
|
|
- bottom: -3px;
|
|
|
+ bottom: -4px;
|
|
|
left: 50%;
|
|
|
transform: translateX(-50%);
|
|
|
cursor: s-resize;
|
|
|
}
|
|
|
.bottom-right {
|
|
|
- bottom: -3px;
|
|
|
- right: -3px;
|
|
|
+ bottom: -4px;
|
|
|
+ right: -4px;
|
|
|
cursor: se-resize;
|
|
|
}
|
|
|
}
|