|
|
@@ -65,6 +65,7 @@ let currentPoints = props.path.points;
|
|
|
let changPointsTimeout: any;
|
|
|
path.bus.on("changePoints", (points) => {
|
|
|
clearTimeout(changPointsTimeout);
|
|
|
+ console.log('points', points)
|
|
|
currentPoints = points.map((p, ndx) => ({
|
|
|
name: p.name,
|
|
|
position: { ...p.position },
|
|
|
@@ -80,12 +81,12 @@ path.bus.on("changeLineHeight", (val) => {
|
|
|
|
|
|
watchEffect(() => {
|
|
|
path.changeName(props.path.name);
|
|
|
- path.changeHide(props.path.hide || false);
|
|
|
});
|
|
|
|
|
|
watch(
|
|
|
() => props.path.points.map((i) => ({ modelId: i.modelId, position: i.position })),
|
|
|
(p) => {
|
|
|
+ console.log(p, 'watchEffect0', props.path.points);
|
|
|
changPointsTimeout = setTimeout(() => {
|
|
|
if (inRevise(props.path.points, currentPoints)) {
|
|
|
path.changePathPoints(p);
|
|
|
@@ -97,16 +98,23 @@ watch(
|
|
|
);
|
|
|
|
|
|
watchEffect(() => {
|
|
|
- for (const point of props.path.points) {
|
|
|
- watchEffect(() => {
|
|
|
- const ndx = props.path.points.indexOf(point);
|
|
|
- console.log(ndx, 'watchEffect', ~ndx);
|
|
|
- if (~ndx) {
|
|
|
- path.changePointName(ndx, point.name);
|
|
|
- currentPoints[ndx].name = point.name;
|
|
|
+ props.path.points.forEach((point, index) => {
|
|
|
+ // 监听 name 属性
|
|
|
+ watch(() => point.name, (newName) => {
|
|
|
+ path.changePointName(index, newName);
|
|
|
+ currentPoints[index].name = newName;
|
|
|
+ });
|
|
|
+
|
|
|
+ // 监听 hide 属性
|
|
|
+ watch(() => point.hide, (newHide) => {
|
|
|
+ if (path.changePointDisplay) {
|
|
|
+ path.changePointDisplay(index, !newHide);
|
|
|
}
|
|
|
});
|
|
|
- }
|
|
|
+ });
|
|
|
+},{ deep: true, flush: "post" });
|
|
|
+watchEffect(() => {
|
|
|
+ path.changeDirection(props.path.showDirection, props.path.reverseDirection);
|
|
|
});
|
|
|
|
|
|
let currentLine = getLineProps();
|