bill vor 8 Monaten
Ursprung
Commit
44f15c7e64
3 geänderte Dateien mit 11 neuen und 6 gelöschten Zeilen
  1. 5 1
      src/components/path/list.vue
  2. 4 3
      src/components/path/sign.vue
  3. 2 2
      src/sdk/sdk.ts

+ 5 - 1
src/components/path/list.vue

@@ -30,7 +30,11 @@ const updatePosition = (ndx: number, data: Path["points"]) => {
   props.paths[ndx].points = data;
 };
 const updateLinePosition = (ndx: number, linePosition: Path["linePosition"]) => {
-  props.paths[ndx].linePosition = linePosition;
+  if (props.paths[ndx].linePosition) {
+    Object.assign(props.paths[ndx].linePosition, linePosition);
+  } else {
+    props.paths[ndx].linePosition = linePosition;
+  }
 };
 
 defineExpose(nodes);

+ 4 - 3
src/components/path/sign.vue

@@ -31,8 +31,8 @@ const getLineProps = () => ({
   width: props.path.lineWidth,
   color: props.path.lineColor,
   altitudeAboveGround: props.path.lineAltitudeAboveGround,
-  position: props.path.linePosition?.position || props.path.points[0]?.position,
-  modelId: props.path.linePosition?.modelId || props.path.points[0]?.modelId,
+  position: props.path.linePosition?.position,
+  modelId: props.path.linePosition?.modelId,
 });
 
 const path = sdk.createPath({
@@ -44,7 +44,7 @@ const path = sdk.createPath({
   line: getLineProps(),
   points: props.path.points,
 });
-console.log(props.path.points);
+console.log(getLineProps());
 // path.changeCanEdit(false);
 
 watchEffect(() => path.visibilityName(props.path.showName));
@@ -113,6 +113,7 @@ watch(
   },
   { deep: true }
 );
+
 path.bus.on("linePositionChange", (position) => {
   const p = {
     position: { ...position.pos },

+ 2 - 2
src/sdk/sdk.ts

@@ -215,8 +215,8 @@ export type PathProps = {
     width: number,
     color: string,
     altitudeAboveGround: number
-    position: SceneLocalPos,
-    modelId: string
+    position?: SceneLocalPos,
+    modelId?: string
   },
   points: {
     // 点位名称