wangjuncheng
2025-06-04 137db1a441d1e4460675a5ac5b925a290eb03b1b
src/components/menu/TimeLine.vue
@@ -59,7 +59,7 @@
          @finish-calculation="handleFinishCalculation"
          style="margin-top: 12px; margin-left: 28px; margin-right: 10px;justify-content: flex-end;" />
        <crossanalysis ref="crossRef" style="margin-top: 12px; margin-left: 16px; margin-right: 20px;justify-content: flex-end;" />
      </div>
      <el-button @click="handleBack" style="margin-top: 3px; margin-left: 28px; margin-right: 10px;width: 75%;height: 30%;">结束模拟</el-button>
    </div>
@@ -300,8 +300,8 @@
    min: 10,
    max: 24.9,
    size: 0.7,
    speed: 40,
    density: 35,
    speed: 28,
    density: 23,
    color: '#ADD8E6'
  },
  {
@@ -309,8 +309,8 @@
    min: 25,
    max: 49.9,
    size: 1.0,
    speed: 70,
    density: 60,
    speed: 36,
    density: 31,
    color: '#ADD8E6'
  },
  {
@@ -318,16 +318,16 @@
    min: 50,
    max: 99.9,
    size: 1.3,
    speed: 90,
    density: 80,
    speed: 42,
    density: 39,
    color: '#ADD8E6'
  },
  {
    name: '大暴雨',
    min: 100,
    size: 1.6,
    speed: 110,
    density: 100,
    speed: 50,
    density: 47,
    color: '#ADD8E6'
  }
];
@@ -339,7 +339,7 @@
    }
  }
  // 默认无雨状态
  return { name: '无雨', size: 0.5, speed: 30, density: 20, color: '#F0F8FF' };
  return { name: '无雨', size: 0.3, speed: 10, density: 10, color: '#F0F8FF' };
}
// 根据播放进度更新天气效果(已优化)
let lastUsedIndex = -1; // 缓存上一次使用的索引,防止重复更新
@@ -355,7 +355,8 @@
  const nextRain = rainFallValues.value[nextIndex];
  // 启用插值(alpha 平滑过渡)
  const alpha = floatIndex - index;
  const rainValue = currentRain + (nextRain - currentRain) * alpha;
  // const rainValue = currentRain + (nextRain - currentRain) * alpha;
  const rainValue = currentRain + (nextRain - currentRain)
  // 打印当前处理的雨量数据
  // console.log(`正在处理的雨量数据点: 当前=${currentRain}, 下一个=${nextRain}, 插值后=${rainValue.toFixed(2)}, 索引=${index}`);
  // 如果当前索引未变化且插值差异不大,跳过重复更新
@@ -370,12 +371,12 @@
  // 获取对应的雨形配置
  const rainLevel = getRainLevel(rainValue);
  if (rainLevel.name === '无雨') {
    // 无雨状态:清除雨效
    mapUtils.delRain();
    console.log('执行了无雨状态,清除了雨效');
    return;
  }
  // if (rainLevel.name === '无雨') {
  //   // 无雨状态:清除雨效
  //   mapUtils.delRain();
  //   console.log('执行了无雨状态,清除了雨效');
  //   return;
  // }
  // 非无雨状态:构建雨滴参数并更新雨效
  const rainParams = {
@@ -384,7 +385,7 @@
    rainDensity: rainLevel.density,
    rainColor: rainLevel.color
  };
  // console.log('当前雨量数据:', rainValue, '当前雨形:', rainLevel);
  console.log('当前雨量数据:', rainValue, '当前雨形:', rainLevel);
  // 调用工具方法更新雨效
  mapUtils.toggleRain(rainParams, true);
}