|
@@ -20,7 +20,13 @@
|
|
|
/>
|
|
|
|
|
|
<SizeLine
|
|
|
- v-if="config.showComponentSize || isDrawIng || dragIng"
|
|
|
+ v-if="
|
|
|
+ status.active ||
|
|
|
+ config.showComponentSize ||
|
|
|
+ isDrawIng ||
|
|
|
+ dragPointIds?.includes(line.a) ||
|
|
|
+ dragPointIds?.includes(line.b)
|
|
|
+ "
|
|
|
:points="points"
|
|
|
:strokeWidth="style.strokeWidth"
|
|
|
:stroke="style.stroke"
|
|
@@ -53,7 +59,7 @@
|
|
|
:name="shapeName"
|
|
|
@change="
|
|
|
() => {
|
|
|
- isStartChange || emit('updateBefore');
|
|
|
+ isStartChange || emit('updateBefore', []);
|
|
|
emit('updateLine', { ...line });
|
|
|
emit('update');
|
|
|
isStartChange = false;
|
|
@@ -81,7 +87,10 @@ import { ComponentSnapInfo } from "../index.ts";
|
|
|
import { useCustomSnapInfos } from "@/core/hook/use-snap.ts";
|
|
|
import { mergeDescribes } from "@/core/html-mount/propertys/index.ts";
|
|
|
import { PropertyUpdate, Operate } from "../../html-mount/propertys/index.ts";
|
|
|
-import { useAnimationMouseStyle } from "@/core/hook/use-mouse-status.ts";
|
|
|
+import {
|
|
|
+ useAnimationMouseStyle,
|
|
|
+ useMouseShapeStatus,
|
|
|
+} from "@/core/hook/use-mouse-status.ts";
|
|
|
import { themeColor } from "@/constant";
|
|
|
|
|
|
const mode = useMode();
|
|
@@ -91,6 +100,7 @@ const props = defineProps<{
|
|
|
addMode?: boolean;
|
|
|
canEdit?: boolean;
|
|
|
data: LineData;
|
|
|
+ dragPointIds?: string[];
|
|
|
}>();
|
|
|
|
|
|
const emit = defineEmits<{
|
|
@@ -99,7 +109,7 @@ const emit = defineEmits<{
|
|
|
(e: "delPoint", value: LineData["points"][number]): void;
|
|
|
(e: "delLine"): void;
|
|
|
(e: "updateLine", value: LineData["lines"][number]): void;
|
|
|
- (e: "updateBefore"): void;
|
|
|
+ (e: "updateBefore", value: string[]): void;
|
|
|
(e: "update"): void;
|
|
|
}>();
|
|
|
|
|
@@ -110,7 +120,11 @@ const points = computed(() => [
|
|
|
]);
|
|
|
const lineData = computed(() => props.line);
|
|
|
const describes = mergeDescribes(lineData, {}, ["stroke", "strokeWidth"]);
|
|
|
-(describes.strokeWidth.props as any).proportion = true;
|
|
|
+const d = describes as any;
|
|
|
+d.strokeWidth.props.proportion = true;
|
|
|
+d.strokeWidth.label = "粗细";
|
|
|
+d.stroke.label = "颜色";
|
|
|
+
|
|
|
let isStartChange = false;
|
|
|
describes.length = {
|
|
|
type: "inputNum",
|
|
@@ -121,7 +135,7 @@ describes.length = {
|
|
|
},
|
|
|
set value(val) {
|
|
|
if (!isStartChange) {
|
|
|
- emit("updateBefore");
|
|
|
+ emit("updateBefore", [props.line.a, props.line.b]);
|
|
|
}
|
|
|
isStartChange = true;
|
|
|
const aCount = props.data.lines.filter(
|
|
@@ -151,7 +165,7 @@ describes.length = {
|
|
|
};
|
|
|
|
|
|
const delHandler = () => {
|
|
|
- emit("updateBefore");
|
|
|
+ emit("updateBefore", [props.line.a, props.line.b]);
|
|
|
emit("delLine");
|
|
|
emit("update");
|
|
|
};
|
|
@@ -162,6 +176,7 @@ const menus = [
|
|
|
},
|
|
|
];
|
|
|
|
|
|
+const status = useMouseShapeStatus(shape);
|
|
|
const [mstyle] = useAnimationMouseStyle({
|
|
|
shape,
|
|
|
getMouseStyle,
|
|
@@ -177,24 +192,22 @@ const style = computed(() =>
|
|
|
);
|
|
|
|
|
|
const addPoint = (pos: Pos) => {
|
|
|
- emit("updateBefore");
|
|
|
+ emit("updateBefore", []);
|
|
|
emit("addPoint", { ...points.value[0], ...pos, id: onlyId() });
|
|
|
emit("update");
|
|
|
};
|
|
|
|
|
|
const config = useConfig();
|
|
|
const delPoint = (point: LineData["points"][number]) => {
|
|
|
- emit("updateBefore");
|
|
|
+ emit("updateBefore", []);
|
|
|
emit("delPoint", point);
|
|
|
emit("update");
|
|
|
};
|
|
|
|
|
|
const infos = useCustomSnapInfos();
|
|
|
let snapInfos: ComponentSnapInfo[];
|
|
|
-let dragIng = ref(false);
|
|
|
const dragstartHandler = (eIds: string[]) => {
|
|
|
- dragIng.value = true;
|
|
|
- emit("updateBefore");
|
|
|
+ emit("updateBefore", eIds);
|
|
|
|
|
|
snapInfos = getSnapInfos({
|
|
|
...props.data,
|
|
@@ -208,7 +221,6 @@ const dragstartHandler = (eIds: string[]) => {
|
|
|
});
|
|
|
};
|
|
|
const dragendHandler = () => {
|
|
|
- dragIng.value = false;
|
|
|
emit("update");
|
|
|
// snapInfos.forEach((item) => infos.remove(item));
|
|
|
};
|